jacobsn@csd2.UUCP (Nicholas H. Jacobs) (01/03/86)
Many of you may have seen the short note in Dr. Dobb's a while back that allows you to change the switch character in MS-DOS from a '/' to '-', the latter character being the standard switch character in UNIX. This is achieved by putting the line "SWITCHAR=-" in your config.sys file. However, not every compiler on the market knows how to look for this character and when exec'ing command.com to perform the system() function it may die (most notably Lattice does this...). This is because the call to the exec'ing routine simply places a '/c' to the beginning of your command and has command.com exec it. This can be fixed though by re-writing the system() function (a fairly simple function) with the check as follows. There is an undocumented call to DOS which uses interrrupt 21h with (AH) = 37h. Upon return from this call (DL) will contain the ASCII value of the current switch character in it. NOTE: I have heard that changing the switch character does not work under MS-DOS 3.0+, so for many of you this may be less than useful. Hope this is useful to application writers working under DOS. Nicholas Jacobs cmcl2!csd2!jacobsn
nather@utastro.UUCP (Ed Nather) (01/04/86)
> There is an undocumented call to DOS which uses interrrupt 21h with (AH) = > 37h. Upon return from this call (DL) will contain the ASCII value of the > current switch character in it. > > NOTE: I have heard that changing the switch character does not work under > MS-DOS 3.0+, so for many of you this may be less than useful. > > Nicholas Jacobs The call to function 37h can also be used to SET the switch character, and it works the same in DOS 2.x and 3.x. I have a huge assembly language program (8 bytes long) that sets the switch character to "\" because setting it to "-" means you can't have filenames like "pc-write," since DOS then tries to find a file called "pc" and give it the switch "-w". One can then use "/" to separate pathnames, as in Unix. -- Ed Nather Astronomy Dept, U of Texas @ Austin {allegra,ihnp4}!{noao,ut-sally}!utastro!nather nather@astro.UTEXAS.EDU
davidsen@steinmetz.UUCP (Davidsen) (01/07/86)
I believe that call 37H also sets a flag to indicate that the devices are (or are not) available without \dev\ prepended to the name. Now if they'd only allow us to list the \dev directory... Note also that the DOS documentation explicitly states that either "\" or "/" may be used as a path delimiter. The switch character is *only* important at command line parse time. These were options in config.sys for DOS2.x, one was called SWITCHAR=x. I have the other in my copy of the OEM documentation, but it's not at at hand. I believe there's also a way to reset the character and line delete characters, since DEC and PC-PRO (under DOS 2) use contl-X rather than ESC. -- -billd seismo!rochester!steinmetz! unirot / \ / ihnp4! crdos1!davidsen \ / chinet! -----------------/ "It seemed like a good idea at the time..."