[net.sources.bugs] patch bug #3

lwall@sdcrdcf.UUCP (Larry Wall) (12/06/84)

System: patch version 1.2
Bug #: 3
Priority: LOW
Subject: patch doesn't kow about SCCS subdirectories
Index: patch.c
Prereq: 1.2.1.3
From: ut-sally!jsq (John Quarterman)

Description:
	Patch knows about sccs files of the form "s.filename", but not
	"SCCS/s.filename".

Fix:	From rn, say "| patch -d DIR", where DIR is your patch source
	directory.  Outside of rn, say "cd DIR; patch <thisarticle".

***************
*** 1,6
  /* patch - a program to apply diffs to original files
   *
!  * $Header: patch.c,v 1.2.1.3 84/12/05 11:18:43 lwall Exp $
   *
   * Copyright 1984, Larry Wall
   *

--- 1,6 -----
  /* patch - a program to apply diffs to original files
   *
!  * $Header: patch.c,v 1.2.1.4 84/12/06 11:14:15 lwall Exp $
   *
   * Copyright 1984, Larry Wall
   *
***************
*** 8,13
   * money off of it, or pretend that you wrote it.
   *
   * $Log:	patch.c,v $
   * Revision 1.2.1.3  84/12/05  11:18:43  lwall
   * Added -l switch to do loose string comparison.
   * 

--- 8,16 -----
   * money off of it, or pretend that you wrote it.
   *
   * $Log:	patch.c,v $
+  * Revision 1.2.1.4  84/12/06  11:14:15  lwall
+  * Made smarter about SCCS subdirectories.
+  * 
   * Revision 1.2.1.3  84/12/05  11:18:43  lwall
   * Added -l switch to do loose string comparison.
   * 
***************
*** 815,822
  		fatal("Can't check out %s.\n",filename);
  	}
  	else {
! 	    Sprintf(buf,"%s%s",SCCSPREFIX,filename);
! 	    if (stat(buf,&filestat) >= 0) {
  		Sprintf(buf,GET,filename);
  		if (verbose)
  		    say("Can't find %s--attempting to get it from SCCS.\n",

--- 818,825 -----
  		fatal("Can't check out %s.\n",filename);
  	}
  	else {
! 	    Sprintf(buf,"SCCS/%s%s",SCCSPREFIX,filename);
! 	    if (stat(buf,&filestat) >= 0 || stat(buf+5,&filestat) >= 0) {
  		Sprintf(buf,GET,filename);
  		if (verbose)
  		    say("Can't find %s--attempting to get it from SCCS.\n",
***************
*** 1184,1191
      if (stat(name,&filestat) < 0) {
  	Strcat(tmpbuf,RCSSUFFIX);
  	if (stat(tmpbuf,&filestat) < 0 && stat(tmpbuf+4,&filestat) < 0) {
! 	    Sprintf(tmpbuf,"%s%s",SCCSPREFIX,name);
! 	    if (stat(tmpbuf,&filestat) < 0) {
  		free(name);
  		name = Nullch;
  	    }

--- 1187,1194 -----
      if (stat(name,&filestat) < 0) {
  	Strcat(tmpbuf,RCSSUFFIX);
  	if (stat(tmpbuf,&filestat) < 0 && stat(tmpbuf+4,&filestat) < 0) {
! 	    Sprintf(tmpbuf,"SCCS/%s%s",SCCSPREFIX,name);
! 	    if (stat(tmpbuf,&filestat) < 0 && stat(tmpbuf+5,&filestat) < 0) {
  		free(name);
  		name = Nullch;
  	    }