[net.micro.ti] Help with SWITCHAR

holland@psuvax1.UUCP (Fred Hollander) (02/21/86)

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
and doing a set shows that PATH is empty and COMPSPEC is the only other
environment variable set.

I've tried setting the SHELL in the config.sys file and changing the PATH
to use '/' instead of '\' but, I've had no luck.
Does anybody know what the problem might be?

Thanks for your help,
Fred Hollander
Penn State

dlnash@ut-ngp.UUCP (Donald L. Nash) (02/22/86)

> 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
> and doing a set shows that PATH is empty and COMPSPEC is the only other
> environment variable set.
>
> I've tried setting the SHELL in the config.sys file and changing the PATH
> to use '/' instead of '\' but, I've had no luck.
> Does anybody know what the problem might be?
>
> Thanks for your help,
> Fred Hollander
> Penn State
>

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.  However, if you find using '/' very unsatisfactory,
then that is not much of a solution....

					Don Nash

UUCP:    ...!{ihnp4,allegra,seismo!ut-sally}!ut-ngp!dlnash
APRA:    dlnash@ngp.UTEXAS.EDU
BITNET:  cceu001@utadnx

greenber@phri.UUCP (Ross Greenberg) (02/23/86)

In article <2000@psuvax1.UUCP> holland@psuvax1.UUCP (Fred Hollander) 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
>and doing a set shows that PATH is empty and COMPSPEC is the only other
>environment variable set.
>
>I've tried setting the SHELL in the config.sys file and changing the PATH
>to use '/' instead of '\' but, I've had no luck.
>Does anybody know what the problem might be?
>

Oh well....I've hit the same problem, alas.  It stems from code trying
to execute a program called "COMMAND/C". If switchar=- is set, then the
program "COMMAND/" is attempted to be executed, eventually falling flat
on its face.

The only solution I've found is a choice between two uglies:
1)	Create a program that switches back and forth the switchar
	via DOS interrupt 0x21 with AH=0x37.
2)	Debug the code in question, do a search for the '/C' and
	replace it with a '-C'.

When will people learn to check the real environment before making
assumptions? <Sigh>....



-- 
------
ross m. greenberg
ihnp4!allegra!phri!sysdes!greenber

[phri rarely makes a guest-account user a spokesperson. Especially not me.]

nather@utastro.UUCP (Ed Nather) (02/23/86)

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

rde@ukc.ac.uk (R.D.Eager) (02/26/86)

>Oh well....I've hit the same problem, alas.  It stems from code trying
>to execute a program called "COMMAND/C". If switchar=- is set, then the
>program "COMMAND/" is attempted to be executed, eventually falling flat
>on its face.
>
>The only solution I've found is a choice between two uglies:
>1)	Create a program that switches back and forth the switchar
>	via DOS interrupt 0x21 with AH=0x37.
>2)	Debug the code in question, do a search for the '/C' and
>	replace it with a '-C'.
>
>When will people learn to check the real environment before making
>assumptions? <Sigh>....
>
Hardly fair. This is an undocumented feature (however much we believe it should
be there) which means the guy who wrote the program either:
  - didn't know about it
  - made a conscious decision not to use it in the interests of forwards
    compatibility.
-- 
           Bob Eager

           rde@ukc.UUCP
           rde@ukc
           ...!mcvax!ukc!rde

           Phone: +44 227 66822 ext 7589

glenn@anasazi.UUCP (02/26/86)

In article <2000@psuvax1.UUCP> holland@psuvax1.UUCP (Fred Hollander) 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

Most programs which allow you to run other programs from within usually use some
variation of the dos exec (dos call 41B)to spawn off another copy of 
command.com that would look like this (that is if you entered if from 
the dos prompt):
C> command edt /c

Now, most C compilers do not look for the SWITCHAR variable when building up
this text string and blithely put in /c.  Thus, the problem is that when you
redefine switchar, '/' becomes a path spec, not an argument character, and
thus screws up command.com.

The solution?  Rewrite your C compiler's exec call to check the SWITCHAR
variable when doing an exec.

Glenn Ehrlich
International Anasazi
Phoenix, AZ

greenber@phri.UUCP (Ross Greenberg) (03/02/86)

In article <840@eagle.ukc.ac.uk> rde@eagle.UUCP (R.D.Eager) writes:
>>[Quoting me attacking various software products and their incompatibilities
>>with variou settings of SWITCHAR]

>Hardly fair. This is an undocumented feature
> (however much we believe it should
>be there) which means the guy who wrote the program either:
>  - didn't know about it
>  - made a conscious decision not to use it in the interests of forwards
>    compatibility.

That would be the case, except that the program in question seems to
be a compiler. I would expect compiler designers to keep current on
even undocumented features -- part of the joys of working for a large
software house, I feel.

The code in question (fetch the switchar and replace it in the call
to LOAD AND EXECUTE) is only a few bytes long.  We've been talking about
the switch character on the net for about a year now, and *our* code
allows for it.  Documented or not, the compiler author(s) must have
received a number of calls about it, and therefore should have been
able to determine what the problem is/was and fixed it.

Just my opinion, of course!


-- 
------
ross m. greenberg
ihnp4!allegra!phri!sysdes!greenber

[phri rarely makes a guest-account user a spokesperson. Especially not me.]

haddock@ti-csl (03/03/86)

	>Hardly fair. This is an undocumented feature (however much
	>we believe it should be there) which means the guy who
	>wrote the program either:

	>-Bob Eager

Sorry Bob, but if you check TI's MS-DOS manuals you will find
that the SWITCHAR statement in the CONFIG.SYS file *IS* document.
TI made a mistake in doing this but I don't know what their (our)
official excuse is on this one. :-)

				-Rusty-

================================================================
*hardcopy*		*electr{onic, ic}*
Rusty Haddock		ARPA:  Haddock%TI-CSL@CSNET-RELAY.ARPA
POB 226015 M/S 238	CSNET: Haddock@TI-CSL
Texas Instruments Inc.	USENET: {ut-sally,convex!smu,texsun}!ti-csl!haddock
Dallas, Texas 75266	VOICE: (214) 995-0330

sgt@alice.UucP (Steve Tell) (03/09/86)

>Oh well....I've hit the same problem, alas.  It stems from code trying
>to execute a program called "COMMAND/C". If switchar=- is set, then the
>program "COMMAND/" is attempted to be executed, eventually falling flat
>on its face.
...
>When will people learn to check the real environment before making
>assumptions? <Sigh>....

It would help the situation very much if this call were
documented by IBM in their otherwise decent "Dos Technical Reference
Manual"
Instead of saying "Function 37h: Reserved for DOS"

How many other "Reserved for DOS" functions would be of
use to everyone?

Listening IBM, Microsoft, and other makers of software?

greenber@phri.UUCP (Ross Greenberg) (03/10/86)

In article <5095@alice.uUCp> sgt@alice.UucP (Steve Tell) writes:
[Taking about the Internal Switchar Function]:
>
>It would help the situation very much if this call were
>documented by IBM in their otherwise decent "Dos Technical Reference
>Manual"
>Instead of saying "Function 37h: Reserved for DOS"
>
>How many other "Reserved for DOS" functions would be of
>use to everyone?
>

Well...I suppose it's time to post the Undocumented Interrupt List
I've had for a while.

The pity is, the updates were lost when the last machine they were
on (timeinc) bit the dust.  So I only have the original.

It's pretty big, so I'm hesitant to post it unless there's enough
interest:  if enough people mail a "please send me a copy", I'll
post. Otherwise I'll UUCP mail it out to ya.


-- 
------
ross m. greenberg
ihnp4!allegra!phri!sysdes!greenber

[phri rarely makes a guest-account user a spokesperson. Especially not me.]

farren@well.UUCP (Mike Farren) (03/11/86)

In article <2279@phri.UUCP> greenber@phri.UUCP (Ross Greenberg) writes:
>
>Well...I suppose it's time to post the Undocumented Interrupt List
>I've had for a while.
>

   Well...if so, it's probably time for me to repeat my warning, given
so many times before, in so many places:

*** THERE'S A REASON THESE ROUTINES ARE UNDOCUMENTED ***

   Especially with PC-DOS (as opposed to MS-DOS), the routines which are
undocumented are so because: 1) They may not be around in the next
iteration of DOS, and therefore may guarantee incompatibility with later
versions.  2) They don't work correctly for general purposes.  A prime
example of this is the "indos" function, which supposedly told you when
it was safe to call DOS functions from interrupt handlers.  Problem is,
it doesn't ALWAYS work, and if a function like this EVER fails, you're 
in deep crud.

   I'm not saying that you should NEVER use undocumented routines, as
sometimes they can let you accomplish things impossible to do without
them.  You should always be aware of the pitfalls, though!

-- 
           Mike Farren
           uucp: {your favorite backbone site}!hplabs!well!farren
           Fido: Sci-Fido, Fidonode 125/84, (415)655-0667

caf@omen.UUCP (Chuck Forsberg WA7KGX) (03/13/86)

In article <2279@phri.UUCP> greenber@phri.UUCP (Ross Greenberg) writes:
>In article <5095@alice.uUCp> sgt@alice.UucP (Steve Tell) writes:
>[Taking about the Internal Switchar Function]:
>>
>>It would help the situation very much if this call were
>>documented by IBM in their otherwise decent "Dos Technical Reference
>>Manual"
>>Instead of saying "Function 37h: Reserved for DOS"
>>
>>How many other "Reserved for DOS" functions would be of
>>use to everyone?

Seems like the more recent versions of MS link have stopped looking at
the SWITCHAR function.  This may be a sign that SWITCHAR support is on its
way out.

   Chuck Forsberg WA7KGX  ...!tektronix!reed!omen!caf   CIS:70715,131
   Author of Professional-YAM communications Tools for PCDOS and Unix
 Omen Technology Inc     17505-V NW Sauvie Island Road Portland OR 97231
Voice: 503-621-3406 TeleGodzilla: 621-3746 300/1200 L.sys entry for omen:
omen Any ACU 1200 1-503-621-3746 se:--se: link ord: Giznoid in:--in: uucp
omen!/usr/spool/uucppublic/FILES lists all uucp-able files, updated hourly

holland@psuvax1.UUCP (03/16/86)

> In article <5095@alice.uUCp> sgt@alice.UucP (Steve Tell) writes:
> 
> Well...I suppose it's time to post the Undocumented Interrupt List
> I've had for a while.
> 

Sorry for the followup, but the mail keeps coming back...

If you don't post the list, would you please send me a copy?  

Thanks,
Fred Hollander
Penn State
holland@psuvax1.bitnet

hu@smu (03/16/86)

Please, just post it. We have been waiting too long to see 
something like this in public domain.

hu%smu.csnet

jer@peora.UUCP (J. Eric Roskos) (03/27/86)

> To those that sent me mail regarding the Interrupt List:
>
> I'm gonna post it shortly. There were over 75 requests!!!

There were more than that... as one who also wrote but couldn't get
through, and who is also responsible for mail ("postmaster") at one of
the paths to phri, I can tell you that there have been several dozen
messages addressed to phri!greenber that went through here, followed
a little later by messages going the other way from MAILER-DAEMON@phri...
so, unless you also posted something that provoked a lot of flames :-),
I'll bet there are over a hundred people who wrote.  (There must be
two phri's, or something.)

(I would have mailed this, but I've tried every path I could find to phri.)
-- 
E. Roskos

"It's Halley's comet!"

jdia@ur-tut.UUCP (03/29/86)

In article <2052@peora.UUCP> jer@peora.UUCP (J. Eric Roskos) writes:
>> To those that sent me mail regarding the Interrupt List:
>>
>> I'm gonna post it shortly. There were over 75 requests!!!
>
>There were more than that... as one who also wrote but couldn't get
>through, and who is also responsible for mail ("postmaster") at one of
>the paths to phri, I can tell you that there have been several dozen
>...

Has someone already posted this list sometime in the past few weeks?
If so, could they mail it to me?

Otherwise, if it hasn't been posted, why not quit talking about it and 
POST IT!!! PLEEEEEEAAAAAASSSSSE!!!

\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Wowbagger:

   ...seismo!rochester!ur-tu!jdia

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\