Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (04/11/90)
Submitted-by: acs@pccuts.pcc.amdahl.com (Tony Sumrall) Posting-number: Volume 90, Issue 134 Archive-name: unix/rcs/upatch01/part01 [ The original sources were posted in 1989. Check a comp.sources.amiga archive site if you need them. ...tad ] This shell archive contains patches for the diff program associated with RCS for the Amiga (Fish disk 281, comp.sources.amiga postings v89i216 through v89i229) and address 2 problems: 1) an attempt to compare a file with a non-existent file would elicit an error message with null text 2) if one or more of the arguments to diff was a device or an assigned name, diff would use a / to separate filename components instead of using a :. To apply these patches: * remove all lines above the first line beginning with #, * run through /bin/sh or a suitable unshar program, * copy the 2 resulting files to a directory containing the source for diff, * using patch from Fish disk # 296 or patch version 2.0 from Fish disk # 129, say: patch < amiga1.c.diffs and then patch < diff.c.diffs * compile the new diff following the instructions which were packaged with the original version. I've been using diff with these patches applied for quite some time with no ill effects. -- Tony Sumrall responsible for VT100 2.9A (and 2.9 and 2.8a and 2.8 and...) acs@pccuts.pcc.amdahl.com <=> amdahl!pccuts!acs [ Opinions expressed herein are the author's and should not be construed to reflect the views of Amdahl Corp. ] #!/bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 1)." # Contents: amiga1.c.diffs diff.c.diffs # Wrapped by tadguy@xanth on Tue Apr 10 17:54:34 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'amiga1.c.diffs' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'amiga1.c.diffs'\" else echo shar: Extracting \"'amiga1.c.diffs'\" \(592 characters\) sed "s/^X//" >'amiga1.c.diffs' <<'END_OF_FILE' XIndex: amiga1.c X*** Oamiga1.c Thu Mar 22 09:24:29 1990 X--- amiga1.c Thu Mar 8 21:52:50 1990 X*************** X*** 47,54 **** X long l; X struct FileInfoBlock *fp,*malloc(); X X! if ((l=Lock(name, ACCESS_READ)) == 0) X return(-1); X fp = malloc(sizeof(struct FileInfoBlock)); X Examine(l, fp); X buf->st_attr = fp->fib_Protection; X--- 47,56 ---- X long l; X struct FileInfoBlock *fp,*malloc(); X X! if ((l=Lock(name, ACCESS_READ)) == 0) { X! errno = ENOENT; X return(-1); X+ } X fp = malloc(sizeof(struct FileInfoBlock)); X Examine(l, fp); X buf->st_attr = fp->fib_Protection; END_OF_FILE if test 592 -ne `wc -c <'amiga1.c.diffs'`; then echo shar: \"'amiga1.c.diffs'\" unpacked with wrong size! fi # end of 'amiga1.c.diffs' fi if test -f 'diff.c.diffs' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'diff.c.diffs'\" else echo shar: Extracting \"'diff.c.diffs'\" \(3571 characters\) sed "s/^X//" >'diff.c.diffs' <<'END_OF_FILE' XIndex: diff.c X*** Odiff.c Thu Mar 22 09:24:29 1990 X--- diff.c Sun Mar 11 12:01:14 1990 X*************** X*** 378,386 **** X if (name1 == 0) X name1 = name0; X X! inf[0].name = dir0 == 0 ? name0 : concat (dir0, "/", name0); X! inf[1].name = dir1 == 0 ? name1 : concat (dir1, "/", name1); X X /* Stat the files. Record whether they are directories. X Record in stat_result whether stat fails. */ X X--- 378,413 ---- X if (name1 == 0) X name1 = name0; X X! if(dir0 == 0) X! inf[0].name = name0; X! else X! { X! if(strrchr(dir0, '/')) X! inf[0].name = concat(dir0, "/", name0); X! else X! { X! if(*(dir0 + strlen(dir0) - 1) == ':') X! inf[0].name = concat(dir0, "", name0); X! else X! inf[0].name = concat(dir0, "/", name0); X! } X! } X X+ if(dir1 == 0) X+ inf[1].name = name1; X+ else X+ { X+ if(strrchr(dir1, '/')) X+ inf[1].name = concat(dir1, "/", name1); X+ else X+ { X+ if(*(dir1 + strlen(dir1) - 1) == ':') X+ inf[1].name = concat(dir1, "", name1); X+ else X+ inf[1].name = concat(dir1, "/", name1); X+ } X+ } X+ X /* Stat the files. Record whether they are directories. X Record in stat_result whether stat fails. */ X X*************** X*** 402,413 **** X perror_with_name (filename); X errorcount = 1; X } X! else X #ifdef AMIGA X inf[i].dir_p = (inf[i].stat.st_type > 0); X #else X inf[i].dir_p = (S_IFDIR == (inf[i].stat.st_mode & S_IFMT)); X #endif X } X } X X--- 429,441 ---- X perror_with_name (filename); X errorcount = 1; X } X! else { X #ifdef AMIGA X inf[i].dir_p = (inf[i].stat.st_type > 0); X #else X inf[i].dir_p = (S_IFDIR == (inf[i].stat.st_mode & S_IFMT)); X #endif X+ } X } X } X X*************** X*** 427,432 **** X--- 455,461 ---- X X if (name0 == 0) X inf[0].dir_p = inf[1].dir_p; X+ X if (name1 == 0) X inf[1].dir_p = inf[0].dir_p; X X*************** X*** 495,504 **** X int dir_arg = (inf[0].dir_p ? 0 : 1); X int fnm_arg = (inf[0].dir_p ? 1 : 0); X char *p = strrchr(inf[fnm_arg].name, '/'); X! char *filename = concat (inf[dir_arg].name, "/", X! (p ? p+1 : inf[fnm_arg].name)); X X #ifdef AMIGA X inf[dir_arg].dir_p = (getfa(filename) == 1); X if (!inf[dir_arg].dir_p) X { X--- 524,549 ---- X int dir_arg = (inf[0].dir_p ? 0 : 1); X int fnm_arg = (inf[0].dir_p ? 1 : 0); X char *p = strrchr(inf[fnm_arg].name, '/'); X! char *filename; X X #ifdef AMIGA X+ char *tp = inf[dir_arg].name; X+ int term = (*(tp + strlen(tp) - 1) == ':' ? 1 : 0); X+ X+ if(!p) { X+ /* inf[dir_arg].name ends with a ':', a '/' or neither. If it X+ ** ends with ':' then simply concat otherwise separate with a '/'. X+ ** Note that we also have to find out if there is a separator in the X+ ** filename, too so we know where to copy FROM when we create the new X+ ** filename. X+ */ X+ char *p1 = strrchr(inf[fnm_arg].name, ':'); X+ X+ filename = concat(inf[dir_arg].name, term ? "" : "/", X+ p1 ? p1+1 : inf[fnm_arg].name); X+ } else X+ filename = concat (inf[dir_arg].name, term ? "" : "/", p+1); X+ X inf[dir_arg].dir_p = (getfa(filename) == 1); X if (!inf[dir_arg].dir_p) X { X*************** X*** 521,526 **** X--- 566,573 ---- X val = 2; X } X #else X+ filename = concat (inf[dir_arg].name, "/", X+ (p ? p+1 : inf[fnm_arg].name)); X inf[dir_arg].desc = open (filename, O_RDONLY, 0); X X if (0 > inf[dir_arg].desc) END_OF_FILE if test 3571 -ne `wc -c <'diff.c.diffs'`; then echo shar: \"'diff.c.diffs'\" unpacked with wrong size! fi # end of 'diff.c.diffs' fi echo shar: End of archive 1 \(of 1\). cp /dev/null ark1isdone MISSING="" for I in 1 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have the archive. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mail submissions (sources or binaries) to <amiga@cs.odu.edu>. Mail comments to the moderator at <amiga-request@cs.odu.edu>. Post requests for sources, and general discussion to comp.sys.amiga.