From: Thomas Demmer Newsgroups: comp.os.msdos.djgpp Subject: Re: libc functions handling of UNCs Date: Fri, 26 Sep 1997 09:10:10 +0200 Organization: Lehrstuhl fuer Stroemungsmechanik Lines: 65 Message-ID: <342B5FD2.8C7BA56@LSTM.Ruhr-UNI-Bochum.De> References: <1 DOT 5 DOT 4 DOT 32 DOT 19970925193854 DOT 0068fd8c AT dce03 DOT ipt DOT br> NNTP-Posting-Host: c64.lstm.ruhr-uni-bochum.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit CC: csrabak AT dce03 DOT ipt DOT br To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Cesar Scarpini Rabak wrote: > > I'm experiencing some problems with DJGPP compiled programs running from a > Netware 4.1 server. > > In a nutshell the easier way to show the problem is this sequence of commands: > > C:\>truename f: > \\URASERVER_II\SYS > C:\>ls \\URASERVER_II\SYS > z:/djgpp/bin/ls: //URASERVER_II/SYS: No such file or directory (ENOENT) > > The same behaviour happens if I use fnsplit and fnmerge functions to build a > initialization filename from the executable name (argv[0]). > > Is there a work around or patch for this? Here is something that might help in your own programs: int main(int argc, char **argv){ int ls = strrchr(argv[0],'/')-argv[0]; char i3ecnf[256]; strncpy(PathToExe,argv[0],ls+1); // Netware Fix for UNCs... if( (PathToExe[0]=='/') && (PathToExe[1] =='/')){ PathToExe[0] = '\\'; PathToExe[1] = '\\'; } } The program gets argv[0] as "//brain1/usr/home/demmer/foo.exe", but if you change the // to \\, everything runs fine. (Under DOS6.22, Netware 3.11 and VLM as requestor on weekdays ;-) This snippet might help in your own code, but changes in libc are hard and unlikely . Opening files with a name "\\brain1/usr/home/demmer/foo" is perfectly OK, I'm not sure about stat() and such. splitpath() and alikes will fail, 'cause I don't have the slightest idea how to pack the machine name into a drive letter. The only idea I have is to have a table of names and assign them characters from (char)128 on upwards, but that may break too much existing code. HTH -- Ciao Tom ************************************************************* * Thomas Demmer * * Lehrstuhl fuer Stroemungsmechanik * * Ruhr-Uni-Bochum * * Universitaetsstr. 150 * * D-44780 Bochum * * Tel: +49 234 700 6434 * * Fax: +49 234 709 4162 * * http://www.lstm.ruhr-uni-bochum.de/~demmer * *************************************************************