[net.sources.bugs] SCAME patch no. 3

leif@erisun.UUCP (Leif Samuelsson) (02/23/85)

System: scame 1.0
Patch #: 3
Priority: High

Description:	
	Four problems:
	- On BSD4.2, the mechanism for disallowing two invocations
	  of scame to run at the same time doesn't work. This is
	  serious, because the tempfile handling relies on it.
	- On many systems, Reverse I-Search doesn't work.
	- A minor bug in Scame-reaper might cause problems.
	- getwd() declared wrong.
	
Fix:	From news, say "| patch -d DIR", where DIR is your scame
	source directory.
	Outside of news, say "cd DIR; patch <thisarticle".
	If you don't have the patch program, apply the following
	by hand, or get patch.
	After re-compiling, it is necessary to start up scame with
	the "-n" option, because the tempfiles will be inaccurate.
	Before re-installing, make sure that noone is running scame,
	then remove all the tempfiles in the TMPDIR directory.


Prereq: 1.0.0
*** 1.0/scame.h	Fri Feb 15 23:50:51 1985
--- scame.h	Sat Feb 23 10:09:29 1985
***************
*** 1,6
  /*	SCAME scame.h				*/
  
! /*	Revision 1.0.0  1985-02-09		*/
  
  /*	Copyright (C) 1985 by Leif Samuelsson	*/
  

--- 1,6 -----
  /*	SCAME scame.h				*/
  
! /*	Revision 1.0.1  1985-02-23		*/
  
  /*	Copyright (C) 1985 by Leif Samuelsson	*/
  
***************
*** 206,214
  extern Bool	fileexists(), filnprep(), filncpy(), filncat();
  extern time_t	filemodified();
  extern off_t	filesize();
! #ifndef BSD4_2
! extern Bool	getwd();
! #endif
  
  /* Procedures in strings.c */
  

--- 206,212 -----
  extern Bool	fileexists(), filnprep(), filncpy(), filncat();
  extern time_t	filemodified();
  extern off_t	filesize();
! extern char	*getwd();
  
  /* Procedures in strings.c */
  
Prereq: 1.0.1
*** 1.0/main.c	Tue Feb 19 20:32:51 1985
--- main.c	Sat Feb 23 10:03:48 1985
***************
*** 1,6
  /*	SCAME main.c				*/
  
! /*	Revision 1.0.1	1985-02-17		*/
  
  static char *cpyrid = "@(#)Copyright (C) 1985 by Leif Samuelsson";
  

--- 1,6 -----
  /*	SCAME main.c				*/
  
! /*	Revision 1.0.2	1985-02-23		*/
  
  static char *cpyrid = "@(#)Copyright (C) 1985 by Leif Samuelsson";
  
***************
*** 134,140
  		printf("You have Scame already running somewhere\n");
  		exit(1);
  	}
! 	creat(lockfile, 0600);
  #ifdef BSD42
  	flock(fd, LOCK_EX | LOCK_NB);
  #endif

--- 134,140 -----
  		printf("You have Scame already running somewhere\n");
  		exit(1);
  	}
! 	fd = creat(lockfile, 0600);
  #ifdef BSD42
  	flock(fd, LOCK_EX | LOCK_NB);
  #endif
Prereq: 1.0.0
*** 1.0/files.c	Fri Feb 15 23:51:29 1985
--- files.c	Sat Feb 23 10:10:49 1985
***************
*** 1,6
  /*	SCAME files.c				*/
  
! /*	Revision 1.0.0  1985-02-09		*/
  
  static char *cpyrid = "@(#)Copyright (C) 1985 by Leif Samuelsson";
  

--- 1,6 -----
  /*	SCAME files.c				*/
  
! /*	Revision 1.0.1  1985-02-23		*/
  
  static char *cpyrid = "@(#)Copyright (C) 1985 by Leif Samuelsson";
  
***************
*** 13,19
  /*
   * Get working (current) directory
   */
! Bool getwd(path)
  char path[];
  {
  int	file;

--- 13,19 -----
  /*
   * Get working (current) directory
   */
! char *getwd(path)
  char path[];
  {
  int	file;
***************
*** 30,36
  	for (;;) {
  		stat(".", &d);
  		if (d.st_ino==rino && d.st_dev==rdev) break;
! 		if ((file = open("..",0)) < 0) return(FALSE);
  		fstat(file, &dd);
  		chdir("..");
  		if(d.st_dev == dd.st_dev) {

--- 30,36 -----
  	for (;;) {
  		stat(".", &d);
  		if (d.st_ino==rino && d.st_dev==rdev) break;
! 		if ((file = open("..",0)) < 0) return(NIL);
  		fstat(file, &dd);
  		chdir("..");
  		if(d.st_dev == dd.st_dev) {
***************
*** 37,43
  			if(d.st_ino == dd.st_ino) break;
  			do {
  				if (read(file, (char *)&dir,
! 				    sizeof(dir)) < sizeof(dir)) return(FALSE);
  			} while (dir.d_ino != d.st_ino);
  		}
  		else do {

--- 37,43 -----
  			if(d.st_ino == dd.st_ino) break;
  			do {
  				if (read(file, (char *)&dir,
! 				    sizeof(dir)) < sizeof(dir)) return(NIL);
  			} while (dir.d_ino != d.st_ino);
  		}
  		else do {
***************
*** 42,48
  		}
  		else do {
  				if(read(file, (char *)&dir,
! 				    sizeof(dir)) < sizeof(dir)) return(FALSE);
  				stat(dir.d_name, &dd);
  			} while(dd.st_ino!= d.st_ino || dd.st_dev != d.st_dev);
  		close(file);

--- 42,48 -----
  		}
  		else do {
  				if(read(file, (char *)&dir,
! 				    sizeof(dir)) < sizeof(dir)) return(NIL);
  				stat(dir.d_name, &dd);
  			} while(dd.st_ino!= d.st_ino || dd.st_dev != d.st_dev);
  		close(file);
***************
*** 62,68
  	path[off] = '\0';
  	close(file);
  	chdir(path);
! 	return(TRUE);
  }
  #endif
  

--- 62,68 -----
  	path[off] = '\0';
  	close(file);
  	chdir(path);
! 	return(path);
  }
  #endif
  
Prereq: 1.0.0
*** 1.0/search.c	Fri Feb 15 23:51:29 1985
--- search.c	Sat Feb 23 10:06:21 1985
***************
*** 1,6
  /*	SCAME search.c				*/
  
! /*	Revision 1.0.0  1985-02-09		*/
  
  static char *cpyrid = "@(#)Copyright (C) 1985 by Leif Samuelsson";
  

--- 1,6 -----
  /*	SCAME search.c				*/
  
! /*	Revision 1.0.1  1985-02-23		*/
  
  static char *cpyrid = "@(#)Copyright (C) 1985 by Leif Samuelsson";
  
***************
*** 206,211
  		else {
  			dot = tdot;
  			dot= tdot;
  		}
  	}
  }

--- 206,212 -----
  		else {
  			dot = tdot;
  			dot= tdot;
+ 			return(TRUE);
  		}
  	}
  }
Prereq: 1.0.1
*** 1.0/scame-reaper.c	Tue Feb 19 20:33:00 1985
--- scame-reaper.c	Tue Feb 19 20:40:52 1985
***************
*** 1,6
  /*	SCAME scame-reaper.c		*/
  
! /*	Revision 1.0.1  1985-02-15	*/
  
  static char *cpyrid = "@(#)Copyright (C) 1985 by Leif Samuelsson";
  

--- 1,6 -----
  /*	SCAME scame-reaper.c		*/
  
! /*	Revision 1.0.2  1985-02-19	*/
  
  static char *cpyrid = "@(#)Copyright (C) 1985 by Leif Samuelsson";
  
***************
*** 70,76
  		if (dp->d_ino == 0 || dp->d_name[0] != 'S')
   			continue;
  		for (i=1; i <= 10; i++)
! 			if (dp->d_name[i] < '0' || dp->d_name[1] > '9')
  				goto loop;
  		nentries++;
  		sscanf(dp->d_name, "%*[^0123456789]%5d", &pid);

--- 70,76 -----
  		if (dp->d_ino == 0 || dp->d_name[0] != 'S')
   			continue;
  		for (i=1; i <= 10; i++)
! 			if (dp->d_name[i] < '0' || dp->d_name[i] > '9')
  				goto loop;
  		nentries++;
  		sscanf(dp->d_name, "%*[^0123456789]%5d", &pid);