[comp.mail.mush] CTRL macro

wed@crdos1.crd.ge.COM (10/26/89)

  The original definition of CTRL does not work in ANSI compilers,
because parameters are not substituted in strings and character
constants. I made the following redefinition:

        #define CTRL(c) (#c[0] & 037)

  What should really be done is to change all the calls to use a
character argument (ie. CNTL('x')), but this is quick and dirty. Does
not generate the best code, though.

schaefer@ogccse.ogc.edu (Barton E. Schaefer) (10/27/89)

In article <546F43626C@crdos1> davidsen@crdos1.crd.ge.com writes:
} 
}   The original definition of CTRL does not work in ANSI compilers,

Are you actually compiling mush on an ANSI compiler?  Not to make excuses
for the way Dan wrote that macro, but it seems there are a *lot* of other
equally important things that would need to change to make mush pANS-C
conformant.

}   What should really be done is to change all the calls to use a
} character argument (ie. CNTL('x'))

Here's an UNofficial Patch. :-)

#! /bin/sh -e
for f in `grep -l CTRL *.c`
do
    /bin/mv $f $f.orig
    echo "%s/CTRL(\([^)]*\))/CTRL('\1')/g|w $f|q" | ex - $f.orig
done
for f in `grep -l "define CTRL" *.h`
do
    /bin/mv $f $f.orig
    echo "/define CTRL/s/'\(.\)'/(\1)/|w $f|q" | ex - $f.orig
done
exit 0

You can even run that one over your 4.x BSD sources. ;->
-- 
Bart Schaefer      "A Yellowbeard is never so dangerous as when he's dead."
                                              -- Graham Chapman, 1941-1989
CSNET / Internet                schaefer@cse.ogc.edu
UUCP                            ...{sequent,tektronix,verdix}!ogccse!schaefer