🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.pc
Article #5752

Re: Help with SWITCHAR

#5752
From: Ed Nather
Date: Sun, 23 Feb 1986 18:09
52 lines
2597 bytes
In article <2987@ut-ngp.UUCP>, dlnash@ut-ngp.UUCP (Donald L. Nash) writes:
> 
> > I am using a 'more' program that was posted some time ago.  It allows you
> > to enter the editor by typing 'e'.  It works fine but, when I add the line:
> > 	switchar=-
> > to my config.sys file, trying to enter the editor from more causes the error:
> > 	Specified COMMAND search directory bad
> > Fred Hollander
> 
> The problem is probably that the program does not check to see what the
> what the SWITCHAR is before trying to run the editor.  If it runs the
> editor by calling up command.com like this:
> 
> 	command /c editor
> 
> then changing SWITCHAR will blow its mind.  I've had the same thing
> happen to me when using Kermit.  I had changed the SWITCHAR to '-' and
> then tried to get a directory listing from Kermit.  I had the same
> results, since Kermit would try to do the following:
> 
> 	command /c dir
> 
> The only solution is not to change the SWITCHAR, since most programs
> don't check for it. 

There is another solution, if you know how to use "debug."  Search for the
ascii string "command" and note (via -d) if it is the above string.  If so,
change the "/" to correspond to your switchar setting.  I did that with
Kermit (before the newer version, which allows either "/" or "\") and it
worked fine -- so long as I didn't change "switchar" back again.

The way to avoid this problem when writing code is to check the switchar
setting and adapt accordingly.  Here's the subroutine I use (I have versions
for DeSmet, CI-C86 and Microsoft C, depending on which I am using; this
one works with Microsoft C):

/* setps - set pathname separator to conform to MS-DOS switchar value */

setps()
{
union REGS r;

r.x.ax = 0x3700;                           /* dos int 37 returns switchar */
intdos(&r, &r);
return(((r.x.dx & 0xFF) == '/') ? '\\' : '/');   /* return path separator */
}

-- 
Ed Nather
Astronomy Dept, U of Texas @ Austin
{allegra,ihnp4}!{noao,ut-sally}!utastro!nather
nather@astro.UTEXAS.EDU
Technical Details
Message-ID: <411@utastro.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!ut-sally!utastro!nather
References: <2000@psuvax1.UUCP> <2987@ut-ngp.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!ut-sally!utastro!nather
From: nather@utastro.UUCP (Ed Nather)
Newsgroups: net.micro.pc,net.micro.ti
Subject: Re: Help with SWITCHAR
Message-ID: <411@utastro.UUCP>
Date: Sun, 23-Feb-86 13:09:45 EST
Article-I.D.: utastro.411
Posted: Sun Feb 23 13:09:45 1986
Date-Received: Wed, 26-Feb-86 04:59:41 EST
References: <2000@psuvax1.UUCP> <2987@ut-ngp.UUCP>
Distribution: net
Organization: U. Texas, Astronomy, Austin, TX
Lines: 52