🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sources.bugs
2 messages
2 total messages Started by David J. MacKenzie Tue, 15 Sep 1992 05:34
patch 12u8 to patch, part 01 of 02
#338
Author: David J. MacKenzie
Date: Tue, 15 Sep 1992 05:34
896 lines
25651 bytes
diff -C2 -N patch-2.0.12u7/patch.man patch-2.0.12u8/patch.man
*** patch-2.0.12u7/patch.man	Sat Jul  4 04:47:57 1992
--- patch-2.0.12u8/patch.man	Tue Aug 25 22:32:41 1992
***************
*** 1,38 ****
  .\" -*- nroff -*-
  .rn '' }`
! ''' $Header: patch.man,v 2.0.1.2 88/06/22 20:47:18 lwall Locked $
! ''' 
! ''' $Log:	patch.man,v $
! ''' Revision 2.0.1.2  88/06/22  20:47:18  lwall
! ''' patch12: now avoids Bell System Logo
! ''' 
! ''' Revision 2.0.1.1  88/06/03  15:12:51  lwall
! ''' patch10: -B switch was contributed.
! ''' 
! ''' Revision 2.0  86/09/17  15:39:09  lwall
! ''' Baseline for netwide release.
! ''' 
! ''' Revision 1.4  86/08/01  19:23:22  lwall
! ''' Documented -v, -p, -F.
! ''' Added notes to patch senders.
! ''' 
! ''' Revision 1.3  85/03/26  15:11:06  lwall
! ''' Frozen.
! ''' 
! ''' Revision 1.2.1.4  85/03/12  16:14:27  lwall
! ''' Documented -p.
! ''' 
! ''' Revision 1.2.1.3  85/03/12  16:09:41  lwall
! ''' Documented -D.
! ''' 
! ''' Revision 1.2.1.2  84/12/05  11:06:55  lwall
! ''' Added -l switch, and noted bistability bug.
! ''' 
! ''' Revision 1.2.1.1  84/12/04  17:23:39  lwall
! ''' Branch for sdcrdcf changes.
! ''' 
! ''' Revision 1.2  84/12/04  17:22:02  lwall
! ''' Baseline version.
! ''' 
  .de Sh
  .br
--- 1,38 ----
  .\" -*- nroff -*-
  .rn '' }`
! '\" $Header: patch.man,v 2.0.1.2 88/06/22 20:47:18 lwall Locked $
! '\" 
! '\" $Log:	patch.man,v $
! '\" Revision 2.0.1.2  88/06/22  20:47:18  lwall
! '\" patch12: now avoids Bell System Logo
! '\" 
! '\" Revision 2.0.1.1  88/06/03  15:12:51  lwall
! '\" patch10: -B switch was contributed.
! '\" 
! '\" Revision 2.0  86/09/17  15:39:09  lwall
! '\" Baseline for netwide release.
! '\" 
! '\" Revision 1.4  86/08/01  19:23:22  lwall
! '\" Documented -v, -p, -F.
! '\" Added notes to patch senders.
! '\" 
! '\" Revision 1.3  85/03/26  15:11:06  lwall
! '\" Frozen.
! '\" 
! '\" Revision 1.2.1.4  85/03/12  16:14:27  lwall
! '\" Documented -p.
! '\" 
! '\" Revision 1.2.1.3  85/03/12  16:09:41  lwall
! '\" Documented -D.
! '\" 
! '\" Revision 1.2.1.2  84/12/05  11:06:55  lwall
! '\" Added -l switch, and noted bistability bug.
! '\" 
! '\" Revision 1.2.1.1  84/12/04  17:23:39  lwall
! '\" Branch for sdcrdcf changes.
! '\" 
! '\" Revision 1.2  84/12/04  17:22:02  lwall
! '\" Baseline version.
! '\" 
  .de Sh
  .br
***************
*** 46,54 ****
  .if n .sp
  ..
! '''
! '''     Set up \*(-- to give an unbreakable dash;
! '''     string Tr holds user defined translation string.
! '''     Bell System Logo is used as a dummy character.
! '''
  .ie n \{\
  .tr \(*W-\*(Tr
--- 46,56 ----
  .if n .sp
  ..
! '\"
! '\"     Set up \*(-- to give an unbreakable dash;
! '\"     string Tr holds user defined translation string.
! '\"     Bell System Logo is used as a dummy character.
! '\"
! '\" Shut up a groff -ww warning.
! .if \n(.g .if !dTr .ds Tr
  .ie n \{\
  .tr \(*W-\*(Tr
***************
*** 71,78 ****
  .TH PATCH 1 LOCAL
  .SH NAME
! patch - a program for applying a diff file to an original
  .SH SYNOPSIS
  .B patch
! [options] orig patchfile [+ [options] orig]
  .sp
  but usually just
--- 73,80 ----
  .TH PATCH 1 LOCAL
  .SH NAME
! patch - apply a diff file to an original
  .SH SYNOPSIS
  .B patch
! [options] [origfile [patchfile]] [+ [options] [origfile]]...
  .sp
  but usually just
***************
*** 108,114 ****
  backup file that does not already exist.
  .PP
- .I patch
- removes output files that are empty after being patched.
- .PP
  You may also specify where you want the output to go with a
  .B -o
--- 110,113 ----
***************
*** 274,277 ****
--- 273,281 ----
  to interpret the patch file as an ed script.
  .TP 5
+ .B \-E
+ causes
+ .I patch
+ to remove output files that are empty after the patches have been applied.
+ .TP 5
  .B \-f
  forces
***************
*** 278,286 ****
  .I patch
  to assume that the user knows exactly what he or she is doing, and to not
! ask any questions.
! It does not suppress commentary, however.
! Use
  .B \-s
  for that.
  .TP 5
  .B \-F<number>
--- 282,301 ----
  .I patch
  to assume that the user knows exactly what he or she is doing, and to not
! ask any questions.  It assumes the following: skip patches for which a
! file to patch can't be found; patch files even though they have the
! wrong version for the ``Prereq:'' line in the patch; and assume that
! patches are not reversed even if they look like they are.
! This option does not suppress commentary; use
  .B \-s
  for that.
+ .TP 5
+ .B \-t
+ similar to
+ .BR \-f ,
+ in that it suppresses questions, but makes some different assumptions:
+ skip patches for which a file to patch can't be found (the same as \fB\-f\fP);
+ skip patches for which the file has the wrong version for the ``Prereq:'' line
+ in the patch; and assume that patches are reversed if they look like
+ they are.
  .TP 5
  .B \-F<number>
diff -C2 -N patch-2.0.12u7/pch.c patch-2.0.12u8/pch.c
*** patch-2.0.12u7/pch.c	Tue Dec  3 11:27:06 1991
--- patch-2.0.12u8/pch.c	Tue Aug 25 22:28:23 1992
***************
*** 86,90 ****
  	pfp = fopen(TMPPATNAME, "w");
  	if (pfp == Nullfp)
! 	    fatal2("patch: can't create %s.\n", TMPPATNAME);
  	while (fgets(buf, sizeof buf, stdin) != Nullch)
  	    fputs(buf, pfp);
--- 86,90 ----
  	pfp = fopen(TMPPATNAME, "w");
  	if (pfp == Nullfp)
! 	    pfatal2("can't create %s", TMPPATNAME);
  	while (fgets(buf, sizeof buf, stdin) != Nullch)
  	    fputs(buf, pfp);
***************
*** 94,98 ****
      pfp = fopen(filename, "r");
      if (pfp == Nullfp)
! 	fatal2("patch file %s not found\n", filename);
      Fstat(fileno(pfp), &filestat);
      p_filesize = filestat.st_size;
--- 94,98 ----
      pfp = fopen(filename, "r");
      if (pfp == Nullfp)
! 	pfatal2("patch file %s not found", filename);
      Fstat(fileno(pfp), &filestat);
      p_filesize = filestat.st_size;
***************
*** 136,140 ****
  	return;
      if (!using_plan_a)
! 	fatal1("patch: out of memory (grow_hunkmax)\n");
      out_of_mem = TRUE;		/* whatever is null will be allocated again */
  				/* from within plan_a(), of all places */
--- 136,140 ----
  	return;
      if (!using_plan_a)
! 	fatal1("out of memory\n");
      out_of_mem = TRUE;		/* whatever is null will be allocated again */
  				/* from within plan_a(), of all places */
***************
*** 175,179 ****
      skip_to(p_start,p_sline);
      while (filearg[0] == Nullch) {
! 	if (force) {
  	    say1("No file to patch.  Skipping...\n");
  	    filearg[0] = savestr(bestguess);
--- 175,179 ----
      skip_to(p_start,p_sline);
      while (filearg[0] == Nullch) {
! 	if (force || batch) {
  	    say1("No file to patch.  Skipping...\n");
  	    filearg[0] = savestr(bestguess);
***************
*** 427,431 ****
  malformed ()
  {
!     fatal3("Malformed patch at line %ld: %s", p_input_line, buf);
  		/* about as informative as "Syntax error" in C */
  }
--- 427,431 ----
  malformed ()
  {
!     fatal3("malformed patch at line %ld: %s", p_input_line, buf);
  		/* about as informative as "Syntax error" in C */
  }
***************
*** 488,492 ****
  			goto hunk_done;
  		    }
! 		    fatal1("Unexpected end of file in patch.\n");
  		}
  	    }
--- 488,492 ----
  			goto hunk_done;
  		    }
! 		    fatal1("unexpected end of file in patch\n");
  		}
  	    }
***************
*** 507,511 ****
  		    }
  		    else
! 			fatal2("Unexpected end of hunk at line %ld.\n",
  			    p_input_line);
  		}
--- 507,511 ----
  		    }
  		    else
! 			fatal2("unexpected end of hunk at line %ld\n",
  			    p_input_line);
  		}
***************
*** 515,519 ****
  			goto hunk_done;
  		    }
! 		    fatal3("Unexpected *** at line %ld: %s", p_input_line, buf);
  		}
  		context = 0;
--- 515,519 ----
  			goto hunk_done;
  		    }
! 		    fatal3("unexpected *** at line %ld: %s", p_input_line, buf);
  		}
  		context = 0;
***************
*** 567,571 ****
  				}
  				fatal3(
! "Duplicate \"---\" at line %ld--check line numbers at line %ld.\n",
  				    p_input_line, p_hunk_beg + repl_beginning);
  			    }
--- 567,571 ----
  				}
  				fatal3(
! "duplicate \"---\" at line %ld--check line numbers at line %ld\n",
  				    p_input_line, p_hunk_beg + repl_beginning);
  			    }
***************
*** 572,576 ****
  			    else {
  				fatal4(
! "%s \"---\" at line %ld--check line numbers at line %ld.\n",
  				    (p_end <= p_ptrn_lines
  					? "Premature"
--- 572,576 ----
  			    else {
  				fatal4(
! "%s \"---\" at line %ld--check line numbers at line %ld\n",
  				    (p_end <= p_ptrn_lines
  					? "Premature"
***************
*** 608,612 ****
  		    p_max = p_repl_lines + p_end;
  		    if (p_max > MAXHUNKSIZE)
! 			fatal4("Hunk too large (%ld lines) at line %ld: %s",
  			      p_max, p_input_line, buf);
  		    while (p_max >= hunkmax)
--- 608,612 ----
  		    p_max = p_repl_lines + p_end;
  		    if (p_max > MAXHUNKSIZE)
! 			fatal4("hunk too large (%ld lines) at line %ld: %s",
  			      p_max, p_input_line, buf);
  		    while (p_max >= hunkmax)
***************
*** 690,694 ****
      hunk_done:
  	if (p_end >=0 && !repl_beginning)
! 	    fatal2("No --- found in patch at line %ld\n", pch_hunk_beg());
  
  	if (repl_missing) {
--- 690,694 ----
      hunk_done:
  	if (p_end >=0 && !repl_beginning)
! 	    fatal2("no --- found in patch at line %ld\n", pch_hunk_beg());
  
  	if (repl_missing) {
***************
*** 720,724 ****
  		filldst++;
  	    }
! /*	    repl_beginning--;		/* this doesn't need to be fixed */
  	    p_end--;
  	    p_first++;			/* do append rather than insert */
--- 720,726 ----
  		filldst++;
  	    }
! #if 0
! 	    repl_beginning--;		/* this doesn't need to be fixed */
! #endif
  	    p_end--;
  	    p_first++;			/* do append rather than insert */
***************
*** 745,749 ****
  		    fillsrc++;
  		if (fillsrc > p_end)
! 		    fatal2("Replacement text or line numbers mangled in hunk at line %ld\n",
  			p_hunk_beg);
  		p_line[filldst] = p_line[fillsrc];
--- 747,751 ----
  		    fillsrc++;
  		if (fillsrc > p_end)
! 		    fatal2("replacement text or line numbers mangled in hunk at line %ld\n",
  			p_hunk_beg);
  		p_line[filldst] = p_line[fillsrc];
***************
*** 833,837 ****
  		    Strcpy(buf, " \n");  /* assume blank lines got chopped */
  		else {
! 		    fatal1("Unexpected end of file in patch.\n");
  		}
  	    }
--- 835,839 ----
  		    Strcpy(buf, " \n");  /* assume blank lines got chopped */
  		else {
! 		    fatal1("unexpected end of file in patch\n");
  		}
  	    }
***************
*** 941,945 ****
  	p_end = p_ptrn_lines + 1 + max - min + 1;
  	if (p_end > MAXHUNKSIZE)
! 	    fatal4("Hunk too large (%ld lines) at line %ld: %s",
  		  p_end, p_input_line, buf);
  	while (p_end >= hunkmax)
--- 943,947 ----
  	p_end = p_ptrn_lines + 1 + max - min + 1;
  	if (p_end > MAXHUNKSIZE)
! 	    fatal4("hunk too large (%ld lines) at line %ld: %s",
  		  p_end, p_input_line, buf);
  	while (p_end >= hunkmax)
***************
*** 958,965 ****
  	    p_input_line++;
  	    if (ret == Nullch)
! 		fatal2("Unexpected end of file in patch at line %ld.\n",
  		  p_input_line);
  	    if (*buf != '<')
! 		fatal2("< expected at line %ld of patch.\n", p_input_line);
  	    p_line[i] = savestr(buf+2);
  	    if (out_of_mem) {
--- 960,967 ----
  	    p_input_line++;
  	    if (ret == Nullch)
! 		fatal2("unexpected end of file in patch at line %ld\n",
  		  p_input_line);
  	    if (*buf != '<')
! 		fatal2("< expected at line %ld of patch\n", p_input_line);
  	    p_line[i] = savestr(buf+2);
  	    if (out_of_mem) {
***************
*** 974,981 ****
  	    p_input_line++;
  	    if (ret == Nullch)
! 		fatal2("Unexpected end of file in patch at line %ld.\n",
  		    p_input_line);
  	    if (*buf != '-')
! 		fatal2("--- expected at line %ld of patch.\n", p_input_line);
  	}
  	Sprintf(buf, "--- %ld,%ld\n", min, max);
--- 976,983 ----
  	    p_input_line++;
  	    if (ret == Nullch)
! 		fatal2("unexpected end of file in patch at line %ld\n",
  		    p_input_line);
  	    if (*buf != '-')
! 		fatal2("--- expected at line %ld of patch\n", p_input_line);
  	}
  	Sprintf(buf, "--- %ld,%ld\n", min, max);
***************
*** 990,997 ****
  	    p_input_line++;
  	    if (ret == Nullch)
! 		fatal2("Unexpected end of file in patch at line %ld.\n",
  		    p_input_line);
  	    if (*buf != '>')
! 		fatal2("> expected at line %ld of patch.\n", p_input_line);
  	    p_line[i] = savestr(buf+2);
  	    if (out_of_mem) {
--- 992,999 ----
  	    p_input_line++;
  	    if (ret == Nullch)
! 		fatal2("unexpected end of file in patch at line %ld\n",
  		    p_input_line);
  	    if (*buf != '>')
! 		fatal2("> expected at line %ld of patch\n", p_input_line);
  	    p_line[i] = savestr(buf+2);
  	    if (out_of_mem) {
***************
*** 1249,1253 ****
      Reg3 bool this_line_is_command = FALSE;
      Reg4 FILE *pipefp;
-     FILE *popen();
  
      if (!skip_rest_of_patch) {
--- 1251,1254 ----
diff -C2 -N patch-2.0.12u7/util.c patch-2.0.12u8/util.c
*** patch-2.0.12u7/util.c	Mon Jul  6 15:25:27 1992
--- patch-2.0.12u8/util.c	Mon Sep 14 22:04:46 1992
***************
*** 5,8 ****
--- 5,23 ----
  #include "backupfile.h"
  
+ void my_exit();
+ 
+ static char *
+ private_strerror (errnum)
+      int errnum;
+ {
+   extern char *sys_errlist[];
+   extern int sys_nerr;
+ 
+   if (errnum > 0 && errnum <= sys_nerr)
+     return sys_errlist[errnum];
+   return "Unknown system error";
+ }
+ #define strerror private_strerror
+ 
  /* Rename a file, copying it if necessary. */
  
***************
*** 25,32 ****
  	fromfd = open(from, 0);
  	if (fromfd < 0)
! 	    fatal2("patch: internal error, can't reopen %s\n", from);
  	while ((i=read(fromfd, buf, sizeof buf)) > 0)
  	    if (write(1, buf, i) != 1)
! 		fatal1("patch: write failed\n");
  	Close(fromfd);
  	return 0;
--- 40,47 ----
  	fromfd = open(from, 0);
  	if (fromfd < 0)
! 	    pfatal2("internal error, can't reopen %s", from);
  	while ((i=read(fromfd, buf, sizeof buf)) > 0)
  	    if (write(1, buf, i) != 1)
! 		pfatal1("write failed");
  	Close(fromfd);
  	return 0;
***************
*** 40,44 ****
  	char *backupname = find_backup_file_name(to);
  	if (backupname == (char *) 0)
! 	    fatal1("Can't seem to get enough memory.\n");
  	Strcpy(bakname, backupname);
  	free(backupname);
--- 55,59 ----
  	char *backupname = find_backup_file_name(to);
  	if (backupname == (char *) 0)
! 	    fatal1("out of memory\n");
  	Strcpy(bakname, backupname);
  	free(backupname);
***************
*** 49,53 ****
      }
  
!     if (stat(to, &filestat) >= 0) {	/* output file exists */
  	dev_t to_device = filestat.st_dev;
  	ino_t to_inode  = filestat.st_ino;
--- 64,68 ----
      }
  
!     if (stat(to, &filestat) == 0) {	/* output file exists */
  	dev_t to_device = filestat.st_dev;
  	ino_t to_inode  = filestat.st_ino;
***************
*** 61,65 ****
  	   Change the first lowercase char into uppercase;
  	   if that isn't sufficient, chop off the first char and try again.  */
! 	while (stat(bakname, &filestat) >= 0 &&
  		to_device == filestat.st_dev && to_inode == filestat.st_ino) {
  	    /* Skip initial non-lowercase chars.  */
--- 76,80 ----
  	   Change the first lowercase char into uppercase;
  	   if that isn't sufficient, chop off the first char and try again.  */
! 	while (stat(bakname, &filestat) == 0 &&
  		to_device == filestat.st_dev && to_inode == filestat.st_ino) {
  	    /* Skip initial non-lowercase chars.  */
***************
*** 84,88 ****
  	    bakfd = creat(bakname, 0666);
  	    if (bakfd < 0) {
! 		say3("patch: can't backup %s, output is in %s.\n", to, from);
  		return -1;
  	    }
--- 99,104 ----
  	    bakfd = creat(bakname, 0666);
  	    if (bakfd < 0) {
! 		say4("Can't backup %s, output is in %s: %s\n", to, from,
! 		     strerror(errno));
  		return -1;
  	    }
***************
*** 89,96 ****
  	    tofd = open(to, 0);
  	    if (tofd < 0)
! 		fatal2("patch: internal error, can't open %s\n", to);
  	    while ((i=read(tofd, buf, sizeof buf)) > 0)
  		if (write(bakfd, buf, i) != i)
! 		    fatal1("patch: write failed\n");
  	    Close(tofd);
  	    Close(bakfd);
--- 105,112 ----
  	    tofd = open(to, 0);
  	    if (tofd < 0)
! 		pfatal2("internal error, can't open %s", to);
  	    while ((i=read(tofd, buf, sizeof buf)) > 0)
  		if (write(bakfd, buf, i) != i)
! 		    pfatal1("write failed");
  	    Close(tofd);
  	    Close(bakfd);
***************
*** 107,112 ****
  	tofd = creat(to, 0666);
  	if (tofd < 0) {
! 	    say3("patch: can't create %s, output is in %s.\n",
! 	      to, from);
  	    return -1;
  	}
--- 123,128 ----
  	tofd = creat(to, 0666);
  	if (tofd < 0) {
! 	    say4("Can't create %s, output is in %s: %s\n",
! 	      to, from, strerror(errno));
  	    return -1;
  	}
***************
*** 113,120 ****
  	fromfd = open(from, 0);
  	if (fromfd < 0)
! 	    fatal2("patch: internal error, can't reopen %s\n", from);
  	while ((i=read(fromfd, buf, sizeof buf)) > 0)
  	    if (write(tofd, buf, i) != i)
! 		fatal1("patch: write failed\n");
  	Close(fromfd);
  	Close(tofd);
--- 129,136 ----
  	fromfd = open(from, 0);
  	if (fromfd < 0)
! 	    pfatal2("internal error, can't reopen %s", from);
  	while ((i=read(fromfd, buf, sizeof buf)) > 0)
  	    if (write(tofd, buf, i) != i)
! 		pfatal1("write failed");
  	Close(fromfd);
  	Close(tofd);
***************
*** 136,146 ****
      tofd = creat(to, 0666);
      if (tofd < 0)
! 	fatal2("patch: can't create %s.\n", to);
      fromfd = open(from, 0);
      if (fromfd < 0)
! 	fatal2("patch: internal error, can't reopen %s\n", from);
      while ((i=read(fromfd, buf, sizeof buf)) > 0)
  	if (write(tofd, buf, i) != i)
! 	    fatal2("patch: write (%s) failed\n", to);
      Close(fromfd);
      Close(tofd);
--- 152,162 ----
      tofd = creat(to, 0666);
      if (tofd < 0)
! 	pfatal2("can't create %s", to);
      fromfd = open(from, 0);
      if (fromfd < 0)
! 	pfatal2("internal error, can't reopen %s", from);
      while ((i=read(fromfd, buf, sizeof buf)) > 0)
  	if (write(tofd, buf, i) != i)
! 	    pfatal2("write to %s failed", to);
      Close(fromfd);
      Close(tofd);
***************
*** 165,169 ****
  	    out_of_mem = TRUE;
  	else
! 	    fatal1("patch: out of memory (savestr)\n");
      }
      else {
--- 181,185 ----
  	    out_of_mem = TRUE;
  	else
! 	    fatal1("out of memory\n");
      }
      else {
***************
*** 181,184 ****
--- 197,202 ----
  fatal(pat) char *pat; { ; }
  /*VARARGS ARGSUSED*/
+ pfatal(pat) char *pat; { ; }
+ /*VARARGS ARGSUSED*/
  ask(pat) char *pat; { ; }
  
***************
*** 203,209 ****
  long arg1,arg2,arg3;
  {
!     void my_exit();
  
!     say(pat, arg1, arg2, arg3);
      my_exit(1);
  }
--- 221,241 ----
  long arg1,arg2,arg3;
  {
!     fprintf(stderr, "patch: **** ");
!     fprintf(stderr, pat, arg1, arg2, arg3);
!     my_exit(1);
! }
! 
! /* Say something from patch, something from the system, then silence . . . */
! 
! void				/* very void */
! pfatal(pat,arg1,arg2,arg3)
! char *pat;
! long arg1,arg2,arg3;
! {
!     int errnum = errno;
  
!     fprintf(stderr, "patch: **** ");
!     fprintf(stderr, pat, arg1, arg2, arg3);
!     fprintf(stderr, ": %s\n", strerror(errnum));
      my_exit(1);
  }
***************
*** 261,265 ****
  int reset;
  {
-     void my_exit();
  #ifndef lint
  #ifdef VOIDSIG
--- 293,296 ----
***************
*** 301,305 ****
  }
  
! /* Make sure we'll have the directories to create a file. */
  
  void
--- 332,337 ----
  }
  
! /* Make sure we'll have the directories to create a file.
!    If `striplast' is TRUE, ignore the last element of `filename'.  */
  
  void
***************
*** 310,317 ****
      char tmpbuf[256];
      Reg2 char *s = tmpbuf;
!     char *dirv[20];
      Reg3 int i;
!     Reg4 int dirvp = 0;
  
      while (*filename) {
  	if (*filename == '/') {
--- 342,351 ----
      char tmpbuf[256];
      Reg2 char *s = tmpbuf;
!     char *dirv[20];		/* Point to the NULs between elements.  */
      Reg3 int i;
!     Reg4 int dirvp = 0;		/* Number of finished entries in dirv. */
  
+     /* Copy `filename' into `tmpbuf' with a NUL instead of a slash
+        between the directories.  */
      while (*filename) {
  	if (*filename == '/') {
***************
*** 330,342 ****
      if (dirvp < 0)
  	return;
      strcpy(buf, "mkdir");
      s = buf;
      for (i=0; i<=dirvp; i++) {
! 	while (*s) s++;
! 	*s++ = ' ';
! 	strcpy(s, tmpbuf);
  	*dirv[i] = '/';
      }
!     system(buf);
  }
  
--- 364,382 ----
      if (dirvp < 0)
  	return;
+ 
      strcpy(buf, "mkdir");
      s = buf;
      for (i=0; i<=dirvp; i++) {
! 	struct stat sbuf;
! 
! 	if (stat(tmpbuf, &sbuf) && errno == ENOENT) {
! 	    while (*s) s++;
! 	    *s++ = ' ';
! 	    strcpy(s, tmpbuf);
! 	}
  	*dirv[i] = '/';
      }
!     if (s != buf)
! 	system(buf);
  }
  
***************
*** 380,384 ****
      if (strip_leading == 957 && name != fullname && *fullname != '/') {
  	name[-1] = '\0';
! 	if (stat(fullname, &filestat) >= 0 && S_ISDIR (filestat.st_mode)) {
  	    name[-1] = '/';
  	    name=fullname;
--- 420,424 ----
      if (strip_leading == 957 && name != fullname && *fullname != '/') {
  	name[-1] = '\0';
! 	if (stat(fullname, &filestat) == 0 && S_ISDIR (filestat.st_mode)) {
  	    name[-1] = '/';
  	    name=fullname;
***************
*** 389,402 ****
      free(fullname);
  
!     if (stat(name, &filestat) < 0 && !assume_exists) {
!         Sprintf(tmpbuf, "RCS/%s%s", name, 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;
! 	    }
! 	}
      }
      return name;
  }
--- 429,450 ----
      free(fullname);
  
!     if (stat(name, &filestat) && !assume_exists) {
! 	char *filebase = basename(name);
! 	int pathlen = filebase - name;
! 
! 	/* Put any leading path into `tmpbuf'.  */
! 	strncpy(tmpbuf, name, pathlen);
! 
! #define try(f, a1, a2) (Sprintf(tmpbuf + pathlen, f, a1, a2), stat(tmpbuf, &filestat) == 0)
! 	if (   try("RCS/%s%s", filebase, RCSSUFFIX)
! 	    || try("RCS/%s"  , filebase,         0)
! 	    || try(    "%s%s", filebase, RCSSUFFIX)
! 	    || try("SCCS/%s%s", SCCSPREFIX, filebase)
! 	    || try(     "%s%s", SCCSPREFIX, filebase))
! 	  return name;
! 	free(name);
! 	name = Nullch;
      }
+ 
      return name;
  }
diff -C2 -N patch-2.0.12u7/util.h patch-2.0.12u8/util.h
*** patch-2.0.12u7/util.h	Wed Aug 15 01:13:39 1990
--- patch-2.0.12u8/util.h	Mon Jul 20 14:20:24 1992
***************
*** 23,26 ****
--- 23,30 ----
  #define fatal3 fatal
  #define fatal4 fatal
+ #define pfatal1 pfatal
+ #define pfatal2 pfatal
+ #define pfatal3 pfatal
+ #define pfatal4 pfatal
  
  #else /* hope they allow multi-line macro actual arguments */
***************
*** 40,43 ****
--- 44,51 ----
  #define fatal3(a,b,c) fatal(a, (b)==(b), (c)==(c), 0)
  #define fatal4(a,b,c,d) fatal(a, (b)==(b), (c)==(c), (d)==(d))
+ #define pfatal1(a) pfatal(a, 0, 0, 0)
+ #define pfatal2(a,b) pfatal(a, (b)==(b), 0, 0)
+ #define pfatal3(a,b,c) pfatal(a, (b)==(b), (c)==(c), 0)
+ #define pfatal4(a,b,c,d) pfatal(a, (b)==(b), (c)==(c), (d)==(d))
  
  #else /* lint */
***************
*** 55,58 ****
--- 63,70 ----
  #define fatal3(a,b,c) fatal(a, b, c, Nullch)
  #define fatal4 fatal
+ #define pfatal1(a) pfatal(a, Nullch, Nullch, Nullch)
+ #define pfatal2(a,b) pfatal(a, b, Nullch, Nullch)
+ #define pfatal3(a,b,c) pfatal(a, b, c, Nullch)
+ #define pfatal4 pfatal
  
  #endif /* lint */
***************
*** 68,71 ****
--- 80,84 ----
  void say();
  void fatal();
+ void pfatal();
  void ask();
  char *savestr();
***************
*** 73,74 ****
--- 86,88 ----
  void ignore_signals();
  void makedirs();
+ char *basename();
diff -C2 -N patch-2.0.12u7/version.c patch-2.0.12u8/version.c
*** patch-2.0.12u7/version.c	Sat Mar 14 14:44:29 1992
--- patch-2.0.12u8/version.c	Wed Jul  8 19:17:26 1992
***************
*** 14,17 ****
--- 14,19 ----
  #include "version.h"
  
+ void my_exit();
+ 
  /* Print out the version number and die. */
  
***************
*** 19,30 ****
  version()
  {
!     void my_exit();
!     extern char rcsid[];
! 
! #ifdef lint
!     rcsid[0] = rcsid[0];
! #else
!     fprintf(stderr, "%s\nPatch level: %s\n", rcsid, PATCHLEVEL);
      my_exit(0);
- #endif
  }
--- 21,25 ----
  version()
  {
!     fprintf(stderr, "Patch version 2.0, patch level %s\n", PATCHLEVEL);
      my_exit(0);
  }
Re: patch 12u8 to patch, part 01 of 02
#341
Author: David J. MacKenzie
Date: Tue, 15 Sep 1992 14:20
4 lines
621 bytes
That second posting was, of course, part 02 of 02 . . . 

BTW, there's no patch to get to the 12g8 (GNU-ized) version -- it
would be too big.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads