From 75ac3edf1d2b3068db9e8ddef39a623772771c1e Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 3 Jan 2012 11:13:07 +0000 Subject: [PATCH] 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(-) diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c index 965120ac37f..8da8e4acb13 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];