Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!mailrus!tut.cis.ohio-state.edu!mandrill!gatech!udel!rochester!cornell!batcomputer!sun.soe.clarkson.edu!nelson From: nelson@sun.soe.clarkson.edu (Russ Nelson) Newsgroups: comp.sys.ibm.pc Subject: Re: using "/" in pathnames Message-ID: <1009@sun.soe.clarkson.edu> Date: 30 May 88 02:14:01 GMT References: <1238@bingvaxu.cc.binghamton.edu> Reply-To: nelson@sun.soe.clarkson.edu (Russ Nelson) Organization: Clarkson University, Potsdam, NY Lines: 40 In article <1238@bingvaxu.cc.binghamton.edu> sullivan@marge.math.binghamton.edu (fred sullivan) writes: >Some time ago someone complained about having to use "\" in MSDOS >pathnames. I just submitted to comp.binaries.ibm.pc a program to >fix this. Similar programs are available as part of Dan Norton's >package of tools (swchar) and from simtel20 >(pd1:switchar.*). Several caveats about '/' vs '\' in pathnames: o Theoretically, '/' is usable in pathnames at all times. o The Set Switchar (3701h) and Get Switchar (3700h) DOS functions *are* documented. Don't let Microsoft tell you otherwise. I will send a photocopy of the page in Zenith's Programmers Utility Package that documents the call to anyone who sends me an SASE. o Command.com thinks that '/' is the switchar. Using the Set Switchar DOS call, you can set the switchar to '-'. This lets you use '/' as a pathname separator. o Most PC Magazine programs and the Norton Utilities ignore the switchar='-' setting. In certain places, they parse the pathname, looking ONLY for '\'. o DOS Backup is rumored to go whacko with switchar=-. o Turbo C has two undocumented functions in its library: setswitchar(char c), and char getswitchar(). They do just what you think they do. o All of the software I write is guaranteed to work with switchar=-. :-) If you are interested in writing software that works with switchar=-, then do this: o if (getswitchar() == '/') Pathchar = '\\' else Pathchar = '/'; o When parsing pathnames, search for '\' OR Pathchar. o Of course, when parsing parameters, look for your switches to begin with getswitchar(). Typically, when I find a useful PC Magazine utility, I modify it to use switchar=-. Thank goodness that they have the good sense to publish source! -- char *reply-to-russ(int network) { if(network == BITNET) return "NELSON@CLUTX"; else return "nelson@clutx.clarkson.edu"; }