[comp.sys.ibm.pc] switchar in DOS 3.2

lma@polya.Stanford.EDU (Larry M. Augustin) (10/15/88)

I was recently forced to upgrade from PC DOS 2.1 to 3.2.  One of my
favorite config.sys commands, switchar=-, doesn't seem to work in 3.2.
Did Microsoft fix this feature?  Is there a way I can change \ to /
without buying a UNIX shell?

Larry M. Augustin			ERL 414
lma@sierra.stanford.edu			Computer Systems Lab
lma@dayton.stanford.edu			Stanford University
(415) 723-9285				Stanford, CA 94305

nelson@sun.soe.clarkson.edu (Russ Nelson) (10/15/88)

In article <4483@polya.Stanford.EDU> lma@polya.Stanford.EDU (Larry M. Augustin) writes:

   I was recently forced to upgrade from PC DOS 2.1 to 3.2.  One of my
   favorite config.sys commands, switchar=-, doesn't seem to work in 3.2.
   Did Microsoft fix this feature?  Is there a way I can change \ to /
   without buying a UNIX shell?

Yes.  If you have a copy of Zenith's PUP (Programmer's Utility Package),
you'll see that there is a DOS call to set the switchar.  Quoting from the
documentation:

"
55/27H--Character Operations
(Change Incompatible Configuration)

Entry:	AL	= 0	Return DL = ASCII switch character
	AL	= 1	Set switch character to DL
	AL	= 2	Return DL = availability byte
	AL	= 3	Set availability byte to DL

Exit:	DL	= Value if AL = 1 or 3


The availability is 0 if devices must be prefixed with the DEV directory name.
"
--
--russ (nelson@clutx [.bitnet | .clarkson.edu])
To surrender is to remain in the hands of barbarians for the rest of my life.
To fight is to leave my bones exposed in the desert waste.

karl@ddsw1.MCS.COM ([Karl Denninger]) (10/16/88)

Regarding the "swithat" config.sys line...

I do know that it can be set from a program; we had one running
around here a while back that would change it to "-" (ala Unix).

This did break a few programs though....

-- Karl Denninger
(karl@ddsw1.MCS.COM)

sullivan@marge.math.binghamton.edu (fred sullivan) (10/18/88)

>In article <4483@polya.Stanford.EDU> lma@polya.Stanford.EDU (Larry M. Augustin) writes:
>
>   I was recently forced to upgrade from PC DOS 2.1 to 3.2.  One of my
>   favorite config.sys commands, switchar=-, doesn't seem to work in 3.2.
>   Did Microsoft fix this feature?  Is there a way I can change \ to /
>   without buying a UNIX shell?
>
A month or two ago I posted a program to do this to comp.binaries.ibm.pc

Fred Sullivan				SUNY at Binghamton
Dept. Math. Sciences			Binghamton, NY 13903
					sullivan@marge.math.binghamton.edu
First you make a roux!

pozar@hoptoad.uucp (Tim Pozar) (10/18/88)

In article <1509@bingvaxu.cc.binghamton.edu> sullivan@marge.math.binghamton.edu (fred sullivan) writes:
>>In article <4483@polya.Stanford.EDU> lma@polya.Stanford.EDU (Larry M. Augustin) writes:
>>
>>   I was recently forced to upgrade from PC DOS 2.1 to 3.2.  One of my
>>   favorite config.sys commands, switchar=-, doesn't seem to work in 3.2.
>>   Did Microsoft fix this feature?  Is there a way I can change \ to /
>>   without buying a UNIX shell?
>>
>A month or two ago I posted a program to do this to comp.binaries.ibm.pc
>

     This is some code I put at the begging of most of my
     programmes to reconize the current ms-dos switch char...


getswitch()
{
union REGS inregs, outregs;

inregs.h.ah = 0x37;
inregs.h.al = 0;
intdos(&inregs,&outregs);       /* find the switch char */

schar = outregs.h.dl;
}

    To set the switch, you would write a function like:

putswitch(c)
char c;
{
union REGS inregs, outregs;

inregs.h.ah = 0x37;
inregs.h.al = 1;
inregs.h.dl = c;
intdos(&inregs,&outregs);
}

	  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

egs@killer.DALLAS.TX.US (Eric Schnoebelen) (10/19/88)

In article <5676@hoptoad.uucp> pozar@hoptoad.UUCP (Tim Pozar) writes:
>
>     This is some code I put at the begging of most of my
>     programmes to reconize the current ms-dos switch char...
>
 [ code deleted ]
>
>	  Tim
>
	Turbo C (1.5) has a function in the standard libraries for
this.  I discovered this after writing my own, then writing a program
that used it and having it work without linking in the correct library.
The functions are:
	int	getswitchar();	/* returns the currect switch character */
	int	setswitchar(char);	/* set the current switchar */

( funny how I managed to name my functions the right thing.. )

	Eric 

Eric Schnoebelen
John W. Bridges & Associates, Inc.
Lewisville, Tx
u-word!egs@killer.dallas.tx.us

allbery@ncoast.UUCP (Brandon S. Allbery) (10/23/88)

As quoted from <4483@polya.Stanford.EDU> by lma@polya.Stanford.EDU (Larry M. Augustin):
+---------------
| I was recently forced to upgrade from PC DOS 2.1 to 3.2.  One of my
| favorite config.sys commands, switchar=-, doesn't seem to work in 3.2.
| Did Microsoft fix this feature?  Is there a way I can change \ to /
| without buying a UNIX shell?
+---------------

It was removed from CONFIG.SYS, but the (undocumented?) system call still
exists.  DOS interrupt 21H, function 37H.  This simple assembler program,
suitable for typing into DEBUG's A command, will change the switchar to '-':
(All numbers are in hex)

			MOV	DL,2D
			MOV	AX,3701
			INT	21
			MOV	AX,4C00
			INT	21

Note the last two hex digits of the "next address" printed by the A command,
issue an RCX command and set CX to the value of those last two digits, then
issue the commands:  NSWITCHAR.COM and W.  Voila!  You can run SWITCHAR from
AUTOEXEC.BAT to set the switch character.  (Hold on while I test this on my
trusty Toshiba, just to make sure... yup.  Should be 000C bytes.)

Note that this will work on *any* version of DOS from 2.0 on, not just for
3.2.

++Brandon
(P.S.  I also tested the program; it works, doesn't crash, changes switchar.)
(P.P.S.  Note that this program is only one-way:  you cannot change the
switchar *back* with it.  Change the "2D" to "2F" in the instructions above
to get a program that changes the switchar back to "/".  Or look for one of
the many PD programs (heck, I wrote one myself once) that takes an argument
to decide which switchar to use.)
-- 
Brandon S. Allbery, comp.sources.misc moderator and one admin of ncoast PA UN*X
uunet!hal.cwru.edu!ncoast!allbery  <PREFERRED!>	    ncoast!allbery@hal.cwru.edu
allbery@skybridge.sdi.cwru.edu	      <ALSO>		   allbery@uunet.uu.net
comp.sources.misc is moving off ncoast -- please do NOT send submissions direct
  (But the aliases are NOT on UUNET yet, use the aliases at backbone sites!)