Date: Tue, 3 Jan 2012 11:13:08 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r229386 - head/usr.bin/talk Message-ID: <201201031113.q03BD8Vw021046@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201031113.q03BD8Vw021046>