From root Tue Aug 25 18:06:51 1992 US/
To: erc
>From unislc.slc.unisys.com!erc  Tue Aug 25 17:55:49 1992 remote from saturn
Received: from uplherc.upl.com by saturn.upl.com (4.1/SMI-4.1)
	id AA03723; Tue, 25 Aug 92 17:55:49 MDT
Received: from apple.com by uplherc.upl.com (4.1/SMI-4.1)
	id AA26835; Tue, 25 Aug 92 17:55:43 MDT
Received: from [129.221.4.39] by apple.com with SMTP (5.61/7-Aug-1992-eef)
	id AA03731; Tue, 25 Aug 92 16:55:33 -0700
	for khijol!erc@saturn.upl.com
Received: by unislc.slc.unisys.com (5.61/1.35)
	id AA20030; Tue, 25 Aug 92 17:57:32 -0600
Date: Tue, 25 Aug 92 17:57:32 -0600
From: Ed Carp <saturn!unislc.slc.unisys.com!erc>
Message-Id: <9208252357.AA20030@unislc.slc.unisys.com>
To: apple.com!saturn.upl.com!khijol!erc
Subject: (fwd) Fixes for uustatus 1.2d
Newsgroups: alt.sources
Organization: Unisys Corporation SLC
Status: RO

Path: unislc!uunet!uunet!stanford.edu!rutgers!cbmvax!snark!esr
From: esr@snark.thyrsus.com (Eric S. Raymond)
Newsgroups: alt.sources
Subject: Fixes for uustatus 1.2d
Message-ID: <1hYyhZ#6VcXHx6JPVlS0Rkx389p6XmG=esr@snark.thyrsus.com>
Date: 25 Aug 92 14:59:38 GMT
Lines: 116

I'm posting this because Ed Carp's email address seems to be unreachable.

These patches fix some minor problems and one serious bug in uustatus 1.2d.

1. The regexp library calls in findpath won't resolve on some systems
without the Programmer's Workbench library (present on almost all UNIXes
for historical reasons).

2. There's no way to choose to install only one of the utilities.  I have
fixed this.

3. The preprocessor expression #ifdef hpux || M_XENIX is illegal under ANSI
C and many pre-ANSI compilers.  I have replaced it with an equivalent portable
expression.

THE BIG BUG:

4. *Never* scanf %s through an uninitialized pointer.  This writes the
field data somewhere at random and is just begging for a segfault.  For
what you were doing here (just skipping those fields) use %*s (which is
portable).

I only fixed the one instance of this that gave me a bus error.  You should
go through the rest of your scans and convert them.

===================================================================
RCS file: /src/comm/uustatus/Makefile,v
retrieving revision 1.1
diff -a -c1 -r1.1 Makefile
*** 1.1	1992/08/25 14:26:44
--- Makefile	1992/08/25 14:33:23
***************
*** 41,43 ****
  findpath:	findpath.c basename.fun strrep.fun
! 	$(CC) $(FLAGS) -o findpath findpath.c
  
--- 41,43 ----
  findpath:	findpath.c basename.fun strrep.fun
! 	$(CC) $(FLAGS) -o findpath findpath.c -lPW
  
***************
*** 49,56 ****
  
! install: all
! 	rm -f $(BINDIR)/uustatus $(BINDIR)/findpath
  	strip uustatus
- 	strip findpath
  	cp uustatus $(BINDIR)
- 	cp findpath $(BINDIR)
  	chown $(OWNER) $(BINDIR)/uustatus
--- 49,56 ----
  
! install: uustatus_only findpath_only
! 
! uustatus_only: uustatus
! 	rm -f $(BINDIR)/uustatus
  	strip uustatus
  	cp uustatus $(BINDIR)
  	chown $(OWNER) $(BINDIR)/uustatus
***************
*** 58,60 ****
  	chmod 4755 $(BINDIR)/uustatus
- 	chmod 755 $(BINDIR)/findpath
  
--- 58,64 ----
  	chmod 4755 $(BINDIR)/uustatus
  
+ findpath_only: findpath
+ 	rm -f $(BINDIR)/findpath
+ 	strip findpath
+ 	cp findpath $(BINDIR)
+ 	chmod 755 $(BINDIR)/findpath
===================================================================
RCS file: /src/comm/uustatus/findpath.c,v
retrieving revision 1.1
diff -a -c1 -r1.1 findpath.c
*** 1.1	1992/08/25 14:30:23
--- findpath.c	1992/08/25 14:30:39
***************
*** 19,21 ****
  #include <sys/types.h>
! #ifdef hpux || M_XENIX
  #include <sys/ndir.h>
--- 19,21 ----
  #include <sys/types.h>
! #if defined(hpux) || defined(M_XENIX)
  #include <sys/ndir.h>
===================================================================
RCS file: /src/comm/uustatus/uustatus.c,v
retrieving revision 1.1
diff -a -c1 -r1.1 uustatus.c
*** 1.1	1992/08/25 14:22:00
--- uustatus.c	1992/08/25 14:38:04
***************
*** 61,63 ****
  #include <curses.h>
! #ifdef hpux || M_XENIX
  #include <sys/ndir.h>
--- 61,63 ----
  #include <curses.h>
! #if defined(hpux) || defined(M_XENIX)
  #include <sys/ndir.h>
***************
*** 561,564 ****
  	   continue;
!         sscanf(line, "%s %s %s %s %s %s %s %s %s",
!            ptr, ptr, ptr, ptr, ptr, dptr, chars, ptr, secs);
          sscanf(secs, "%f", &tsecs);
--- 561,564 ----
  	   continue;
!         sscanf(line, "%*s %*s %*s %*s %*s %s %s %*s %s",
!            dptr, chars, secs);
          sscanf(secs, "%f", &tsecs);

-- 
					Eric S. Raymond <esr@snark.thyrsus.com>

--
Ed Carp, N7EKG     erc@apple.com                801/538-0177
"This is the final task I will ever give you, and it  goes  on  forever.   Act
happy, feel happy, be happy, without a reason in the world. Then you can love,
and do what you will."           -- Dan Millman, "Way Of The Peaceful Warrior"

