Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!rit!ritcv!iav1917 From: iav1917%ritcv@cs.rit.edu (alan i. vymetalik) Newsgroups: comp.sys.ibm.pc Subject: Re: switchar character under MSDOS Keywords: '/' '-' source code assembler Message-ID: <1006@cs.rit.edu> Date: 24 Mar 89 01:13:43 GMT References: <6202@bsu-cs.UUCP> <1150@frog.UUCP> Sender: news@cs.rit.edu Reply-To: iav1917%ritcv@cs.rit.edu (alan i. vymetalik) Organization: Rochester Institute of Technology, Rochester, NY Lines: 66 In article <1150@frog.UUCP> rmk@frog.UUCP (Rick Kelly) writes: > > There are two undocumented library routines in Turbo C for setting >and inspecting the switch character. I don't have the information close at >hand but I will post it tomorrow. > >Rick Kelly Well, I can't recall what the routines are in Turbo C either. However, changing the switch character is as easy as the example that follows. It's in TurboPascal, but it's easily converted. Academically it may be fun, but many programs do not properly check the switch character and instead check for particular character on the parameter line. Caveat Emptor, I suppose... Enjoy the routine, Alan ---------------------------------------------------------------------------- { SWCHAR.PAS SWCHAR will set the MS-DOS switch character (normally a "/") to any character passed as a parameter to the program. I.e.: SWCHAR T will set the switch character to "T". This routine uses the "undocumented" MS-DOS function #35. The code should be self- explanatory. Language: TurboPascal V5.0, O/S: MS-DOS V2.11 and above. } Uses DOS; Var s : string[1]; r : Registers; begin { swchar } if paramcount = 1 then begin { Use the letter from the command line as the switch character } s := paramstr(1); r.ax := $3701; r.dx := ord(s[1]); msdos(r); end; { Show current or modified switch character } r.ax := $3700; msdos(r); writeln('The switch character is ',chr(r.dx and $00FF)); end. { swchar } ---------------------------------------------------------------------------- Mail: Alan I. Vymetalik, Prism Software Designs, 8 Barn Swallow Lane Rochester, New York, 14624-4650, USA Phone: (716)-889-2904 uucp: {seismo}!rochester!ritcv!iav1917 BITNET: aiv1917@ritvax Reality Check: The "Reality Check" section is undergoing a complete overhaul. Please excuse the dust.