From: millert Date: Fri, 17 Jan 1997 07:18:02 +0000 (+0000) Subject: more r?index -> strr?chr X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=08e8032d4e006b506a8232ddb762e2554acf6d8d;p=openbsd more r?index -> strr?chr --- diff --git a/usr.bin/patch/backupfile.c b/usr.bin/patch/backupfile.c index 1904a4e9b08..349ae84c082 100644 --- a/usr.bin/patch/backupfile.c +++ b/usr.bin/patch/backupfile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: backupfile.c,v 1.2 1996/06/10 11:21:25 niklas Exp $ */ +/* $OpenBSD: backupfile.c,v 1.3 1997/01/17 07:18:02 millert Exp $ */ /* backupfile.c -- make Emacs style backup file names Copyright (C) 1990 Free Software Foundation, Inc. @@ -14,7 +14,7 @@ Some algorithms adapted from GNU Emacs. */ #ifndef lint -static char rcsid[] = "$OpenBSD: backupfile.c,v 1.2 1996/06/10 11:21:25 niklas Exp $"; +static char rcsid[] = "$OpenBSD: backupfile.c,v 1.3 1997/01/17 07:18:02 millert Exp $"; #endif /* not lint */ #include @@ -215,7 +215,7 @@ basename (name) { char *base; - base = rindex (name, '/'); + base = strrchr (name, '/'); return base ? base + 1 : name; } @@ -232,7 +232,7 @@ dirname (path) char *slash; int length; /* Length of result, not including NUL. */ - slash = rindex (path, '/'); + slash = strrchr (path, '/'); if (slash == 0) { /* File is in the current directory. */ diff --git a/usr.bin/sup/src/scan.c b/usr.bin/sup/src/scan.c index e0098c048b1..0df6de17d7c 100644 --- a/usr.bin/sup/src/scan.c +++ b/usr.bin/sup/src/scan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scan.c,v 1.4 1996/07/31 11:11:24 niklas Exp $ */ +/* $OpenBSD: scan.c,v 1.5 1997/01/17 07:18:04 millert Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -30,6 +30,9 @@ ********************************************************************** * HISTORY * $Log: scan.c,v $ + * Revision 1.5 1997/01/17 07:18:04 millert + * more r?index -> strr?chr + * * Revision 1.4 1996/07/31 11:11:24 niklas * Better use time_t instead of long when dealing with times * @@ -322,9 +325,9 @@ char *release; rewound = TRUE; continue; } - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; q = nxtarg (&p," \t"); if (strcmp (q,release) != 0) continue; @@ -367,9 +370,9 @@ makescanlists () f = fopen (buf,"r"); if (f != NULL) { while (p = fgets (buf,sizeof(buf),f)) { - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; q = nxtarg (&p," \t"); (void) parserelease (&tl,q,p); if ((prefix = tl->TLprefix) == NULL) @@ -494,8 +497,8 @@ char *fname; if (f == NULL) goaway ("Can't read list file %s",fname); cdprefix (prefix); while (p = fgets (buf,sizeof(buf),f)) { - if (q = index (p,'\n')) *q = '\0'; - if (index ("#;:",*p)) continue; + if (q = strchr (p,'\n')) *q = '\0'; + if (strchr ("#;:",*p)) continue; q = nxtarg (&p," \t"); if (*q == '\0') continue; for (ltn = 0; ltname[ltn] && strcmp(q,ltname[ltn]) != 0; ltn++); @@ -854,7 +857,7 @@ char *scanfile; (void) fclose (f); return (FALSE); } - if (q = index (p,'\n')) *q = '\0'; + if (q = strchr (p,'\n')) *q = '\0'; if (*p++ != 'V') { (void) fclose (f); return (FALSE); @@ -871,7 +874,7 @@ char *scanfile; } notwanted = FALSE; while (p = fgets (buf,sizeof(buf),f)) { - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; ts.Tflags = 0; if (*p == 'X') { @@ -890,17 +893,17 @@ char *scanfile; p++; ts.Tflags |= FNOACCT; } - if ((q = index (p,' ')) == NULL) + if ((q = strchr (p,' ')) == NULL) goaway ("scanfile format inconsistant"); *q++ = '\0'; ts.Tmode = atoo (p); p = q; - if ((q = index (p,' ')) == NULL) + if ((q = strchr (p,' ')) == NULL) goaway ("scanfile format inconsistant"); *q++ = '\0'; ts.Tctime = atoi (p); p = q; - if ((q = index (p,' ')) == NULL) + if ((q = strchr (p,' ')) == NULL) goaway ("scanfile format inconsistant"); *q++ = 0; ts.Tmtime = atoi (p); diff --git a/usr.bin/sup/src/supcmain.c b/usr.bin/sup/src/supcmain.c index 83af14b5228..93f790a2ca8 100644 --- a/usr.bin/sup/src/supcmain.c +++ b/usr.bin/sup/src/supcmain.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supcmain.c,v 1.3 1996/07/31 11:11:27 niklas Exp $ */ +/* $OpenBSD: supcmain.c,v 1.4 1997/01/17 07:18:06 millert Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -176,6 +176,9 @@ * across the network to save BandWidth * * $Log: supcmain.c,v $ + * Revision 1.4 1997/01/17 07:18:06 millert + * more r?index -> strr?chr + * * Revision 1.3 1996/07/31 11:11:27 niklas * Better use time_t instead of long when dealing with times * @@ -662,9 +665,9 @@ char **argv; lastC = NULL; bogus = FALSE; while (p = fgets (buf,STRINGLENGTH,f)) { - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = '\0'; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; arg = nxtarg (&p," \t"); if (*arg == '\0') { logerr ("Missing collection name in supfile"); diff --git a/usr.bin/sup/src/supcmeat.c b/usr.bin/sup/src/supcmeat.c index 5f43a26b0c3..08053d88248 100644 --- a/usr.bin/sup/src/supcmeat.c +++ b/usr.bin/sup/src/supcmeat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supcmeat.c,v 1.3 1996/07/31 11:11:28 niklas Exp $ */ +/* $OpenBSD: supcmeat.c,v 1.4 1997/01/17 07:18:07 millert Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -34,6 +34,9 @@ * across the network to save BandWidth * * $Log: supcmeat.c,v $ + * Revision 1.4 1997/01/17 07:18:07 millert + * more r?index -> strr?chr + * * Revision 1.3 1996/07/31 11:11:28 niklas * Better use time_t instead of long when dealing with times * @@ -505,8 +508,8 @@ int listfiles () f = fopen (buf,"r"); if (f) { while (p = fgets (buf,STRINGLENGTH,f)) { - if (q = index (p,'\n')) *q = '\0'; - if (index ("#;:",*p)) continue; + if (q = strchr (p,'\n')) *q = '\0'; + if (strchr ("#;:",*p)) continue; (void) Tinsert (&lastT,p,FALSE); } (void) fclose (f); @@ -516,8 +519,8 @@ int listfiles () f = fopen (buf,"r"); if (f) { while (p = fgets (buf,STRINGLENGTH,f)) { - if (q = index (p,'\n')) *q = '\0'; - if (index ("#;:",*p)) continue; + if (q = strchr (p,'\n')) *q = '\0'; + if (strchr ("#;:",*p)) continue; (void) Tinsert (&refuseT,p,FALSE); } (void) fclose (f); diff --git a/usr.bin/sup/src/supcname.c b/usr.bin/sup/src/supcname.c index 1e9444637f5..88a96af6fa3 100644 --- a/usr.bin/sup/src/supcname.c +++ b/usr.bin/sup/src/supcname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supcname.c,v 1.2 1996/06/26 05:39:53 deraadt Exp $ */ +/* $OpenBSD: supcname.c,v 1.3 1997/01/17 07:18:08 millert Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -29,6 +29,9 @@ ********************************************************************** * HISTORY * $Log: supcname.c,v $ + * Revision 1.3 1997/01/17 07:18:08 millert + * more r?index -> strr?chr + * * Revision 1.2 1996/06/26 05:39:53 deraadt * rcsid * @@ -91,8 +94,8 @@ void getnams () f = fopen (buf,"r"); if (f == NULL) logquit (1,"Can't open %s",buf); while ((p = fgets (buf,STRINGLENGTH,f)) != NULL) { - if (q = index (p,'\n')) *q = '\0'; - if (index ("#;:",*p)) continue; + if (q = strchr (p,'\n')) *q = '\0'; + if (strchr ("#;:",*p)) continue; q = nxtarg (&p,"= \t"); p = skipover (p," \t"); if (*p == '=') p++; diff --git a/usr.bin/sup/src/supfilesrv.c b/usr.bin/sup/src/supfilesrv.c index c052fffa03b..6c96a48a6c8 100644 --- a/usr.bin/sup/src/supfilesrv.c +++ b/usr.bin/sup/src/supfilesrv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supfilesrv.c,v 1.5 1996/12/22 03:26:05 tholo Exp $ */ +/* $OpenBSD: supfilesrv.c,v 1.6 1997/01/17 07:18:10 millert Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -44,6 +44,9 @@ * across the network to save BandWidth * * $Log: supfilesrv.c,v $ + * Revision 1.6 1997/01/17 07:18:10 millert + * more r?index -> strr?chr + * * Revision 1.5 1996/12/22 03:26:05 tholo * Deal with _POSIX_SAVED_IDS when relinquishing privileges * @@ -540,7 +543,7 @@ char **argv; if (f == NULL) quit (1,"Unable to open cryptfile %s\n",cryptkey); if (p = fgets (buf,STRINGLENGTH,f)) { - if (q = index (p,'\n')) *q = '\0'; + if (q = strchr (p,'\n')) *q = '\0'; if (*p == '\0') quit (1,"No cryptkey found in %s\n",cryptkey); cryptkey = salloc (buf); @@ -756,9 +759,9 @@ setup () struct stat fsbuf; while (p = fgets (buf,STRINGLENGTH,f)) { - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; q = nxtarg (&p," \t"); if (*p == '\0') continue; if (!matchhost(q)) continue; @@ -809,9 +812,9 @@ setup () f = fopen (buf,"r"); if (f) { while (p = fgets (buf,STRINGLENGTH,f)) { - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; q = nxtarg (&p," \t="); if (strcmp(q,collname) == 0) { basedir = skipover(p," \t="); @@ -832,9 +835,9 @@ setup () f = fopen (buf,"r"); if (f) { while (p = fgets (buf,STRINGLENGTH,f)) { - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; prefix = salloc(p); if (chdir (prefix) < 0) goaway ("Can't chdir to %s from base directory %s", @@ -878,9 +881,9 @@ setup () int hostok = FALSE; while (p = fgets (buf,STRINGLENGTH,f)) { int not; - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; q = nxtarg (&p," \t"); if ((not = (*q == '!')) && *++q == '\0') q = nxtarg (&p," \t"); @@ -945,7 +948,7 @@ docrypt () if (cryptkey == NULL && (p = fgets (buf,STRINGLENGTH,f))) { - if (q = index (p,'\n')) *q = '\0'; + if (q = strchr (p,'\n')) *q = '\0'; if (*p) cryptkey = salloc (buf); } if (local_file(fileno(f), &fsbuf) > 0 @@ -1522,10 +1525,10 @@ int fileuid,filegid; 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') account = NULL; diff --git a/usr.bin/sup/src/supscan.c b/usr.bin/sup/src/supscan.c index 9df754ec078..a46c384c2cd 100644 --- a/usr.bin/sup/src/supscan.c +++ b/usr.bin/sup/src/supscan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supscan.c,v 1.3 1996/07/31 11:11:35 niklas Exp $ */ +/* $OpenBSD: supscan.c,v 1.4 1997/01/17 07:18:11 millert Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -41,6 +41,9 @@ ********************************************************************** * HISTORY * $Log: supscan.c,v $ + * Revision 1.4 1997/01/17 07:18:11 millert + * more r?index -> strr?chr + * * Revision 1.3 1996/07/31 11:11:35 niklas * Better use time_t instead of long when dealing with times * @@ -276,9 +279,9 @@ char **argv; 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)) continue; + if (strchr ("#;:",*p)) continue; collname = nxtarg (&p," \t="); p = skipover (p," \t="); if (!localhost (p)) continue; @@ -295,9 +298,9 @@ char **argv; if ((f = fopen (filename,"r")) == NULL) quit (1,"supscan: Unable to open %s\n",filename); while (p = fgets (buf,STRINGLENGTH,f)) { - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; q = nxtarg (&p," \t="); p = skipover (p," \t="); *c = getcoll(filename,salloc (q),salloc (p)); @@ -323,9 +326,9 @@ register char *filename,*collname,*basedir; if (basedir == NULL) { if (f = fopen (filename,"r")) { while (p = fgets (buf,STRINGLENGTH,f)) { - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; q = nxtarg (&p," \t="); if (strcmp (q,collname) == 0) { p = skipover (p," \t="); @@ -349,9 +352,9 @@ register char *filename,*collname,*basedir; (void) sprintf (buf,FILEPREFIX,collname); if (f = fopen (buf,"r")) { while (p = fgets (buf,STRINGLENGTH,f)) { - q = index (p,'\n'); + q = strchr (p,'\n'); if (q) *q = 0; - if (index ("#;:",*p)) continue; + if (strchr ("#;:",*p)) continue; prefix = salloc (p); if (chdir(prefix) < 0) { fprintf (stderr,"supscan: can't chdir to %s from base directory %s for %s\n",