summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmadeusz Sławiński (amade) <amade@asmblr.net>2011-01-05 21:02:41 +0100
committerAmadeusz Sławiński <amade@asmblr.net>2014-05-15 17:34:18 +0200
commita55e91e78ecf4fd8acd891399161690890e773c5 (patch)
tree2bade9adf673915527de8486b5b9e1269da1ff2c
parent044aa7680303a1ddf11d890fc7eaa0e84e8bf2a0 (diff)
downloadscreen-a55e91e78ecf4fd8acd891399161690890e773c5.tar.gz
replace (r)index with str(r)chr
-rw-r--r--src/ansi.c2
-rw-r--r--src/attacher.c4
-rw-r--r--src/fileio.c8
-rw-r--r--src/help.c4
-rw-r--r--src/process.c4
-rw-r--r--src/screen.c6
-rw-r--r--src/termcap.c2
-rw-r--r--src/tty.sh4
-rw-r--r--src/window.c8
9 files changed, 21 insertions, 21 deletions
diff --git a/src/ansi.c b/src/ansi.c
index a5fa0ac..0fb7ae6 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -1405,7 +1405,7 @@ StringEnd()
switch (curr->w_StringType)
{
case OSC: /* special xterm compatibility hack */
- if (curr->w_string[0] == ';' || (p = index(curr->w_string, ';')) == 0)
+ if (curr->w_string[0] == ';' || (p = strchr(curr->w_string, ';')) == 0)
break;
typ = atoi(curr->w_string);
p++;
diff --git a/src/attacher.c b/src/attacher.c
index 014e975..d857314 100644
--- a/src/attacher.c
+++ b/src/attacher.c
@@ -863,9 +863,9 @@ screen_builtin_lck()
strncpy(fullname, ppp->pw_gecos, sizeof(fullname) - 9);
fullname[sizeof(fullname) - 9] = 0;
- if ((cp1 = index(fullname, ',')) != NULL)
+ if ((cp1 = strchr(fullname, ',')) != NULL)
*cp1 = '\0';
- if ((cp1 = index(fullname, '&')) != NULL)
+ if ((cp1 = strchr(fullname, '&')) != NULL)
{
strncpy(cp1, ppp->pw_name, 8);
cp1[8] = 0;
diff --git a/src/fileio.c b/src/fileio.c
index 0da1e1f..a8d27c1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -132,7 +132,7 @@ findrcfile(char *rcfile)
if (rcfile)
{
- char *rcend = rindex(rc_name, '/');
+ char *rcend = strrchr(rc_name, '/');
if (*rcfile != '/' && rcend && (rcend - rc_name) + strlen(rcfile) + 2 < sizeof(buf))
{
strncpy(buf, rc_name, rcend - rc_name + 1);
@@ -206,7 +206,7 @@ StartRc(char *rcfilename, int nopanic)
}
while (fgets(buf, sizeof buf, fp) != NULL)
{
- if ((p = rindex(buf, '\n')) != NULL)
+ if ((p = strrchr(buf, '\n')) != NULL)
*p = '\0';
if ((argc = Parse(buf, sizeof buf, args, argl)) == 0)
continue;
@@ -253,7 +253,7 @@ StartRc(char *rcfilename, int nopanic)
}
for (p = args[1]; p && *p; p = cp)
{
- if ((cp = index(p, '|')) != 0)
+ if ((cp = strchr(p, '|')) != 0)
*cp++ = '\0';
len = strlen(p);
if (p[len - 1] == '*')
@@ -513,7 +513,7 @@ WriteFile(struct acluser *user, char *fn, int dump)
}
break;
case DUMP_TERMCAP:
- if ((p = index(MakeTermcap(fore->w_aflag), '=')) != NULL)
+ if ((p = strchr(MakeTermcap(fore->w_aflag), '=')) != NULL)
{
fputs(++p, f);
putc('\n', f);
diff --git a/src/help.c b/src/help.c
index 41475e3..0c91a39 100644
--- a/src/help.c
+++ b/src/help.c
@@ -391,9 +391,9 @@ AddAction(struct action *act, int x, int y)
del = 0;
bp = buf;
ll = *lp++;
- if (!ll || (index(cp, ' ') != NULL))
+ if (!ll || (strchr(cp, ' ') != NULL))
{
- if (index(cp, '\'') != NULL)
+ if (strchr(cp, '\'') != NULL)
*bp++ = del = '"';
else
*bp++ = del = '\'';
diff --git a/src/process.c b/src/process.c
index a7e9f30..2506467 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4092,7 +4092,7 @@ DoAction(struct action *act, int key)
s = 0;
if (ParseSaveStr(act, &s))
break;
- if (!*s || strlen(s) + (SockName - SockPath) > MAXPATHLEN - 13 || index(s, '/'))
+ if (!*s || strlen(s) + (SockName - SockPath) > MAXPATHLEN - 13 || strchr(s, '/'))
{
OutputMsg(0, "%s: bad session name '%s'\n", rc_name, s);
free(s);
@@ -6034,7 +6034,7 @@ int
IsNumColon(char *s, int base, char *p, int psize)
{
char *q;
- if ((q = rindex(s, ':')) != 0)
+ if ((q = strrchr(s, ':')) != 0)
{
strncpy(p, q + 1, psize - 1);
p[psize - 1] = '\0';
diff --git a/src/screen.c b/src/screen.c
index 0427db5..b239320 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -817,7 +817,7 @@ main(int argc, char **argv)
#endif
own_uid = multi_uid = real_uid;
- if (SockMatch && (sockp = index(SockMatch, '/')))
+ if (SockMatch && (sockp = strchr(SockMatch, '/')))
{
*sockp = 0;
multi = SockMatch;
@@ -1048,7 +1048,7 @@ main(int argc, char **argv)
}
if ((st.st_mode & 0777) != 0700)
Panic(0, "Directory %s must have mode 700.", SockPath);
- if (SockMatch && index(SockMatch, '/'))
+ if (SockMatch && strchr(SockMatch, '/'))
Panic(0, "Bad session name '%s'", SockMatch);
SockName = SockPath + strlen(SockPath) + 1;
*SockName = 0;
@@ -1064,7 +1064,7 @@ main(int argc, char **argv)
(void) gethostname(HostName, MAXSTR);
HostName[MAXSTR - 1] = '\0';
#endif
- if ((ap = index(HostName, '.')) != NULL)
+ if ((ap = strchr(HostName, '.')) != NULL)
*ap = '\0';
if (lsflag)
diff --git a/src/termcap.c b/src/termcap.c
index fc43ecd..014f130 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -885,7 +885,7 @@ MakeTermcap(int aflag)
debug1("MakeTermcap decided '%s'\n", p);
if (extra_outcap && *extra_outcap)
{
- for (cp = extra_outcap; (p = index(cp, ':')); cp = p)
+ for (cp = extra_outcap; (p = strchr(cp, ':')); cp = p)
{
ch = *++p;
*p = '\0';
diff --git a/src/tty.sh b/src/tty.sh
index a6c30fd..407919c 100644
--- a/src/tty.sh
+++ b/src/tty.sh
@@ -671,7 +671,7 @@ char *opt;
while (*opt)
{
- while (index(sep, *opt)) opt++;
+ while (strchr(sep, *opt)) opt++;
if (*opt >= '0' && *opt <= '9')
{
if (SetBaud(m, atoi(opt), atoi(opt)))
@@ -757,7 +757,7 @@ char *opt;
}
else
return -1;
- while (*opt && !index(sep, *opt)) opt++;
+ while (*opt && !strchr(sep, *opt)) opt++;
}
return 0;
}
diff --git a/src/window.c b/src/window.c
index 6d4f035..294d858 100644
--- a/src/window.c
+++ b/src/window.c
@@ -621,7 +621,7 @@ MakeWindow(struct NewWindow *newwin)
if (!nwin.aka)
nwin.aka = Filename(nwin.args[0]);
strncpy(p->w_akabuf, nwin.aka, sizeof(p->w_akabuf) - 1);
- if ((nwin.aka = rindex(p->w_akabuf, '|')) != NULL)
+ if ((nwin.aka = strrchr(p->w_akabuf, '|')) != NULL)
{
p->w_autoaka = 0;
*nwin.aka++ = 0;
@@ -1305,9 +1305,9 @@ ForkWindow(struct win *win, char **args, char *ttyn)
debug2("Makewindow %d with %s\n", win->w_number, tebuf);
tl = strlen(win->w_term);
NewEnv[1] = tebuf;
- if ((s1 = index(NewEnv[2], '|')))
+ if ((s1 = strchr(NewEnv[2], '|')))
{
- if ((s2 = index(++s1, '|')))
+ if ((s2 = strchr(++s1, '|')))
{
if (strlen(NewEnv[2]) - (s2 - s1) + tl < 1024)
{
@@ -1345,7 +1345,7 @@ execvpe(char *prog, char **args, char **env)
char *shargs[MAXARGS + 1];
register int i, eaccess = 0;
- if (rindex(prog, '/'))
+ if (strrchr(prog, '/'))
path = "";
if (!path && !(path = getenv("PATH")))
path = DefaultPath;