[net.sources.bugs] Bed version 1.0 patch #2.

stephen@dcl-cs.UUCP (Stephen J. Muir) (09/16/85)

System: Bed version 1
Patch #: 1
Priority: LOW
Subject: some editors confuse "bed"
From:	scott@cstvax.UUCP (Scott Larnach)

Description:
	If the text editor called doesn't put the file back into the original
	inode, then the program fails to recognise that the file has changed.

Fix:
	Run the command "patch < thisfile".
	If patch indicates that "bed.c" is the wrong version, you may need
	to apply one or more previous patches, or the patch may already
	have been applied.  See the file "bed.c" to find out what has or
	has not been applied.  In any event, don't continue with the patch.

Index: patchlevel
Prereq: 1
1c1
< Patch #: 1
---
> Patch #: 2

*** bed.c.orig	Sun Sep 15 22:01:27 1985
--- bed.c	Sun Sep 15 22:34:46 1985
***************
*** 1,7
  /* Written by Stephen J. Muir, Computing Dept., Lancaster University */
  
! /* version 1.0
!  * release date 4th June 1985
   *
   * patch date 15th June 1985
   * changed to run on non-BSD systems

--- 1,10 -----
  /* Written by Stephen J. Muir, Computing Dept., Lancaster University */
  
! /*
!  * version 1.2
!  * patch date 15th September 1985
!  * changed to allow use of editors which don't put the file back
!  * in its original inode
   *
   * version 1.1
   * patch date 15th June 1985
***************
*** 3,8
  /* version 1.0
   * release date 4th June 1985
   *
   * patch date 15th June 1985
   * changed to run on non-BSD systems
   * added 'v' command

--- 6,12 -----
   * changed to allow use of editors which don't put the file back
   * in its original inode
   *
+  * version 1.1
   * patch date 15th June 1985
   * changed to run on non-BSD systems
   * added 'v' command
***************
*** 6,11
   * patch date 15th June 1985
   * changed to run on non-BSD systems
   * added 'v' command
   */
  
  # include <sys/types.h>

--- 10,19 -----
   * patch date 15th June 1985
   * changed to run on non-BSD systems
   * added 'v' command
+  *
+  * version 1.0
+  * bed - an editor for binary files
+  * release date 4th June 1985
   */
  
  # include <sys/types.h>
***************
*** 18,24
  
  extern char	*rindex (), *mktemp (), *getenv (), *getcom (), *getpar ();
  
! char	*version = "Bed version 1.1\n";
  
  char	*filename, *editor, *ap, abuf [32],
  	*tempdata = "DbedXXXXXX", *temptext = "TbedXXXXXX";

--- 26,32 -----
  
  extern char	*rindex (), *mktemp (), *getenv (), *getcom (), *getpar ();
  
! char	*version = "Bed version 1.2\n";
  
  char	*filename, *editor, *ap, abuf [32],
  	*tempdata = "DbedXXXXXX", *temptext = "TbedXXXXXX";
***************
*** 452,457
  		goto out;
  	  fstat (fileno (tfd), &status);
  	  t_mtime = status.st_mtime;
  	  while ((pid = fork ()) == -1);
  	  if (pid == 0)
  	  { execlp (editor, editor, temptext, 0);

--- 460,466 -----
  		goto out;
  	  fstat (fileno (tfd), &status);
  	  t_mtime = status.st_mtime;
+ 	  fclose (tfd);			/* cstvax!scott */
  	  while ((pid = fork ()) == -1);
  	  if (pid == 0)
  	  { execlp (editor, editor, temptext, 0);
***************
*** 459,464
  	    exit (1);
  	  }
  	  wait (0);
  	  fstat (fileno (tfd), &status);
  	  if (status.st_mtime != t_mtime)
  	  { fseek (tfd, 0, 0);

--- 468,477 -----
  	    exit (1);
  	  }
  	  wait (0);
+ 	  if ((tfd = fopen (temptext, "r")) == NULL)	/* cstvax!scott */
+ 	  { perror (temptext);
+ 	    goto delete;
+ 	  }
  	  fstat (fileno (tfd), &status);
  	  if (status.st_mtime != t_mtime)
  	  { fseek (tfd, 0, 0);
***************
*** 482,488
  		++dirty;
  	  }
  out:	  fclose (tfd);
! 	  unlink (temptext);
  	}
  
  /*ARGSUSED*/

--- 495,501 -----
  		++dirty;
  	  }
  out:	  fclose (tfd);
! delete:	  unlink (temptext);
  	}
  
  /*ARGSUSED*/
*** bed.n.orig	Sun Sep 15 22:01:05 1985
--- bed.n	Sun Sep 15 22:08:48 1985
***************
*** 1,4
! .TH BED 1 "15 June 1985"
  .SH NAME
  bed \- an editor for binary files
  .SH SYNOPSIS

--- 1,4 -----
! .TH BED 1 "15 September 1985"
  .SH NAME
  bed \- an editor for binary files
  .SH SYNOPSIS
***************
*** 72,77
  v
  Prints version number.
  .SH NOTES
  The user must have read/write access to the original file
  .I and
  its parent directory.

--- 72,82 -----
  v
  Prints version number.
  .SH NOTES
+ The
+ .I record size
+ is the number of bytes per line in the textual representation.
+ This is normally used to make it easier to edit, say,
+ a file into which an array of structures has been dumped.
  The user must have read/write access to the original file
  .I and
  its parent directory.
***************
*** 112,117
  The
  .I radix
  can only have values between 2 and 16 inclusive.
  .PP
  Mail bugs to "dcl-cs!stephen".
  .SH FILES

--- 117,123 -----
  The
  .I radix
  can only have values between 2 and 16 inclusive.
+ The "rename" system call is not available on non-BSD systems.
  .PP
  Mail bugs to "dcl-cs!stephen".
  .SH FILES
-- 
UUCP:	...!seismo!mcvax!ukc!dcl-cs!stephen
DARPA:	stephen%lancs.comp@ucl-cs	| Post: University of Lancaster,
JANET:	stephen@uk.ac.lancs.comp	|	Department of Computing,
Phone:	+44 524 65201 Ext. 4599		|	Bailrigg, Lancaster, UK.
Project:Alvey ECLIPSE Distribution	|	LA1 4YR