diff options
author | ed <ed@FreeBSD.org> | 2012-01-03 11:13:07 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2012-01-03 11:13:07 +0000 |
commit | e1ab2f9fed65fbeb9f7eaaa5a4272259f636e275 (patch) | |
tree | 3768e250eb2684ed9859341f99eca00bcab25200 /usr.bin | |
parent | f1de7c98ce04c27f9b75635865b85a5062ae3353 (diff) | |
download | FreeBSD-src-e1ab2f9fed65fbeb9f7eaaa5a4272259f636e275.zip FreeBSD-src-e1ab2f9fed65fbeb9f7eaaa5a4272259f636e275.tar.gz |
Remove hand-written version of strcspn().
The code searches for the first occurence of @, : or !. Upon failure, it
returns the index of \0. This is exactly what strcspn() does.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/talk/get_names.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c index 965120a..8da8e4a 100644 --- a/usr.bin/talk/get_names.c +++ b/usr.bin/talk/get_names.c @@ -80,8 +80,7 @@ get_names(int argc, char *argv[]) gethostname(hostname, sizeof (hostname)); my_machine_name = hostname; /* check for, and strip out, the machine name of the target */ - for (cp = argv[1]; *cp && !index("@:!", *cp); cp++) - ; + cp = argv[1] + strcspn(argv[1], "@:!"); if (*cp == '\0') { /* this is a local to local talk */ his_name = argv[1]; |