[comp.binaries.ibm.pc] using "/" in pathnames

sullivan@marge.math.binghamton.edu (fred sullivan) (06/02/88)

Some time ago someone complained about using "\" in MSDOS pathnames.
Here is the fix.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	switchar.c
#	switchar.doc
#	switchar.uue
# This archive created: Sun May 29 16:41:49 1988
export PATH; PATH=/bin:$PATH
if test -f 'switchar.c'
then
	echo shar: will not over-write existing file "'switchar.c'"
else
cat << \SHAR_EOF > 'switchar.c'
#include <stdio.h>
#include <dos.h>

#define dos_function 0x37
#define read_switch_character 0
#define write_switch_character 1

main(int argc,char *argv[])
{
	union REGS in_regs,out_regs;

	in_regs.h.ah = dos_function;
	if (argc == 2)
	{
		in_regs.h.al = write_switch_character;
		in_regs.h.dl = *argv[1];
	}
	else
		in_regs.h.al = read_switch_character;
	intdos(&in_regs,&out_regs);
	fputs("switch character: ",stderr);
	fputc(out_regs.h.dl,stderr);
	fputc('\n',stderr);
}
	
SHAR_EOF
fi # end of overwriting check
if test -f 'switchar.doc'
then
	echo shar: will not over-write existing file "'switchar.doc'"
else
cat << \SHAR_EOF > 'switchar.doc'
There is an undocumented (by IBM and Microsoft) function in MSDOS,
which allows the use of "/" in pathnames rather than "\".  MSDOS
maintains a "switch character" which is used to introduce options
on some, but not all MSDOS commands.  The default is "/".  If the
switch character is reset to something else, say "-", then "/" may
be used in pathnames.  Those commands which use the switch character
will then recognize options introduced with the new switch character
(e.g. DIR -W).

The switch character is set as follows:  (Thanks to Bob Jack, et. al.
and their interrupt list for the following information)

To find the current setting of the switch character, do an INT 21
with AH = 37H and AL = 0.  The switch character is returned in DL.

To set the switch character, do an INT 21 with AH = 37H, AL = 1, and
DL = new switch character.  The new switch character is returned in DL.

SWITCHAR.C is a Turbo C program which will set the switch character to
the first character of the first argument, if an argument is specified.
Otherwise, it displays the current setting of the switch character.
This program is not portable since it uses the Turbo C interface to MSDOS,
but it can't be too hard to port to other C compilers, since it's fewer
than 25 lines long.

SWITCHAR.COM is a compilation of switchar.c.
SHAR_EOF
fi # end of overwriting check
if test -f 'switchar.uue'
then
	echo shar: will not over-write existing file "'switchar.uue'"
else
cat << \SHAR_EOF > 'switchar.uue'
begin 644 switchar.com
M^XS*+HD6@0*T,,TABRX"`(L>+`".VJ.M#8P&JPV)'J<-B2[##<<&L0W__^@%<
M`<0^I0V+QXO8N?]_)H$].#=U&2:+50*`^CUU$(#FW_\&L0V`_EEU!/\&L0WR]
MKN-G0R8X!776@,V`]]F)#J4-N0$`T^.#PPB!X_C_B1ZI#0[_%K8/C-HKZHL^G
MM`^!_P`!<P>_``&)/K0/@<?\#W(H`SY*#W(BL033[T<[[W(9@SZT#P!T!X,^O
M2@\`=0Z_`!`[[W<'B_WK`^FD`(O?`]J)'KL-B1Z_#:&K#2O8CL"T2E?-(5_3.
MYX[2B^?HHP?HBP@SP"Z.!H$"O[P/N?P/*\_SJO\6N@__-J,-_S:A#?\VGPWH]
M<P!0Z&$!+HX>@0+H,P`._Q:X#XOLM$R*1@+-(;D.`)"Z;PWK/QZX`#7-(8D>H
MFPV,!IT-N``EC,J.VKHJ`LTA'\,>N``EQ1:;#<TA'\/'!K$-``#+P[1`NP(`B
MS2'#N1X`D+I]#2Z.'H$"Z.G_N`,`4.B3_P``58OL@^P@QD;A-X-^!`)U$<9&P
MX`&+7@:+7P**!XA&YNL$QD;@`(U&\%"-1N!0Z$@#65FX`@Y0N,8-4.A8`5E9*
MN`(.4(I&]K0`4.BY!5E9N`(.4+@*`%#HK`5968OE7<-5B^R#/MH-('4%N`$`E
MZQ.+1@2+'MH-T>.)A[P/_P;:#3/`7<-5B^R+1@2+U('J``$[PG,%H[4-ZPG'Y
M!J\-"`"X__]=PU6+[(M&!(M6!@,&M0V#T@"+R('!``&#T@`+TG4*.\QS!H<&V
MM0WK"<<&KPT(`+C__UW#58OL_W8$Z*7_65W#58OLBT8$F5)0Z+;_B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=@CH@0"#Q`:)AGS_.X9Z_W0=@[Y\_P!S![C__^MBZP^+1@PKQP.&@
M?/\KAGK_ZU&-MG[_Z8#_C89^_XO6*]")EGK_"])V-_^V>O^-AG[_4/]V".@Q0
M`(/$!HF&?/\[AGK_=!N#OGS_`','N/__ZQ+K#8M&#`.&?/\KAGK_ZP.+1@R+Q
MY5U?7L-5B^R+7@31X_>'(@\`"'00N`(`4#/`4%#_=@3HYOF+Y;1`BUX$BTX(^
MBU8&S2%R#U"+7@31XX&/(@\`$%CK!%#H<_E=PU97OP(`ON(-ZQ#W1`(#`'0%J
M5NA_]EE/@\80"_]U[%]>PP````````````````````````!4=7)B;RU#("T@"
M0V]P>7)I9VAT("AC*2`Q.3@W($)O<FQA;F0@26YT;"X`1&EV:61E(&5R<F]RB
M#0I!8FYO<FUA;"!P<F]G<F%M('1E<FUI;F%T:6]N#0H`````````````````8
M``````````````#\#_P/_`\`````````````````<W=I=&-H(&-H87)A8W1E-
M<CH@`````'0#=`-T`P``"0(`````````````X@T```H"`0```````````/(-S
M```"`@(````````````"#@``0P(#````````````$@X``$("!```````````%
M`"(.`````/\````````````R#@````#_````````````0@X`````_P``````1
M`````%(.`````/\```````````!B#@````#_````````````<@X`````_P``1
M`````````((.`````/\```````````"2#@````#_````````````H@X`````B
M_P```````````+(.`````/\```````````#"#@````#_````````````T@X`1
M````_P```````````.(.`````/\```````````#R#@````#_````````````X
M`@\`````_P```````````!(/`2`"(`(@!*`"H/______________________5
M_________________P``````$P("!`4&"`@(%!4%$_\6!1$"____________B
M_____P4%_____________________P___P+_#_____\3__\"`@4/`O___Q/_-
E__________________\3_P```*@/J`\-````````$%L"6P)B`@)B+
``
end
size    3772
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0
Fred Sullivan
Department of Mathematical Sciences
State University of New York at Binghamton
Binghamton, New York  13903
Email: sullivan@marge.math.binghamton.edu

--
Dick Flanagan, vacation moderator of comp.binaries.ibm.pc
{backbones}!ucbvax!ucscc!slvblc!dick  or  slvblc!dick@ucscc.ucsc.edu