NetBSD Problem Report #47317

From www@NetBSD.org  Thu Dec 13 12:19:45 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id E537F63E33E
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 13 Dec 2012 12:19:44 +0000 (UTC)
Message-Id: <20121213121944.3BB3463E33E@www.NetBSD.org>
Date: Thu, 13 Dec 2012 12:19:44 +0000 (UTC)
From: henning.petersen@t-online.de
Reply-To: henning.petersen@t-online.de
To: gnats-bugs@NetBSD.org
Subject: Replca index() with strchr() in var.c
X-Send-Pr-Version: www-1.0

>Number:         47317
>Category:       bin
>Synopsis:       Replca index() with strchr() in var.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 12:20:01 +0000 2012
>Closed-Date:    Thu Dec 13 21:54:19 +0000 2012
>Last-Modified:  Thu Dec 13 21:54:19 +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;

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47317 CVS commit: src/bin/sh
Date: Thu, 13 Dec 2012 14:33:24 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Thu Dec 13 19:33:24 UTC 2012

 Modified Files:
 	src/bin/sh: var.c

 Log Message:
 PR/47317: Henning Petersen: Replace index() with strchr()


 To generate a diff of this commit:
 cvs rdiff -u -r1.41 -r1.42 src/bin/sh/var.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Thu, 13 Dec 2012 21:54:19 +0000
State-Changed-Why:
christos committed it, thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.