bug-fixes in uucp

chris at umcp-cs.UUCP chris at umcp-cs.UUCP
Tue Nov 15 01:34:18 AEST 1983

No, it's not a stdio bug.  The trouble is that uucp passes the
address of nextch to read.  read expects a pointer to char; &nextch
is a pointer to int.  Now, it just so happens that on PDP-11s and
Vaxen, the low byte of the int is where the "char" piece is.  On
a 68000, the low byte of the int is somewhere else.  The read
actually fills in the 3rd of 4 bytes.

Stdio does nothing so ugly; all it ever passes to read is pointers
to char.  It then extracts the chars one at a time and converts
them to ints using the (almost portable) expression "*buf++ & 0377".
This works on all machines with eight bit chars.  (Look out Univac!)
In-Real-Life: Chris Torek, Univ of MD Comp Sci
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris.umcp-cs at CSNet-Relay

More information about the Comp.lang.c mailing list