Subject: port-amiga/4545: grfconfig problem with upper case chars for the flags field
To: None <gnats-bugs@gnats.netbsd.org, bernd@arresum.inka.de>
From: Bernd Ernesti <bernd@arresum.inka.de>
List: netbsd-bugs
Date: 11/19/1997 21:43:09
>Number:         4545
>Category:       port-amiga
>Synopsis:       grfconfig problem with upper case chars for the flags field
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 19 12:50:01 1997
>Last-Modified:
>Originator:     Bernd Ernesti
>Organization:
	
>Release:        NetBSD-current
>Environment:
	
System: NetBSD arresum 1.3_ALPHA NetBSD 1.3_ALPHA (VEEGO) #612: Thu Nov 13 20:09:14 MET 1997 bernd@arresum:/home/work/obj_amiga/src/sys/arch/amiga/compile/VEEGO amiga


>Description:
	grfconfig use strstr which doesn't ignore the case of a string,
	so you can't use upper case chars for the flags field.
>How-To-Repeat:
	man strstr
>Fix:
	Implement a case ignoring strstr function
	or apply this patch (which has the additional feature
	to ignore all chars behing a # in the middle of a line):

*** grfconfig.c-orig	Sat Oct 18 16:59:07 1997
--- grfconfig.c	Wed Nov 19 18:28:39 1997
***************
*** 91,97 ****
  	char	rawdata = 0, testmode = 0;
  	char	*grfdevice = 0;
  	char	*modefile = 0;
! 	char	buf[_POSIX2_LINE_MAX], obuf[_POSIX2_LINE_MAX];
  	char	*cps[31];
  	char	*p;
  	char	*errortext;
--- 91,97 ----
  	char	rawdata = 0, testmode = 0;
  	char	*grfdevice = 0;
  	char	*modefile = 0;
! 	char	buf[_POSIX2_LINE_MAX];
  	char	*cps[31];
  	char	*p;
  	char	*errortext;
***************
*** 137,142 ****
--- 137,143 ----
  			return (1);
  		}
  		while (fgets(buf, sizeof(buf), fp)) {
+ 			char *obuf, tbuf[_POSIX2_LINE_MAX], *tbuf2;
  			/*
  			 * check for end-of-section, comments, strip off trailing
  			 * spaces and newline character.
***************
*** 149,155 ****
  				continue;
  			*++p = '\0';
  
! 			sprintf(obuf, "%s", buf);
  			lineno = lineno + 1;
  
  			for (i = 0, *cps = strtok(buf, " \b\t\r\n");
--- 150,170 ----
  				continue;
  			*++p = '\0';
  
! 			obuf = buf;
! 			tbuf2 = tbuf;
! 			while ((*tbuf2 = *obuf) != '\0') {
! 				if (*tbuf2 == '#') {
! 					*tbuf2 = '\0';
! 					break;
! 				}
! 				if (isupper(*tbuf2)) {
! 					*tbuf2 = tolower(*tbuf2);
! 				}
! 				obuf++;
! 				tbuf2++;
! 			}
! 			obuf = tbuf;
! 
  			lineno = lineno + 1;
  
  			for (i = 0, *cps = strtok(buf, " \b\t\r\n");
>Audit-Trail:
>Unformatted: