Bugs (and fixes) in pathalias

Greg Noel greg at ncr-tp.UUCP
Wed Jan 30 11:33:42 AEST 1985


In article <328 at desint.UUCP> geoff at desint.UUCP (Geoff Kuenning) writes:
>There are a couple of small problems with the latest posting of pathalias:
>
>    (1) The commentary in the makefile neglects to mention that the program
>	uses 'index' and 'rindex'.  USG sites should add -Dindex=strchr and
>	-Drindex=strrchr to their CFLAGS.
>
Well, almost.  It turns out that this substitution is done automaticly in
def.h but one file that uses index() does not #include it.  The offending
file is gethostnam.c, and an examinination of it reveals that this code
will ALWAYS be present, despite the #ifndef that tries to prevent it, so
that the library version of gethostname() will NEVER be used.  Further
perusal shows that gethostname() is only required if neither GETHOSTNAME
nor UNAME is #defined; a site that had uname() but not gethostname() might
set up config.h to indicate this condition, and would needlessly include
the routine, so this should be tested as well.  The diff for this is
attached below.

BTW, the diff in the referenced article should be applied to addnode.c,
not pathalias.c as it indicates.

*** gethostnam.orig	Tue Jan 29 17:23:07 1985
--- gethostnam.c	Tue Jan 29 15:36:10 1985
***************
*** 2,7
  static char	*sccsid = "@(#)gethostnam.c	6.1 (down!honey) 85/01/21";
  #endif lint
  
  #ifndef GETHOSTNAME
  #include <stdio.h>
  

--- 2,9 -----
  static char	*sccsid = "@(#)gethostnam.c	6.1 (down!honey) 85/01/21";
  #endif lint
  
+ #include "def.h"
+ #ifndef UNAME
  #ifndef GETHOSTNAME
  
  void
***************
*** 3,9
  #endif lint
  
  #ifndef GETHOSTNAME
- #include <stdio.h>
  
  void
  gethostname(name, len)

--- 5,10 -----
  #include "def.h"
  #ifndef UNAME
  #ifndef GETHOSTNAME
  
  void
  gethostname(name, len)
***************
*** 53,55
  	return;
  }
  #endif GETHOSTNAME

--- 54,57 -----
  	return;
  }
  #endif GETHOSTNAME
+ #endif UNAME
-- 
-- Greg Noel, NCR Torrey Pines       Greg at ncr-tp.UUCP or Greg at nosc.ARPA



More information about the Comp.sources.bugs mailing list