Date: Tue, 15 Mar 2011 23:54:19 +0000 From: Alexander Best <arundel@freebsd.org> To: Jilles Tjoelker <jilles@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r219680 - in head/bin: ln rm test Message-ID: <20110315235419.GA45188@freebsd.org> In-Reply-To: <201103152222.p2FMMB8O061154@svn.freebsd.org> References: <201103152222.p2FMMB8O061154@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue Mar 15 11, Jilles Tjoelker wrote: > 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(). shouldn't the rindex(3) manual contain a note regarding it's depricated nature and the fact that strchr(3) is preferred? cheers. alex > > 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++; -- a13x
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110315235419.GA45188>