From e1ab2f9fed65fbeb9f7eaaa5a4272259f636e275 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 3 Jan 2012 11:13:07 +0000 Subject: 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. --- usr.bin/talk/get_names.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'usr.bin/talk') 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]; -- cgit v1.1