Module Name:    src
Committed By:   christos
Date:           Sat Oct 17 20:46:03 UTC 2009

Modified Files:
        src/usr.sbin/sup/source: scan.c stree.c supcmain.c supcmeat.c
            supcname.c supfilesrv.c supscan.c

Log Message:
change to strchr and strrchr


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/sup/source/scan.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sup/source/stree.c
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/sup/source/supcmain.c
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/sup/source/supcmeat.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sup/source/supcname.c
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sup/source/supfilesrv.c
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/sup/source/supscan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sup/source/scan.c
diff -u src/usr.sbin/sup/source/scan.c:1.26 src/usr.sbin/sup/source/scan.c:1.27
--- src/usr.sbin/sup/source/scan.c:1.26	Thu Dec 20 15:15:59 2007
+++ src/usr.sbin/sup/source/scan.c	Sat Oct 17 16:46:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: scan.c,v 1.26 2007/12/20 20:15:59 christos Exp $	*/
+/*	$NetBSD: scan.c,v 1.27 2009/10/17 20:46:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -297,10 +297,10 @@
 				rewound = TRUE;
 				continue;
 			}
-			q = index(p, '\n');
+			q = strchr(p, '\n');
 			if (q)
 				*q = 0;
-			if (index("#;:", *p))
+			if (strchr("#;:", *p))
 				continue;
 			q = nxtarg(&p, " \t");
 			if (strcmp(q, release) != 0)
@@ -357,10 +357,10 @@
 	f = fopen(buf, "r");
 	if (f != NULL) {
 		while ((p = fgets(buf, sizeof(buf), f)) != NULL) {
-			q = index(p, '\n');
+			q = strchr(p, '\n');
 			if (q)
 				*q = 0;
-			if (index("#;:", *p))
+			if (strchr("#;:", *p))
 				continue;
 			q = nxtarg(&p, " \t");
 			(void) parserelease(&tl, q, p);
@@ -481,9 +481,9 @@
 		goaway("Can't read list file %s", fname);
 	cdprefix(prefix);
 	while ((p = fgets(buf, sizeof(buf), f)) != NULL) {
-		if ((q = index(p, '\n')) != NULL)
+		if ((q = strchr(p, '\n')) != NULL)
 			*q = '\0';
-		if (index("#;:", *p))
+		if (strchr("#;:", *p))
 			continue;
 		q = nxtarg(&p, " \t");
 		if (*q == '\0')
@@ -851,7 +851,7 @@
 		(void) fclose(f);
 		return (FALSE);
 	}
-	if ((q = index(p, '\n')) != NULL)
+	if ((q = strchr(p, '\n')) != NULL)
 		*q = '\0';
 	if (*p++ != 'V') {
 		(void) fclose(f);
@@ -869,7 +869,7 @@
 	}
 	notwanted = FALSE;
 	while ((p = fgets(buf, sizeof(buf), f)) != NULL) {
-		q = index(p, '\n');
+		q = strchr(p, '\n');
 		if (q)
 			*q = 0;
 		ts.Tflags = 0;
@@ -890,17 +890,17 @@
 			p++;
 			ts.Tflags |= FNOACCT;
 		}
-		if ((q = index(p, ' ')) == NULL)
+		if ((q = strchr(p, ' ')) == NULL)
 			goaway("scanfile format inconsistent");
 		*q++ = '\0';
 		ts.Tmode = atoo(p);
 		p = q;
-		if ((q = index(p, ' ')) == NULL)
+		if ((q = strchr(p, ' ')) == NULL)
 			goaway("scanfile format inconsistent");
 		*q++ = '\0';
 		ts.Tctime = atoi(p);
 		p = q;
-		if ((q = index(p, ' ')) == NULL)
+		if ((q = strchr(p, ' ')) == NULL)
 			goaway("scanfile format inconsistent");
 		*q++ = 0;
 		ts.Tmtime = atoi(p);

Index: src/usr.sbin/sup/source/stree.c
diff -u src/usr.sbin/sup/source/stree.c:1.13 src/usr.sbin/sup/source/stree.c:1.14
--- src/usr.sbin/sup/source/stree.c:1.13	Fri Oct 16 08:41:37 2009
+++ src/usr.sbin/sup/source/stree.c	Sat Oct 17 16:46:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: stree.c,v 1.13 2009/10/16 12:41:37 christos Exp $	*/
+/*	$NetBSD: stree.c,v 1.14 2009/10/17 20:46:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -280,7 +280,7 @@
 		return (x);
 	(void) strncpy(buf, p, sizeof(buf) - 1);
 	buf[MAXPATHLEN] = '\0';
-	while ((q = rindex(buf, '/')) != NULL) {
+	while ((q = strrchr(buf, '/')) != NULL) {
 		while (q >= buf && *(q - 1) == '/')
 			q--;
 		if (q == buf)

Index: src/usr.sbin/sup/source/supcmain.c
diff -u src/usr.sbin/sup/source/supcmain.c:1.29 src/usr.sbin/sup/source/supcmain.c:1.30
--- src/usr.sbin/sup/source/supcmain.c:1.29	Fri Oct 16 18:45:18 2009
+++ src/usr.sbin/sup/source/supcmain.c	Sat Oct 17 16:46:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: supcmain.c,v 1.29 2009/10/16 22:45:18 christos Exp $	*/
+/*	$NetBSD: supcmain.c,v 1.30 2009/10/17 20:46:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -671,7 +671,7 @@
 	lastC = NULL;
 	bogus = FALSE;
 	while ((p = read_line(f, NULL, NULL, NULL, 0)) != NULL) {
-		if (index("#;:", *p))
+		if (strchr("#;:", *p))
 			continue;
 		arg = nxtarg(&p, " \t");
 		if (*arg == '\0') {

Index: src/usr.sbin/sup/source/supcmeat.c
diff -u src/usr.sbin/sup/source/supcmeat.c:1.36 src/usr.sbin/sup/source/supcmeat.c:1.37
--- src/usr.sbin/sup/source/supcmeat.c:1.36	Fri Oct 16 18:45:18 2009
+++ src/usr.sbin/sup/source/supcmeat.c	Sat Oct 17 16:46:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: supcmeat.c,v 1.36 2009/10/16 22:45:18 christos Exp $	*/
+/*	$NetBSD: supcmeat.c,v 1.37 2009/10/17 20:46:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -489,9 +489,9 @@
 	f = fopen(buf, "r");
 	if (f) {
 		while ((p = fgets(buf, STRINGLENGTH, f))) {
-			if ((q = index(p, '\n')))
+			if ((q = strchr(p, '\n')))
 				*q = '\0';
-			if (index("#;:", *p))
+			if (strchr("#;:", *p))
 				continue;
 			(void) Tinsert(&lastT, p, FALSE);
 		}
@@ -502,9 +502,9 @@
 	f = fopen(buf, "r");
 	if (f) {
 		while ((p = fgets(buf, STRINGLENGTH, f))) {
-			if ((q = index(p, '\n')))
+			if ((q = strchr(p, '\n')))
 				*q = '\0';
-			if (index("#;:", *p))
+			if (strchr("#;:", *p))
 				continue;
 			(void) Tinsert(&refuseT, p, FALSE);
 		}

Index: src/usr.sbin/sup/source/supcname.c
diff -u src/usr.sbin/sup/source/supcname.c:1.6 src/usr.sbin/sup/source/supcname.c:1.7
--- src/usr.sbin/sup/source/supcname.c:1.6	Wed Jul 10 16:19:45 2002
+++ src/usr.sbin/sup/source/supcname.c	Sat Oct 17 16:46:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: supcname.c,v 1.6 2002/07/10 20:19:45 wiz Exp $	*/
+/*	$NetBSD: supcname.c,v 1.7 2009/10/17 20:46:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -82,9 +82,9 @@
 	if (f == NULL)
 		logquit(1, "Can't open %s", buf);
 	while ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
-		if ((q = index(p, '\n')) != NULL)
+		if ((q = strchr(p, '\n')) != NULL)
 			*q = '\0';
-		if (index("#;:", *p))
+		if (strchr("#;:", *p))
 			continue;
 		q = nxtarg(&p, "= \t");
 		p = skipover(p, " \t");

Index: src/usr.sbin/sup/source/supfilesrv.c
diff -u src/usr.sbin/sup/source/supfilesrv.c:1.42 src/usr.sbin/sup/source/supfilesrv.c:1.43
--- src/usr.sbin/sup/source/supfilesrv.c:1.42	Fri Oct 16 08:41:37 2009
+++ src/usr.sbin/sup/source/supfilesrv.c	Sat Oct 17 16:46:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: supfilesrv.c,v 1.42 2009/10/16 12:41:37 christos Exp $	*/
+/*	$NetBSD: supfilesrv.c,v 1.43 2009/10/17 20:46:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -600,7 +600,7 @@
 	if (f == NULL)
 		quit(1, "Unable to open cryptfile %s\n", cryptkey);
 	if ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
-		if ((q = index(p, '\n')) != NULL)
+		if ((q = strchr(p, '\n')) != NULL)
 			*q = '\0';
 		if (*p == '\0')
 			quit(1, "No cryptkey found in %s\n", cryptkey);
@@ -829,10 +829,10 @@
 				struct stat fsbuf;
 
 				while ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
-					q = index(p, '\n');
+					q = strchr(p, '\n');
 					if (q)
 						*q = 0;
-					if (index("#;:", *p))
+					if (strchr("#;:", *p))
 						continue;
 					q = nxtarg(&p, " \t");
 					if (*p == '\0')
@@ -886,10 +886,10 @@
 		f = fopen(buf, "r");
 		if (f) {
 			while ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
-				q = index(p, '\n');
+				q = strchr(p, '\n');
 				if (q)
 					*q = 0;
-				if (index("#;:", *p))
+				if (strchr("#;:", *p))
 					continue;
 				q = nxtarg(&p, " \t=");
 				if (strcmp(q, collname) == 0) {
@@ -911,10 +911,10 @@
 	f = fopen(buf, "r");
 	if (f) {
 		while ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
-			q = index(p, '\n');
+			q = strchr(p, '\n');
 			if (q)
 				*q = 0;
-			if (index("#;:", *p))
+			if (strchr("#;:", *p))
 				continue;
 			prefix = estrdup(p);
 			if (chdir(prefix) < 0)
@@ -963,10 +963,10 @@
 			int hostok = FALSE;
 			while ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
 				int not;
-				q = index(p, '\n');
+				q = strchr(p, '\n');
 				if (q)
 					*q = 0;
-				if (index("#;:", *p))
+				if (strchr("#;:", *p))
 					continue;
 				q = nxtarg(&p, " \t");
 				if ((not = (*q == '!')) && *++q == '\0')
@@ -1039,7 +1039,7 @@
 
 				if (cryptkey == NULL &&
 				    (p = fgets(buf, STRINGLENGTH, f))) {
-					if ((q = index(p, '\n')) != NULL)
+					if ((q = strchr(p, '\n')) != NULL)
 						*q = '\0';
 					if (*p)
 						cryptkey = estrdup(buf);
@@ -1633,10 +1633,10 @@
 		pswdp = NULL;
 	} else {
 		(void) strcpy(nbuf, namep);
-		account = group = index(nbuf, ',');
+		account = group = strchr(nbuf, ',');
 		if (group != NULL) {
 			*group++ = '\0';
-			account = index(group, ',');
+			account = strchr(group, ',');
 			if (account != NULL) {
 				*account++ = '\0';
 				if (*account == '\0')

Index: src/usr.sbin/sup/source/supscan.c
diff -u src/usr.sbin/sup/source/supscan.c:1.17 src/usr.sbin/sup/source/supscan.c:1.18
--- src/usr.sbin/sup/source/supscan.c:1.17	Fri Oct 16 18:45:18 2009
+++ src/usr.sbin/sup/source/supscan.c	Sat Oct 17 16:46:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: supscan.c,v 1.17 2009/10/16 22:45:18 christos Exp $	*/
+/*	$NetBSD: supscan.c,v 1.18 2009/10/17 20:46:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -285,10 +285,10 @@
 		if ((f = fopen(buf, "r")) == NULL)
 			quit(1, "supscan: Unable to open %s\n", buf);
 		while ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
-			q = index(p, '\n');
+			q = strchr(p, '\n');
 			if (q)
 				*q = 0;
-			if (index("#;:", *p))
+			if (strchr("#;:", *p))
 				continue;
 			collname = nxtarg(&p, " \t=");
 			p = skipover(p, " \t=");
@@ -308,10 +308,10 @@
 		if ((f = fopen(filename, "r")) == NULL)
 			quit(1, "supscan: Unable to open %s\n", filename);
 		while ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
-			q = index(p, '\n');
+			q = strchr(p, '\n');
 			if (q)
 				*q = 0;
-			if (index("#;:", *p))
+			if (strchr("#;:", *p))
 				continue;
 			q = nxtarg(&p, " \t=");
 			p = skipover(p, " \t=");
@@ -338,10 +338,10 @@
 	if (basedir == NULL) {
 		if ((f = fopen(filename, "r")) != NULL) {
 			while ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
-				q = index(p, '\n');
+				q = strchr(p, '\n');
 				if (q)
 					*q = 0;
-				if (index("#;:", *p))
+				if (strchr("#;:", *p))
 					continue;
 				q = nxtarg(&p, " \t=");
 				if (strcmp(q, collname) == 0) {
@@ -366,10 +366,10 @@
 	(void) sprintf(buf, FILEPREFIX, collname);
 	if ((f = fopen(buf, "r")) != NULL) {
 		while ((p = fgets(buf, STRINGLENGTH, f)) != NULL) {
-			q = index(p, '\n');
+			q = strchr(p, '\n');
 			if (q)
 				*q = 0;
-			if (index("#;:", *p))
+			if (strchr("#;:", *p))
 				continue;
 			prefix = estrdup(p);
 			if (chdir(prefix) < 0) {

Reply via email to