delorie.com/archives/browse.cgi   search  
Mail Archives: opendos/2002/11/25/16:22:02

Message-ID: <000001c294c2$5051ce60$c03dfea9@atlantis>
From: "Matthias Paul" <Matthias DOT Paul AT post DOT rwth-aachen DOT de>
To: <opendos AT delorie DOT com>
References: <200211221447 DOT gAMEl9aC005469 AT eos DOT arc DOT nasa DOT gov>
Subject: Re: switches?
Date: Mon, 25 Nov 2002 21:30:11 +0100
Organization: Aachen University of Technology (RWTH), Germany
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id gAPKaZw07983
Reply-To: opendos AT delorie DOT com

On 2002-11-22, Jim Stevenson asked:

> Do any of the new DOSs allow changing the switch
> from \ to /?

I'm not sure what's your problem. Do you want to change
the SwitChar or the PathChar?

On API level, DOS always supported both, '\' and '/'
as path separators or so called PathChars. It is only
a limitation of the command processor or other calling
applications to only accept '\' in most circumstances.
Of course, the obvious reason, why they reject '/' in
most situations is that '/' is the default SwitChar
under DOS, and it would have caused much overhead
trying to distinguish between them all the time.
If you were writing your own programs, feel free
to use '\' or '/' in the paths, both will work.
No change needed.

Now, if your question is about the SwitChar and how to
change it from the default '/' to other values such as
the '-', which is widely used in the Unix environment,
the answer is easy as well.
MS-DOS/PC DOS supported changing the SwitChar only in
their 2.xx issues, but DR DOS supported this ever since
DR DOS 3.41 (maybe even earlier). Just call INT 21h/AX=3701h
with DL containing the desired SwitChar ('/' = 2Fh, '-' = 2Dh).
Any other character will work as well, but I think it would
be unwise to use other values than these two except for
in most obscure situations. INT 21h/AX=3700h can be used
to retrieve the current setting. This function is still
supported under any DOS today, but in the MS-DOS/PC DOS
families it will always return 2Fh no matter what you tried
to set beforehand. Under DR DOS it will return the correct
value. Since DR-DOS 7.02+ there is even a new CONFIG.SYS
directive named SWITCHAR=/ to set a new value - under older
issues you had to use an external utility to directly call
the API function.
The problem with changing the SwitChar is, that this function
is obsolete according to Microsoft, so most applications today
no longer query INT 21h/AX=3700h to retrieve the current setting
(as they should). Instead they always assume '/' to be the
SwitChar. Since under DOS command line parsing is a function of
each individual application and not a function of the system,
even if you switch the SwitChar to something else, such applications
would still expect you to use '/', rendering the API useless
in many sitations. Fortunately, most DR-DOS applications do
honore and take advantage of a changed SwitChar, some will
even reflect this in their help screens.

Hope it helps,

 Matthias

-- 
<mailto:Matthias DOT Paul AT post DOT rwth-aachen DOT de>; <mailto:mpaul AT drdos DOT org>
http://www.uni-bonn.de/~uzs180/mpdokeng.html; http://mpaul.drdos.org

"Programs are poems for computers."


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019