svn commit: r229386 - head/usr.bin/talk
Ed Schouten
ed at FreeBSD.org
Tue Jan 3 11:13:08 UTC 2012
Author: ed
Date: Tue Jan 3 11:13:07 2012
New Revision: 229386
URL: http://svn.freebsd.org/changeset/base/229386
Log:
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.
Modified:
head/usr.bin/talk/get_names.c
Modified: head/usr.bin/talk/get_names.c
==============================================================================
--- head/usr.bin/talk/get_names.c Tue Jan 3 11:10:15 2012 (r229385)
+++ head/usr.bin/talk/get_names.c Tue Jan 3 11:13:07 2012 (r229386)
@@ -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];
More information about the svn-src-all
mailing list