Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!watmath!clyde!rutgers!mit-eddie!bu-cs!bucsb.bu.edu!madd
From: madd@bucsb.bu.edu.UUCP
Newsgroups: comp.sys.ibm.pc
Subject: Re: switchar
Message-ID: <656@bucsb.bu.edu.UUCP>
Date: Wed, 10-Dec-86 12:01:48 EST
Article-I.D.: bucsb.656
Posted: Wed Dec 10 12:01:48 1986
Date-Received: Sun, 14-Dec-86 03:13:34 EST
References: <1402@uw-june> > <2690001@hplsla.HP.COM> <2234@homxb.UUCP>
Reply-To: madd@bucsb.bu.edu.UUCP (Jim "Jack" Frost)
Organization: ODO (Organization for the Disorganization of Organization)
Lines: 72
Summary: Not a good idea!
Mood: Fine.

In article <2234@homxb.UUCP> gritz@homxb.UUCP (R.SHARPLES) writes:
>You can also use the dos ansi.sys capability to redefine the
>character transmitted by the keyboard when you hit / or \.  This
>can be done by echoing the proper ESC sequence in autoexec.  Since
>this is just redefining the keyboard signal, it does not effect programs
>that utilitze the original sequence.  I know this works under MSDOS 3.1.
>See page G-10 of the MSDOS 3.1 manual.

Don't do this!  This works fine, provided you only use the DOS
COMMAND.COM.  If you use any program that skips around the standard
DOS functions, this won't work.  If you (*gasp*) use a program, such
as a wordprocessor, which DOESN'T skip around the DOS functions, it'll
go change all your characters on you, even if you didn't want them to.

For instance, let's say I use WordStar (which I think can be
influenced by ANSI.SYS, though I never tried -- the screen output is
slow enough to be done through DOS, versus writing to the screen
buffer and other neat things).  I start typing:

Ladies/gentlemen of the press:

Now, what gets put in the file would be

Ladies\gentlemen of the press:

which is not what I intended.  Worse, what if you program in a similar
editor:

#include 

main()
{ int i;

  fscanf("%d",i);
  printf("i = %d\n",i);
  i = i/2;
  printf("i = %d\n");
  printf("As a further example, what if you do this: yes/no\n");
}

What get stuffed in the file?  This:

#include 

main()
{ int i;

  fscanf("%d",i);
  printf("i = %d\n",i);
  i = i\2;              /* compile error right here */
  printf("i = %d\n");   /* run-time problem below   */
  printf("As a further example, what if you do this: yes\no\n");
}

The flipping of the / character would really cause problems here, some
of which might not be easy to spot.  The last printf() statement is a
tough one.  It would print:

As a further axample, what if you do this: yes
o

Which is obviously not what was intended.

In conclusion, this idea would work (some of the time) but can have
side-effects that are extremely annoying; I'd stay away from it.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   - Jim Frost * The Madd Hacker -
UUCP:  ..!harvard!bu-cs!bucsb!madd | ARPANET: madd@bucsb.bu.edu
CSNET: madd%bucsb@bu-cs            | BITNET:  cscc71c@bostonu
-------------------------------+---+------------------------------------
"Oh beer, oh beer." -- Me      |      [=(BEER) <- Bud the Beer (cheers!)