NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/47317: Replca index() with strchr() in var.c



>Number:         47317
>Category:       bin
>Synopsis:       Replca index() with strchr() in var.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 12:20:01 +0000 2012
>Originator:     Henning Petersen
>Release:        NetBSD-current
>Organization:
>Environment:
>Description:
Replace the last use of index() with strchr().
Remove unneeded include of "strings.h"
>How-To-Repeat:

>Fix:
diff -u -p -r1.41 var.c
--- bin/sh/var.c        28 Mar 2012 20:11:25 -0000      1.41
+++ bin/sh/var.c        6 Dec 2012 09:28:18 -0000
@@ -41,11 +41,10 @@ __RCSID("$NetBSD: var.c,v 1.41 2012/03/2
 #endif
 #endif /* not lint */
 
-#include <unistd.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <paths.h>
 #include <limits.h>
+#include <paths.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 /*
  * Shell variables.
@@ -486,7 +485,7 @@ print_quoted(const char *p)
                        p++;
                        continue;
                }
-               q = index(p, '\'');
+               q = strchr(p, '\'');
                if (!q) {
                        out1fmt("'%s'", p );
                        return;



Home | Main Index | Thread Index | Old Index