[comp.sys.ibm.pc] switchar character under MSDOS

mdlawler@bsu-cs.UUCP (Mike Lawler) (03/18/89)

I know that there was source code posted in the net a few months ago that
would change the switch character from a '/' to a '-' under MSDOS.  I've
lost it and I'd appreciate if someone would repost it or email it to me if
it is only a few lines long.
I have Turbo Pascal 5.0, Turbo C 2.0, and Tasm 1.0.
I prefer the code to be in assembler and if not in assembler then in C, but I
will take it in any language.
Thanks for any replies.
-- 
Mike Lawler         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!mdlawler
                    ARPA:  mdlawler@bsu-cs.bsu.edu

rmk@frog.UUCP (Rick Kelly) (03/22/89)

	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
Test Engineering
Charles River Data Systems
983 Concord St.
Framingham, Mass. 01701

rmk@frog.UUCP (Rick Kelly) (03/23/89)

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
>Test Engineering
>Charles River Data Systems
>983 Concord St.
>Framingham, Mass. 01701

	It is now tomorrow and here are the undocumented routines:

	1. Examine switch character

	   getswitchar()  -  returns a char

	2. Set switch character

	   setswitch	ar(char c);

	Here is a scrap of code that compiles and runs under Turbo C 1.5.

main(argc, argv)
int argc;
char *argv[];
{
	if(argc == 1)	/* no args on command line */
		printf("switchar: %c\n", getswitchar());

	else
	{
		setswitchar((*++argv)[0]);	/* set the switch char */
		printf("switchar: %c\n", getswitchar()); /* check results */
	}
}

Rick Kelly
Test Engineering
Charles River Data Systems
983 Concord St.
Framingham, Mass 01701

iav1917%ritcv@cs.rit.edu (alan i. vymetalik) (03/24/89)

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.

pozar@hoptoad.uucp (Tim Pozar) (03/28/89)

from the MS-Devloper's docs...

Cavaet...

CharOper (Function 37H)

  mov	ah, CharOper(37H)
  mov	al, function
  mov	dl, data
  int	21H

al
--
 0	Return in dl the dos switch char.
 1	Set the swtich char to dl.

	    Tim

-- 
 ...sun!hoptoad!\                                     Tim Pozar
                 >fidogate!pozar               Fido:  1:125/406
  ...lll-winken!/                            PaBell:  (415) 788-3904
       USNail:  KKSF / 77 Maiden Lane /  San Francisco CA 94108