Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site umcp-cs.UUCP Path: utzoo!linus!decvax!harpo!seismo!rlgvax!cvl!umcp-cs!chris From: chris@umcp-cs.UUCP Newsgroups: net.bugs.uucp,net.lang.c Subject: Re: bug-fixes in uucp Message-ID: <3779@umcp-cs.UUCP> Date: Mon, 14-Nov-83 10:34:18 EST Article-I.D.: umcp-cs.3779 Posted: Mon Nov 14 10:34:18 1983 Date-Received: Tue, 15-Nov-83 06:17:59 EST References: <134@ttds.UUCP> <2708@utcsrgv.UUCP> Organization: Univ. of Maryland, Computer Science Dept. Lines: 15 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@umcp-cs ARPA: chris.umcp-cs@CSNet-Relay