Date: Tue, 15 Mar 2011 22:22:11 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r219680 - in head/bin: ln rm test Message-ID: <201103152222.p2FMMB8O061154@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Tue Mar 15 22:22:11 2011 New Revision: 219680 URL: http://svn.freebsd.org/changeset/base/219680 Log: bin: Prefer strrchr() to rindex(). This removes the last index/rindex usage from /bin. Modified: head/bin/ln/ln.c head/bin/rm/rm.c head/bin/test/test.c Modified: head/bin/ln/ln.c ============================================================================== --- head/bin/ln/ln.c Tue Mar 15 21:45:10 2011 (r219679) +++ head/bin/ln/ln.c Tue Mar 15 22:22:11 2011 (r219680) @@ -80,7 +80,7 @@ main(int argc, char *argv[]) * "link", for which the functionality provided is greatly * simplified. */ - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; Modified: head/bin/rm/rm.c ============================================================================== --- head/bin/rm/rm.c Tue Mar 15 21:45:10 2011 (r219679) +++ head/bin/rm/rm.c Tue Mar 15 22:22:11 2011 (r219680) @@ -90,7 +90,7 @@ main(int argc, char *argv[]) * "unlink", for which the functionality provided is greatly * simplified. */ - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; Modified: head/bin/test/test.c ============================================================================== --- head/bin/test/test.c Tue Mar 15 21:45:10 2011 (r219679) +++ head/bin/test/test.c Tue Mar 15 22:22:11 2011 (r219680) @@ -194,7 +194,7 @@ main(int argc, char **argv) int res; char *p; - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else p++;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103152222.p2FMMB8O061154>