Path: seismo!harvard!husc6!talcott!panda!sources-request From: sources-request@panda.UUCP Newsgroups: mod.sources Subject: unpar compatability with Sys V (patch) Message-ID: <1854@panda.UUCP> Date: 12 May 86 11:28:35 GMT Sender: jpn@panda.UUCP Reply-To: jimb@amdcad.UUCP (Jim Budler) Organization: AMD, Sunnyvale, California Lines: 72 Approved: jpn@panda.UUCP Mod.sources: Volume 4, Issue 115 Submitted by: talcott!ima!amdcad!jimb (Jim Budler) > These programs pack and unpack files in the portable archive format. > This format is compatible with the ar command on 4BSD and System V > release 2. These programs are available for use by anyone without > fee or license. After testing the program with a SysV arfile produced on a UTS IBM mainframe I found that the Sys V 'ar' appends a '/' to the end of the filename. This caused both BSD 'ar' and 'unpar' to coredump. SysV 'ar' can read a BSD 'ar' or 'par' created arfile. This patch strips the trailing '/'. It uses rindex() so on other systems (SysV) you may need to replace the define and call with 'strrchr()'. ------------------------------------------ *** /tmp/,RCSt1001661 Wed May 7 23:33:45 1986 --- unpar.c Wed May 7 23:29:52 1986 *************** *** 1,7 /* unpack portable archives - written by Bill Welch */ #include #include ! char buf[512]; main() { --- 1,7 ----- /* unpack portable archives - written by Bill Welch */ #include #include ! extern char * rindex(); /* use strrchr() if on Sys V */ char buf[512]; main() { *************** *** 5,11 char buf[512]; main() { ! char name[80]; struct utimbuf { time_t actime; time_t modtime; --- 5,11 ----- char buf[512]; main() { ! char name[80], *p; struct utimbuf { time_t actime; time_t modtime; *************** *** 20,25 printf("%s\n", buf); sscanf(buf, "%s %ld %d %d %o %ld", name,&mtime,&uid,&gid, &mode, &len); printf("%s %ld\n", name, len); fp = fopen(name, "w"); for (i=0; i