From owner-svn-src-all@FreeBSD.ORG Sun Mar 1 22:32:26 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14D04FCB; Sun, 1 Mar 2015 22:32:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F35D1E73; Sun, 1 Mar 2015 22:32:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t21MWP01019388; Sun, 1 Mar 2015 22:32:25 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t21MWO3P019379; Sun, 1 Mar 2015 22:32:24 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201503012232.t21MWO3P019379@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 1 Mar 2015 22:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279508 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2015 22:32:26 -0000 Author: jilles Date: Sun Mar 1 22:32:23 2015 New Revision: 279508 URL: https://svnweb.freebsd.org/changeset/base/279508 Log: sh: Fix more compiler warnings. Modified: head/bin/sh/eval.c head/bin/sh/eval.h head/bin/sh/histedit.c head/bin/sh/jobs.c head/bin/sh/options.c head/bin/sh/var.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Mar 1 22:12:24 2015 (r279507) +++ head/bin/sh/eval.c Sun Mar 1 22:32:23 2015 (r279508) @@ -149,7 +149,7 @@ evalcmd(int argc, char **argv) */ void -evalstring(char *s, int flags) +evalstring(const char *s, int flags) { union node *n; struct stackmark smark; Modified: head/bin/sh/eval.h ============================================================================== --- head/bin/sh/eval.h Sun Mar 1 22:12:24 2015 (r279507) +++ head/bin/sh/eval.h Sun Mar 1 22:32:23 2015 (r279508) @@ -53,7 +53,7 @@ void reseteval(void); #define EV_TESTED 02 /* exit status is checked; ignore -e flag */ #define EV_BACKCMD 04 /* command executing within back quotes */ -void evalstring(char *, int); +void evalstring(const char *, int); union node; /* BLETCH for ansi C */ void evaltree(union node *, int); void evalbackcmd(union node *, struct backcmd *); Modified: head/bin/sh/histedit.c ============================================================================== --- head/bin/sh/histedit.c Sun Mar 1 22:12:24 2015 (r279507) +++ head/bin/sh/histedit.c Sun Mar 1 22:32:23 2015 (r279508) @@ -338,8 +338,8 @@ histcmd(int argc, char **argv __unused) out1fmt("%5d ", he.num); out1str(he.str); } else { - char *s = pat ? - fc_replace(he.str, pat, repl) : (char *)he.str; + const char *s = pat ? + fc_replace(he.str, pat, repl) : he.str; if (sflg) { if (displayhist) { @@ -477,7 +477,7 @@ bindcmd(int argc, char **argv) if (el == NULL) error("line editing is disabled"); - return (el_parse(el, argc, (const char **)argv)); + return (el_parse(el, argc, __DECONST(const char **, argv))); } #else Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Sun Mar 1 22:12:24 2015 (r279507) +++ head/bin/sh/jobs.c Sun Mar 1 22:32:23 2015 (r279508) @@ -232,7 +232,7 @@ fgcmd(int argc __unused, char **argv __u int -bgcmd(int argc, char **argv) +bgcmd(int argc __unused, char **argv __unused) { struct job *jp; Modified: head/bin/sh/options.c ============================================================================== --- head/bin/sh/options.c Sun Mar 1 22:12:24 2015 (r279507) +++ head/bin/sh/options.c Sun Mar 1 22:32:23 2015 (r279508) @@ -465,7 +465,7 @@ getopts(char *optstr, char *optvar, char int ind = 0; int err = 0; char s[10]; - const char *optarg = NULL; + const char *newoptarg = NULL; if ((p = *optptr) == NULL || *p == '\0') { /* Current word is done, advance */ @@ -491,7 +491,7 @@ atend: if (optstr[0] == ':') { s[0] = c; s[1] = '\0'; - optarg = s; + newoptarg = s; } else out2fmt_flush("Illegal option -%c\n", c); @@ -507,7 +507,7 @@ atend: if (optstr[0] == ':') { s[0] = c; s[1] = '\0'; - optarg = s; + newoptarg = s; c = ':'; } else { @@ -519,7 +519,7 @@ atend: if (p == **optnext) (*optnext)++; - optarg = p; + newoptarg = p; p = NULL; } @@ -527,8 +527,8 @@ out: if (*optnext != NULL) ind = *optnext - optfirst + 1; *optptr = p; - if (optarg != NULL) - err |= setvarsafe("OPTARG", optarg, 0); + if (newoptarg != NULL) + err |= setvarsafe("OPTARG", newoptarg, 0); else { INTOFF; err |= unsetvar("OPTARG"); Modified: head/bin/sh/var.c ============================================================================== --- head/bin/sh/var.c Sun Mar 1 22:12:24 2015 (r279507) +++ head/bin/sh/var.c Sun Mar 1 22:32:23 2015 (r279508) @@ -141,6 +141,7 @@ static const int locale_categories[7] = static int varequal(const char *, const char *); static struct var *find_var(const char *, struct var ***, int *); static int localevar(const char *); +static void setvareq_const(const char *s, int flags); extern char **environ; @@ -183,7 +184,7 @@ initvar(void) setvareq(*envp, VEXPORT|VTEXTFIXED); } } - setvareq("OPTIND=1", VTEXTFIXED); + setvareq_const("OPTIND=1", 0); } /* @@ -389,6 +390,12 @@ setvareq(char *s, int flags) } +static void +setvareq_const(const char *s, int flags) +{ + setvareq(__DECONST(char *, s), flags | VTEXTFIXED); +} + /* * Process a linked list of variable assignments.