-/* $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.
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 <stdio.h>
{
char *base;
- base = rindex (name, '/');
+ base = strrchr (name, '/');
return base ? base + 1 : name;
}
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. */
-/* $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
**********************************************************************
* 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
*
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;
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)
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++);
(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);
}
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') {
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);
-/* $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
* 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
*
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");
-/* $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
* 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
*
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);
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);
-/* $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
**********************************************************************
* 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
*
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++;
-/* $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
* 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
*
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);
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;
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=");
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",
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");
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
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;
-/* $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
**********************************************************************
* 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
*
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;
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));
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=");
(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",