Path: utzoo!utstat!news-server.csri.toronto.edu!cs.utexas.edu!uunet!drivax!davison From: davison@dri.com (Wayne Davison) Newsgroups: news.software.nntp Subject: Re: Help needed with patching trn Message-ID: <138QN61@dri.com> Date: 4 Oct 90 17:22:58 GMT References: <1990Oct2.235400.17191@csc.canberra.edu.au> Sender: news@dri.com (news admin) Organization: Digital Research, Monterey CA Lines: 187 Katarina Christenson (kec@csc.canberra.edu.au) wrote: > I got a copy of trn from urth.acsu.buffalo.edu. It came with a set of > patches in a file called trn.patch1. [...] The patch file looks like this > Index: patchlevel > Prereq: v1.0 > @@ -1,1 +1,1 @@ > -Trn v1.0 > +Trn v1.0.1 The problem is that the folks at "urth" have made an incomplete version of patch1 available for download. The official patch was a shar file of both "unipatch.c" and "patch1". It was preceded by some important text for the folks who were already running the initial release of trn. I will include the missing text and the patch translator (unipatch.c) to get you started, but someone needs to tell "urth" that the patch file needs to be replaced. I'll send mail to the postmaster there to try to get in touch with them. \ /| / /|\/ /| /(_) (_)/ |/ /\|/ / |/ \ (W A Y N e) ----8<------8<------8<------8<-----cut here----->8------>8------>8------>8---- This is official patch #1 for trn v1.0. It is a shar archive of the files unipatch.c and patch1. To extract it from trn type "e DIR" where DIR is the directory of your trn source, or extract it will a de-shar'ing tool. To apply the patch, compile the program unipatch.c with the command "cc -o unipatch unipatch.c" and patch the source with the command "unipatch 'unipatch.c' /* A filter to turn a unidiff into a degenerate context diff (no '!'s) for patch. Author: davison@dri.com (uunet!drivax!davison). */ #include #define ERR(a) {fputs(a,stderr);exit(1);} struct Ln { struct Ln *lk; char t; char s[1]; } r,*h,*ln; char *malloc(); main() { char bf[2048],*cp,ch; long os,ol,ns,nl,ne,lncnt=0; for(;;){ for(;;){ if(!fgets(bf,sizeof bf,stdin)) exit(0); lncnt++; if(!strncmp(bf,"@@ -",4)) break; fputs(bf,stdout); } if(sscanf(bf+4,"%ld,%ld +%ld,%ld %c",&os,&ol,&ns,&nl,&ch)!=5||ch!='@') goto bad; r.lk=0, h= &r, ne=ns+nl-1; printf("***************\n*** %ld,%ld ****\n",os,os+ol-(os>0)); while(ol||nl){ if(!fgets(bf,sizeof bf,stdin)){ if(nl>2) ERR("Unexpected end of file.\n"); strcpy(bf," \n"); } lncnt++; if(*bf=='\t'||*bf=='\n') ch=' ', cp=bf; else ch= *bf, cp=bf+1; switch(ch){ case'-':if(!ol--) goto bad; printf("- %s",cp); break; case'=':ch=' '; case' ':if(!ol--) goto bad; printf(" %s",cp); case'+':if(!nl--) goto bad; ln = (struct Ln*)malloc(sizeof(*ln)+strlen(cp)); if(!ln) ERR("Out of memory!\n"); ln->lk=0, ln->t=ch, strcpy(ln->s,cp); h->lk=ln, h=ln; break; default: bad: fprintf(stderr,"Malformed unidiff at line %ld: ",lncnt); ERR(bf); } } printf("--- %ld,%ld ----\n",ns,ne); for(ln=r.lk;ln;ln=h){ printf("%c %s",ln->t,ln->s); h=ln->lk; free(ln); } } } SHAR_EOF fi exit 0 # End of shell archive ----8<------8<------8<------8<-----the end------>8------>8------>8------>8----