summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cksum/cksum.c2
-rw-r--r--usr.bin/compress/compress.c6
-rw-r--r--usr.bin/finger/finger.c2
-rw-r--r--usr.bin/hexdump/display.c2
-rw-r--r--usr.bin/hexdump/hexdump.c2
-rw-r--r--usr.bin/hexdump/hexsyntax.c2
-rw-r--r--usr.bin/hexdump/parse.c8
-rw-r--r--usr.bin/locate/locate/fastfind.c2
-rw-r--r--usr.bin/locate/locate/util.c8
-rw-r--r--usr.bin/netstat/if.c2
-rw-r--r--usr.bin/netstat/inet.c2
-rw-r--r--usr.bin/netstat/inet6.c6
-rw-r--r--usr.bin/netstat/sctp.c6
-rw-r--r--usr.bin/rlogin/rlogin.c2
-rw-r--r--usr.bin/rpcgen/rpc_main.c8
-rw-r--r--usr.bin/systat/devs.c2
-rw-r--r--usr.bin/systat/netcmds.c2
-rw-r--r--usr.bin/systat/netstat.c4
-rw-r--r--usr.bin/tftp/main.c14
-rw-r--r--usr.bin/tr/str.c2
-rw-r--r--usr.bin/tset/map.c2
-rw-r--r--usr.bin/tset/term.c4
-rw-r--r--usr.bin/tset/wrterm.c2
23 files changed, 44 insertions, 48 deletions
diff --git a/usr.bin/cksum/cksum.c b/usr.bin/cksum/cksum.c
index dacf572..05dc8bb 100644
--- a/usr.bin/cksum/cksum.c
+++ b/usr.bin/cksum/cksum.c
@@ -68,7 +68,7 @@ main(int argc, char **argv)
int (*cfncn)(int, uint32_t *, off_t *);
void (*pfncn)(char *, uint32_t, off_t);
- if ((p = rindex(argv[0], '/')) == NULL)
+ if ((p = strrchr(argv[0], '/')) == NULL)
p = argv[0];
else
++p;
diff --git a/usr.bin/compress/compress.c b/usr.bin/compress/compress.c
index f73419d..1f458e5 100644
--- a/usr.bin/compress/compress.c
+++ b/usr.bin/compress/compress.c
@@ -75,7 +75,7 @@ main(int argc, char *argv[])
char *p, newname[MAXPATHLEN];
cat = 0;
- if ((p = rindex(argv[0], '/')) == NULL)
+ if ((p = strrchr(argv[0], '/')) == NULL)
p = argv[0];
else
++p;
@@ -141,7 +141,7 @@ main(int argc, char *argv[])
compress(*argv, "/dev/stdout", bits);
break;
}
- if ((p = rindex(*argv, '.')) != NULL &&
+ if ((p = strrchr(*argv, '.')) != NULL &&
!strcmp(p, ".Z")) {
cwarnx("%s: name already has trailing .Z",
*argv);
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
break;
}
len = strlen(*argv);
- if ((p = rindex(*argv, '.')) == NULL ||
+ if ((p = strrchr(*argv, '.')) == NULL ||
strcmp(p, ".Z")) {
if (len > sizeof(newname) - 3) {
cwarnx("%s: name too long", *argv);
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index 2704a96..7519f15 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -287,7 +287,7 @@ userlist(int argc, char **argv)
/* Pull out all network requests. */
for (ap = p = argv, np = nargv; *p; ++p)
- if (index(*p, '@'))
+ if (strchr(*p, '@'))
*np++ = *p;
else
*ap++ = *p;
diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c
index 991509d..a5f2a47 100644
--- a/usr.bin/hexdump/display.c
+++ b/usr.bin/hexdump/display.c
@@ -220,7 +220,7 @@ bpad(PR *pr)
pr->cchar[0] = 's';
pr->cchar[1] = '\0';
for (p1 = pr->fmt; *p1 != '%'; ++p1);
- for (p2 = ++p1; *p1 && index(spec, *p1); ++p1);
+ for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
while ((*p2++ = *p1++));
}
diff --git a/usr.bin/hexdump/hexdump.c b/usr.bin/hexdump/hexdump.c
index c3aaab5..d3c4bb5 100644
--- a/usr.bin/hexdump/hexdump.c
+++ b/usr.bin/hexdump/hexdump.c
@@ -61,7 +61,7 @@ main(int argc, char *argv[])
(void)setlocale(LC_ALL, "");
- if (!(p = rindex(argv[0], 'o')) || strcmp(p, "od"))
+ if (!(p = strrchr(argv[0], 'o')) || strcmp(p, "od"))
newsyntax(argc, &argv);
else
oldsyntax(argc, &argv);
diff --git a/usr.bin/hexdump/hexsyntax.c b/usr.bin/hexdump/hexsyntax.c
index a1b2099..ac1971a 100644
--- a/usr.bin/hexdump/hexsyntax.c
+++ b/usr.bin/hexdump/hexsyntax.c
@@ -54,7 +54,7 @@ newsyntax(int argc, char ***argvp)
char *p, **argv;
argv = *argvp;
- if ((p = rindex(argv[0], 'h')) != NULL &&
+ if ((p = strrchr(argv[0], 'h')) != NULL &&
strcmp(p, "hd") == 0) {
/* "Canonical" format, implies -C. */
add("\"%08.8_Ax\n\"");
diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c
index b550bd6..0fa24f5 100644
--- a/usr.bin/hexdump/parse.c
+++ b/usr.bin/hexdump/parse.c
@@ -58,7 +58,7 @@ addfile(char *name)
if ((fp = fopen(name, "r")) == NULL)
err(1, "%s", name);
while (fgets(buf, sizeof(buf), fp)) {
- if (!(p = index(buf, '\n'))) {
+ if (!(p = strchr(buf, '\n'))) {
warnx("line too long");
while ((ch = getchar()) != '\n' && ch != EOF);
continue;
@@ -167,7 +167,7 @@ size(FS *fs)
* skip any special chars -- save precision in
* case it's a %s format.
*/
- while (index(spec + 1, *++fmt));
+ while (strchr(spec + 1, *++fmt));
if (*fmt == '.' && isdigit(*++fmt)) {
prec = atoi(fmt);
while (isdigit(*++fmt));
@@ -243,10 +243,10 @@ rewrite(FS *fs)
if (fu->bcnt) {
sokay = USEBCNT;
/* Skip to conversion character. */
- for (++p1; index(spec, *p1); ++p1);
+ for (++p1; strchr(spec, *p1); ++p1);
} else {
/* Skip any special chars, field width. */
- while (index(spec + 1, *++p1));
+ while (strchr(spec + 1, *++p1));
if (*p1 == '.' && isdigit(*++p1)) {
sokay = USEPREC;
prec = atoi(p1);
diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c
index 21148bc..c15730b 100644
--- a/usr.bin/locate/locate/fastfind.c
+++ b/usr.bin/locate/locate/fastfind.c
@@ -167,7 +167,7 @@ fastfind
/* find optimal (last) char for searching */
for (p = pathpart; *p != '\0'; p++)
- if (index(LOCATE_REG, *p) != NULL)
+ if (strchr(LOCATE_REG, *p) != NULL)
break;
if (*p == '\0')
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
index 7b9fe49..d00a9a3 100644
--- a/usr.bin/locate/locate/util.c
+++ b/usr.bin/locate/locate/util.c
@@ -162,7 +162,7 @@ patprep(name)
/* skip trailing metacharacters */
for (; p >= name; p--)
- if (index(LOCATE_REG, *p) == NULL)
+ if (strchr(LOCATE_REG, *p) == NULL)
break;
/*
@@ -172,7 +172,7 @@ patprep(name)
* |----< p
*/
if (p >= name &&
- (index(p, '[') != NULL || index(p, ']') != NULL)) {
+ (strchr(p, '[') != NULL || strchr(p, ']') != NULL)) {
for (p = name; *p != '\0'; p++)
if (*p == ']' || *p == '[')
break;
@@ -183,7 +183,7 @@ patprep(name)
* '*\*[a-z]'
* |-------< p
*/
- if (p >= name && index(LOCATE_REG, *p) != NULL)
+ if (p >= name && strchr(LOCATE_REG, *p) != NULL)
p = name - 1;
}
@@ -193,7 +193,7 @@ patprep(name)
else {
for (endmark = p; p >= name; p--)
- if (index(LOCATE_REG, *p) != NULL)
+ if (strchr(LOCATE_REG, *p) != NULL)
break;
for (++p;
(p <= endmark) && subp < (globfree + sizeof(globfree));)
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index 8a11270..a985791 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -256,7 +256,7 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *))
ifnetaddr = (u_long)TAILQ_NEXT(&ifnet, if_link);
if (interface != 0 && strcmp(name, interface) != 0)
continue;
- cp = index(name, '\0');
+ cp = strchr(name, '\0');
if (pfunc) {
(*pfunc)(name);
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 1653018..7309951 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1247,7 +1247,7 @@ inetprint(struct in_addr *in, int port, const char *proto, int num_port)
sprintf(line, "%s.", inetname(in));
else
sprintf(line, "%.*s.", (Aflag && !num_port) ? 12 : 16, inetname(in));
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
if (!num_port && port)
sp = getservbyport((int)port, proto);
if (sp || port == 0)
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
index 03fef6e..1a19fa5 100644
--- a/usr.bin/netstat/inet6.c
+++ b/usr.bin/netstat/inet6.c
@@ -1100,7 +1100,7 @@ inet6print(struct in6_addr *in6, int port, const char *proto, int numeric)
sprintf(line, "%.*s.", Wflag ? 39 :
(Aflag && !numeric) ? 12 : 16, inet6name(in6));
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
if (!numeric && port)
GETSERVBYPORT6(port, proto, sp);
if (sp || port == 0)
@@ -1129,7 +1129,7 @@ inet6name(struct in6_addr *in6p)
if (first && !numeric_addr) {
first = 0;
if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = index(domain, '.')))
+ (cp = strchr(domain, '.')))
(void) strcpy(domain, cp + 1);
else
domain[0] = 0;
@@ -1138,7 +1138,7 @@ inet6name(struct in6_addr *in6p)
if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) {
hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6);
if (hp) {
- if ((cp = index(hp->h_name, '.')) &&
+ if ((cp = strchr(hp->h_name, '.')) &&
!strcmp(cp + 1, domain))
*cp = 0;
cp = hp->h_name;
diff --git a/usr.bin/netstat/sctp.c b/usr.bin/netstat/sctp.c
index d5ad70e..fb94d44 100644
--- a/usr.bin/netstat/sctp.c
+++ b/usr.bin/netstat/sctp.c
@@ -162,7 +162,7 @@ inet6name(struct in6_addr *in6p)
if (first && !numeric_addr) {
first = 0;
if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = index(domain, '.')))
+ (cp = strchr(domain, '.')))
(void) strcpy(domain, cp + 1);
else
domain[0] = 0;
@@ -171,7 +171,7 @@ inet6name(struct in6_addr *in6p)
if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) {
hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6);
if (hp) {
- if ((cp = index(hp->h_name, '.')) &&
+ if ((cp = strchr(hp->h_name, '.')) &&
!strcmp(cp + 1, domain))
*cp = 0;
cp = hp->h_name;
@@ -209,7 +209,7 @@ sctp_print_address(union sctp_sockstore *address, int port, int num_port)
sprintf(line, "%.*s.", Wflag ? 39 : 16, "");
break;
}
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
if (!num_port && port)
sp = getservbyport((int)port, "sctp");
if (sp || port == 0)
diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c
index 4d1f7b0..b134679 100644
--- a/usr.bin/rlogin/rlogin.c
+++ b/usr.bin/rlogin/rlogin.c
@@ -142,7 +142,7 @@ main(int argc, char *argv[])
one = 1;
host = localname = user = NULL;
- if ((p = rindex(argv[0], '/')))
+ if ((p = strrchr(argv[0], '/')))
++p;
else
p = argv[0];
diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c
index 00d85b8..c9b2e7a 100644
--- a/usr.bin/rpcgen/rpc_main.c
+++ b/usr.bin/rpcgen/rpc_main.c
@@ -64,10 +64,6 @@ static void clnt_output(const char *, const char *, int, const char * );
static char *generate_guard(const char *);
static void c_initialize(void);
-#if !defined(__FreeBSD__) && !defined(__NetBSD__)
-char * rindex();
-#endif
-
static void usage(void);
static void options_usage(void);
static int do_registers(int, const char **);
@@ -233,7 +229,7 @@ extendfile(const char *path, const char *ext)
const char *p;
const char *file;
- if ((file = rindex(path, '/')) == NULL)
+ if ((file = strrchr(path, '/')) == NULL)
file = path;
else
file++;
@@ -821,7 +817,7 @@ static void mkfile_output(struct commandline *cmd)
if (allfiles){
mkftemp = xmalloc(strlen("makefile.") +
strlen(cmd->infile) + 1);
- temp = (char *)rindex(cmd->infile, '.');
+ temp = strrchr(cmd->infile, '.');
strcpy(mkftemp, "makefile.");
(void) strncat(mkftemp, cmd->infile,
(temp - cmd->infile));
diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c
index 09a1838..3c74fb7 100644
--- a/usr.bin/systat/devs.c
+++ b/usr.bin/systat/devs.c
@@ -265,7 +265,7 @@ dsselect(const char *args, devstat_select_mode select_mode, int maxshowdevs,
specified_devices = (char **)malloc(sizeof(char *));
tmpstr = tmpstr1 = strdup(args);
- cp = index(tmpstr1, '\n');
+ cp = strchr(tmpstr1, '\n');
if (cp)
*cp = '\0';
for (;;) {
diff --git a/usr.bin/systat/netcmds.c b/usr.bin/systat/netcmds.c
index c7f1178..e627329 100644
--- a/usr.bin/systat/netcmds.c
+++ b/usr.bin/systat/netcmds.c
@@ -131,7 +131,7 @@ changeitems(const char *args, int onoff)
struct in_addr in;
tmpstr = tmpstr1 = strdup(args);
- cp = index(tmpstr1, '\n');
+ cp = strchr(tmpstr1, '\n');
if (cp)
*cp = '\0';
for (;;tmpstr1 = cp) {
diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c
index d96fb16..a5e0608 100644
--- a/usr.bin/systat/netstat.c
+++ b/usr.bin/systat/netstat.c
@@ -554,7 +554,7 @@ inetprint(struct sockaddr *sa, const char *proto)
break;
}
snprintf(line, sizeof(line), "%.*s.", 16, inetname(sa));
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
if (!nflag && port)
sp = getservbyport(port, proto);
if (sp || port == 0)
@@ -564,7 +564,7 @@ inetprint(struct sockaddr *sa, const char *proto)
snprintf(cp, sizeof(line) - (cp - line), "%d",
ntohs((u_short)port));
/* pad to full column to clear any garbage */
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
while (cp - line < 22)
*cp++ = ' ';
line[22] = '\0';
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
index 2b0172e..0092827 100644
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -437,16 +437,16 @@ put(int argc, char *argv[])
return;
}
targ = argv[argc - 1];
- if (rindex(argv[argc - 1], ':')) {
+ if (strrchr(argv[argc - 1], ':')) {
char *lcp;
for (n = 1; n < argc - 1; n++)
- if (index(argv[n], ':')) {
+ if (strchr(argv[n], ':')) {
putusage(argv[0]);
return;
}
lcp = argv[argc - 1];
- targ = rindex(lcp, ':');
+ targ = strrchr(lcp, ':');
*targ++ = 0;
if (lcp[0] == '[' && lcp[strlen(lcp) - 1] == ']') {
lcp[strlen(lcp) - 1] = '\0';
@@ -477,7 +477,7 @@ put(int argc, char *argv[])
}
/* this assumes the target is a directory */
/* on a remote unix system. hmmmm. */
- cp = index(targ, '\0');
+ cp = strchr(targ, '\0');
*cp++ = '/';
for (n = 1; n < argc - 1; n++) {
strcpy(cp, tail(argv[n]));
@@ -532,7 +532,7 @@ get(int argc, char *argv[])
}
if (!connected) {
for (n = 1; n < argc ; n++)
- if (rindex(argv[n], ':') == 0) {
+ if (strrchr(argv[n], ':') == 0) {
printf("No remote host specified and "
"no host given for file '%s'\n", argv[n]);
getusage(argv[0]);
@@ -540,7 +540,7 @@ get(int argc, char *argv[])
}
}
for (n = 1; n < argc ; n++) {
- src = rindex(argv[n], ':');
+ src = strrchr(argv[n], ':');
if (src == NULL)
src = argv[n];
else {
@@ -681,7 +681,7 @@ tail(char *filename)
char *s;
while (*filename) {
- s = rindex(filename, '/');
+ s = strrchr(filename, '/');
if (s == NULL)
break;
if (s[1])
diff --git a/usr.bin/tr/str.c b/usr.bin/tr/str.c
index abfd0d6..333ca5c 100644
--- a/usr.bin/tr/str.c
+++ b/usr.bin/tr/str.c
@@ -161,7 +161,7 @@ bracket(STR *s)
repeat:
if ((p = strpbrk(s->str + 2, "*]")) == NULL)
return (0);
- if (p[0] != '*' || index(p, ']') == NULL)
+ if (p[0] != '*' || strchr(p, ']') == NULL)
return (0);
s->str += 1;
genseq(s);
diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c
index 18ee135..8de594f 100644
--- a/usr.bin/tset/map.c
+++ b/usr.bin/tset/map.c
@@ -132,7 +132,7 @@ next: if (*arg == ':') {
goto badmopt;
++arg;
} else { /* Optional baudrate. */
- arg = index(p = arg, ':');
+ arg = strchr(p = arg, ':');
if (arg == NULL)
goto badmopt;
*arg++ = '\0';
diff --git a/usr.bin/tset/term.c b/usr.bin/tset/term.c
index 7082e5f..544e928 100644
--- a/usr.bin/tset/term.c
+++ b/usr.bin/tset/term.c
@@ -74,7 +74,7 @@ get_termcap_entry(char *userarg, char **tcapbufp)
/* Try ttyname(3); check for dialup or other mapping. */
if ((ttypath = ttyname(STDERR_FILENO))) {
- if ((p = rindex(ttypath, '/')))
+ if ((p = strrchr(ttypath, '/')))
++p;
else
p = ttypath;
@@ -146,7 +146,7 @@ askuser(const char *dflt)
return (dflt);
}
- if ((p = index(answer, '\n')))
+ if ((p = strchr(answer, '\n')))
*p = '\0';
if (answer[0])
return (answer);
diff --git a/usr.bin/tset/wrterm.c b/usr.bin/tset/wrterm.c
index e258e16..77751fa 100644
--- a/usr.bin/tset/wrterm.c
+++ b/usr.bin/tset/wrterm.c
@@ -56,7 +56,7 @@ wrtermcap(char *bp)
char *t, *sep;
/* Find the end of the terminal names. */
- if ((t = index(bp, ':')) == NULL)
+ if ((t = strchr(bp, ':')) == NULL)
errx(1, "termcap names not colon terminated");
*t++ = '\0';
OpenPOWER on IntegriCloud