[comp.bugs.4bsd] calendar preprocesses its input a bit too much

mp@allegra.UUCP (02/09/87)

If you prefer that calendar not change lines like
	jan 28 1:30 1D451 pipelined design of a fast vax - Doug Clark from DEC
into
	jan 28 1:30 1D451 pipelined design of a fast 1 - Doug Clark from DEC
then try this:
RCS file: calendar.sh,v
diff  -r1.1 -r1.2
10c10
< 	(/lib/cpp calendar | egrep -f $tmp);;
---
> 	(/lib/cpp -Uvax -Uunix -Usun -Umc68000 -Umc68010 -Umc68020 calendar | egrep -f $tmp);;
21c21
< 			(/lib/cpp $y/calendar | egrep -f $tmp) 2>/dev/null  > /tmp/cal2$$
---
> 			(/lib/cpp -Uvax -Uunix -Usun -Umc68000 -Umc68010 -Umc68020 $y/calendar | egrep -f $tmp) 2>/dev/null  > /tmp/cal2$$

	Mark Plotnick
	allegra!mp

simon@its63b.UUCP (02/10/87)

In article <6458@allegra.UUCP> mp@allegra.UUCP (Mark Plotnick) writes:
>If you prefer that calendar not change lines like
>	jan 28 1:30 1D451 pipelined design of a fast vax - Doug Clark from DEC
>into
>	jan 28 1:30 1D451 pipelined design of a fast 1 - Doug Clark from DEC
>then try this:
>RCS file: calendar.sh,v
>diff  -r1.1 -r1.2
>< 	(/lib/cpp calendar | egrep -f $tmp);;
>---
>> 	(/lib/cpp -Uvax -Uunix -Usun -Umc68000 -Umc68010 -Umc68020 calendar | egrep -f $tmp);;
>	Mark Plotnick
>	allegra!mp

Mmmm, yes, well... Is this not just a little bit inflexible? How about something
gross and ugly (and in the true Un+x tradition :-}) like:
	(trueinum=`ls -i /bin/true | awk '{print $1}'`;
	 exclude=`ls -i /bin -inum $trueinum -print \
			| awk '{print $2}' \
			| xargs basename \
			| awk '{print "-U"$1}';
	 /lib/cpp $exclude calendar | egrep -f $tmp);;
	 .
	 .
	 .
(ie, exclude all those names which are linked to /bin/true in /bin - such as
/bin/{pdp11,vax,sel,sun,GEC,....}).
Unfortunately, this only gets the machine name, not the processor name, so
things like mc680[012]0 need to be wiped out some other way. Its a pity that
BSD doesn't have uname(1) :-)

In fact, it should probably be *really* done with double-nested "eval"
statements, with the suitable {sex,quad,bi}ruple-backslash quoting stuff
instead of cheating and using all those nasty temporary variables!

:-) :-) :-)

Simon

-----
Simon Brown
Dept. of Computer Science, University of Edinburgh, Scotland, UK.
UUCP: ...!mcvax!ukc!{cstvax,its63b}!simon
JANET: simon@uk.ac.ed.{its63b,cstvax}