[comp.bugs.4bsd] UUCP only accepts ' '

gww@marduk.UUCP (Gary Winiger) (09/05/87)

Subject: UUCP only accepts ' ' (space) as a separator following the system name in L.sys. +Fix
Index:	usr.bin/uucp/gnsys.c 4.3BSD +Fix

Description:
	When scanning L.sys for a system name, the only acceptable separator
	between the system name and the rest of the line is ' ' (space).
	It would be nice to use any white space as well.  Ie. a '\t'.
Repeat-By:
	Use a character other than ' ' for the separator.
Fix:
	Use isspace().
	The attached code solves this problem at Elxsi.

Gary..
{ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww
--------- cut --------- snip --------- :.,$w diff -------------
*** /tmp/,RCSt1001006	Wed Jul  1 16:44:58 1987
--- gnsys.c	Wed Jul  1 16:25:28 1987
***************
*** 1,15 ****
  /*
   * $Log:	gnsys.c,v $
   * Revision 1.1  87/06/23  16:58:13  gww
   * Initial revision
   * 
   */
  #ifndef lint
! static char *ERcsId = "$Header: gnsys.c,v 1.1 87/06/23 16:58:13 gww Exp $ ENIX BSD";
  static char sccsid[] = "@(#)gnsys.c	5.4 (Berkeley) 6/20/85";
  #endif
  
  #include "uucp.h"
  #ifdef	NDIR
  #include "ndir.h"
  #else
--- 1,19 ----
  /*
   * $Log:	gnsys.c,v $
+  * Revision 1.2  87/07/01  16:25:05  gww
+  * Permit any white space in L.sys line as a separator.
+  * 
   * Revision 1.1  87/06/23  16:58:13  gww
   * Initial revision
   * 
   */
  #ifndef lint
! static char *ERcsId = "$Header: gnsys.c,v 1.2 87/07/01 16:25:05 gww Exp $ ENIX BSD";
  static char sccsid[] = "@(#)gnsys.c	5.4 (Berkeley) 6/20/85";
  #endif
  
  #include "uucp.h"
+ #include <ctype.h>
  #ifdef	NDIR
  #include "ndir.h"
  #else
***************
*** 94,102 ****
  			fp = fopen(SYSFILE, "r");
  			ASSERT(fp != NULL, CANTOPEN, SYSFILE, 0);
  			while (cfgets(line, sizeof(line), fp) != NULL) {
! 				p = index(line, ' ');
! 				if (p)
! 					*p = '\0';
  				if (strncmp(sname, line, SYSNSIZE) == SAME) {
  					strncpy(sname, line, MAXBASENAME);
  					break;
--- 98,107 ----
  			fp = fopen(SYSFILE, "r");
  			ASSERT(fp != NULL, CANTOPEN, SYSFILE, 0);
  			while (cfgets(line, sizeof(line), fp) != NULL) {
! 				p=line;
! 				while (!isspace(*p))
! 					p++;
! 				*p = '\0';
  				if (strncmp(sname, line, SYSNSIZE) == SAME) {
  					strncpy(sname, line, MAXBASENAME);
  					break;