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]; _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"