Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!osupyr.mast.ohio-state.edu!vkr From: vkr@osupyr.mast.ohio-state.edu (Vidhyanath K. Rao) Newsgroups: comp.sys.amiga Subject: Re: Enviroment (was Re: Yea, but can an Amiga Shell do this....) Message-ID: <870@osupyr.mast.ohio-state.edu> Date: 4 Sep 88 17:49:37 GMT References: <8808232121.AA28517@cory.Berkeley.EDU> <10580@stb.UUCP> <4660@cbmvax.UUCP> Organization: Ohio State Math-Stats Dept Lines: 33 In article <4660@cbmvax.UUCP>, jesup@cbmvax.UUCP (Randell Jesup) writes: > [somebody else writes] : :Tell you what: You give me a routine that will take two names, one a : :directory, one a file, and return me a pathname for the file. Handle : :ending slashes, null directories, assigned devices, assigned directories, : :files beginning with slashes, etc. AND make it usable in CLI scripts. : :Then, I will consider the Amiga's file system naming useably clean. : : ok : : char *foo (char *dir,char *file) : { : /* I assume dir can be extended here */ : int dirlen = strlen(dir); : char lastchar; : : if (dirlen) { : lastchar = dir[dirlen-1]; : if (lastchar != ':' && lastchar != '/') : strcat(dir,"/"); : } : strcat(dir,file); : return dir; : } : : It can be much more efficient, but I wrote for clarity. Then sombody with nothing better to do will come along and do 'foo("df0", "fi");' and get "df0/fi" and start yelling. The problem is that only the OS knows what are the legal device names. Now ARP has exactly such a routine. But I don't know if it will take all the abuse you can heap on