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
_______________________________________________
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"

Reply via email to