Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sup/source change to strchr and strrchr



details:   https://anonhg.NetBSD.org/src/rev/5381fa8108ce
branches:  trunk
changeset: 748225:5381fa8108ce
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 17 20:46:03 2009 +0000

description:
change to strchr and strrchr

diffstat:

 usr.sbin/sup/source/scan.c       |  24 ++++++++++++------------
 usr.sbin/sup/source/stree.c      |   4 ++--
 usr.sbin/sup/source/supcmain.c   |   4 ++--
 usr.sbin/sup/source/supcmeat.c   |  10 +++++-----
 usr.sbin/sup/source/supcname.c   |   6 +++---
 usr.sbin/sup/source/supfilesrv.c |  26 +++++++++++++-------------
 usr.sbin/sup/source/supscan.c    |  18 +++++++++---------
 7 files changed, 46 insertions(+), 46 deletions(-)

diffs (truncated from 329 to 300 lines):

diff -r bc5efb62bf8f -r 5381fa8108ce usr.sbin/sup/source/scan.c
--- a/usr.sbin/sup/source/scan.c        Sat Oct 17 20:35:52 2009 +0000
+++ b/usr.sbin/sup/source/scan.c        Sat Oct 17 20:46:03 2009 +0000
@@ -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);
diff -r bc5efb62bf8f -r 5381fa8108ce usr.sbin/sup/source/stree.c
--- a/usr.sbin/sup/source/stree.c       Sat Oct 17 20:35:52 2009 +0000
+++ b/usr.sbin/sup/source/stree.c       Sat Oct 17 20:46:03 2009 +0000
@@ -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)
diff -r bc5efb62bf8f -r 5381fa8108ce usr.sbin/sup/source/supcmain.c
--- a/usr.sbin/sup/source/supcmain.c    Sat Oct 17 20:35:52 2009 +0000
+++ b/usr.sbin/sup/source/supcmain.c    Sat Oct 17 20:46:03 2009 +0000
@@ -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') {
diff -r bc5efb62bf8f -r 5381fa8108ce usr.sbin/sup/source/supcmeat.c
--- a/usr.sbin/sup/source/supcmeat.c    Sat Oct 17 20:35:52 2009 +0000
+++ b/usr.sbin/sup/source/supcmeat.c    Sat Oct 17 20:46:03 2009 +0000
@@ -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);
                }
diff -r bc5efb62bf8f -r 5381fa8108ce usr.sbin/sup/source/supcname.c
--- a/usr.sbin/sup/source/supcname.c    Sat Oct 17 20:35:52 2009 +0000
+++ b/usr.sbin/sup/source/supcname.c    Sat Oct 17 20:46:03 2009 +0000
@@ -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");
diff -r bc5efb62bf8f -r 5381fa8108ce usr.sbin/sup/source/supfilesrv.c
--- a/usr.sbin/sup/source/supfilesrv.c  Sat Oct 17 20:35:52 2009 +0000
+++ b/usr.sbin/sup/source/supfilesrv.c  Sat Oct 17 20:46:03 2009 +0000
@@ -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')
diff -r bc5efb62bf8f -r 5381fa8108ce usr.sbin/sup/source/supscan.c
--- a/usr.sbin/sup/source/supscan.c     Sat Oct 17 20:35:52 2009 +0000
+++ b/usr.sbin/sup/source/supscan.c     Sat Oct 17 20:46:03 2009 +0000
@@ -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))



Home | Main Index | Thread Index | Old Index