Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ll-xn!cit-vax!elroy!smeagol!earle From: earle@smeagol.UUCP (Greg Earle) Newsgroups: net.bugs.4bsd,net.unix-wizards Subject: Re: cpio(1) under Sun 3.0; or, does System V write filenames backwards? Message-ID: <761@smeagol.UUCP> Date: Thu, 4-Sep-86 17:18:18 EDT Article-I.D.: smeagol.761 Posted: Thu Sep 4 17:18:18 1986 Date-Received: Fri, 5-Sep-86 19:42:59 EDT References: <760@smeagol.UUCP> Organization: JPL, Pasadena CA Lines: 78 Keywords: cpio byteswap header Summary: errata ... Xref: mnetor net.bugs.4bsd:912 net.unix-wizards:7781 In article <760@smeagol.UUCP>, earle@smeagol.UUCP I wrote: > I have implemented a `fix', based on this source version: > >#ifndef lint > >static char sccsid[] = "@(#)cpio.c 1.1 86/02/03 SMI"; /* from S5R2 1.17 */ > >#endif > > -------------- > diff -l -cb /usr/src/sun/usr.bin/cpio.c /tmp/cpio.c > *** /usr/src/sun/usr.bin/cpio.c Mon Feb 3 23:58:42 1986 > --- /tmp/cpio.c Wed Sep 3 20:10:23 1986 > *************** > *** 602,609 > } > if(Cflag) > readhdr(Hdr.h_name, Hdr.h_namesize); > ! else > ! bread(Hdr.h_name, Hdr.h_namesize); > if(EQ(Hdr.h_name, "TRAILER!!!")) > return 0; > ftype = Hdr.h_mode & Filetype; > > --- 602,611 ----- > } > if(Cflag) > readhdr(Hdr.h_name, Hdr.h_namesize); > ! else { > ! bread(Name, Hdr.h_namesize); > ! swab(Name, Hdr.h_name, (Hdr.h_namesize + 1) & ~001); > ! } > if(EQ(Hdr.h_name, "TRAILER!!!")) > return 0; > ftype = Hdr.h_mode & Filetype; > -------------- This should probably read: diff -l -cb /usr/src/sun/usr.bin/cpio.c /tmp/cpio.c *** /usr/src/sun/usr.bin/cpio.c Mon Feb 3 23:58:42 1986 --- /tmp/cpio.c Wed Sep 3 20:10:23 1986 *************** *** 602,609 } if(Cflag) readhdr(Hdr.h_name, Hdr.h_namesize); ! else ! bread(Hdr.h_name, Hdr.h_namesize); if(EQ(Hdr.h_name, "TRAILER!!!")) return 0; ftype = Hdr.h_mode & Filetype; --- 602,612 ----- } if(Cflag) readhdr(Hdr.h_name, Hdr.h_namesize); ! else { ! bread(Name, Hdr.h_namesize); ! if (Swap) ! swap(Hdr.h_name, (Hdr.h_namesize + 1) & ~001); ! } if(EQ(Hdr.h_name, "TRAILER!!!")) return 0; ftype = Hdr.h_mode & Filetype; ---------------- since you don't want to swap unless you are converting from a machine that needs the data bytes swapped (`-s' option). Further question: There are two undocumented options, `-S' and `-b', that are supposed to be for "swap half words" and "swap both words". I'm not sure under what circumstance these switches would be used (swap halfwords only when 1/2 word != byte? Swap both when in `pass' mode?). Any explanation? -- Greg Earle UUCP: sdcrdcf!smeagol!earle; attmail!earle JPL ARPA: elroy!smeagol!earle@csvax.caltech.edu AT&T: +1 818 354 0876 Here I am in the POSTERIOR OLFACTORY LOBULE but I don't see CARL SAGAN anywhere!!