sh: Fix more compiler warnings.
This commit is contained in:
parent
2c8f60acb3
commit
22afca9b67
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=279508
@ -149,7 +149,7 @@ evalcmd(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
evalstring(char *s, int flags)
|
evalstring(const char *s, int flags)
|
||||||
{
|
{
|
||||||
union node *n;
|
union node *n;
|
||||||
struct stackmark smark;
|
struct stackmark smark;
|
||||||
|
@ -53,7 +53,7 @@ void reseteval(void);
|
|||||||
#define EV_TESTED 02 /* exit status is checked; ignore -e flag */
|
#define EV_TESTED 02 /* exit status is checked; ignore -e flag */
|
||||||
#define EV_BACKCMD 04 /* command executing within back quotes */
|
#define EV_BACKCMD 04 /* command executing within back quotes */
|
||||||
|
|
||||||
void evalstring(char *, int);
|
void evalstring(const char *, int);
|
||||||
union node; /* BLETCH for ansi C */
|
union node; /* BLETCH for ansi C */
|
||||||
void evaltree(union node *, int);
|
void evaltree(union node *, int);
|
||||||
void evalbackcmd(union node *, struct backcmd *);
|
void evalbackcmd(union node *, struct backcmd *);
|
||||||
|
@ -338,8 +338,8 @@ histcmd(int argc, char **argv __unused)
|
|||||||
out1fmt("%5d ", he.num);
|
out1fmt("%5d ", he.num);
|
||||||
out1str(he.str);
|
out1str(he.str);
|
||||||
} else {
|
} else {
|
||||||
char *s = pat ?
|
const char *s = pat ?
|
||||||
fc_replace(he.str, pat, repl) : (char *)he.str;
|
fc_replace(he.str, pat, repl) : he.str;
|
||||||
|
|
||||||
if (sflg) {
|
if (sflg) {
|
||||||
if (displayhist) {
|
if (displayhist) {
|
||||||
@ -477,7 +477,7 @@ bindcmd(int argc, char **argv)
|
|||||||
|
|
||||||
if (el == NULL)
|
if (el == NULL)
|
||||||
error("line editing is disabled");
|
error("line editing is disabled");
|
||||||
return (el_parse(el, argc, (const char **)argv));
|
return (el_parse(el, argc, __DECONST(const char **, argv)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -232,7 +232,7 @@ fgcmd(int argc __unused, char **argv __unused)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
bgcmd(int argc, char **argv)
|
bgcmd(int argc __unused, char **argv __unused)
|
||||||
{
|
{
|
||||||
struct job *jp;
|
struct job *jp;
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
|
|||||||
int ind = 0;
|
int ind = 0;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
char s[10];
|
char s[10];
|
||||||
const char *optarg = NULL;
|
const char *newoptarg = NULL;
|
||||||
|
|
||||||
if ((p = *optptr) == NULL || *p == '\0') {
|
if ((p = *optptr) == NULL || *p == '\0') {
|
||||||
/* Current word is done, advance */
|
/* Current word is done, advance */
|
||||||
@ -491,7 +491,7 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
|
|||||||
if (optstr[0] == ':') {
|
if (optstr[0] == ':') {
|
||||||
s[0] = c;
|
s[0] = c;
|
||||||
s[1] = '\0';
|
s[1] = '\0';
|
||||||
optarg = s;
|
newoptarg = s;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out2fmt_flush("Illegal option -%c\n", c);
|
out2fmt_flush("Illegal option -%c\n", c);
|
||||||
@ -507,7 +507,7 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
|
|||||||
if (optstr[0] == ':') {
|
if (optstr[0] == ':') {
|
||||||
s[0] = c;
|
s[0] = c;
|
||||||
s[1] = '\0';
|
s[1] = '\0';
|
||||||
optarg = s;
|
newoptarg = s;
|
||||||
c = ':';
|
c = ':';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -519,7 +519,7 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
|
|||||||
|
|
||||||
if (p == **optnext)
|
if (p == **optnext)
|
||||||
(*optnext)++;
|
(*optnext)++;
|
||||||
optarg = p;
|
newoptarg = p;
|
||||||
p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,8 +527,8 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
|
|||||||
if (*optnext != NULL)
|
if (*optnext != NULL)
|
||||||
ind = *optnext - optfirst + 1;
|
ind = *optnext - optfirst + 1;
|
||||||
*optptr = p;
|
*optptr = p;
|
||||||
if (optarg != NULL)
|
if (newoptarg != NULL)
|
||||||
err |= setvarsafe("OPTARG", optarg, 0);
|
err |= setvarsafe("OPTARG", newoptarg, 0);
|
||||||
else {
|
else {
|
||||||
INTOFF;
|
INTOFF;
|
||||||
err |= unsetvar("OPTARG");
|
err |= unsetvar("OPTARG");
|
||||||
|
@ -141,6 +141,7 @@ static const int locale_categories[7] = {
|
|||||||
static int varequal(const char *, const char *);
|
static int varequal(const char *, const char *);
|
||||||
static struct var *find_var(const char *, struct var ***, int *);
|
static struct var *find_var(const char *, struct var ***, int *);
|
||||||
static int localevar(const char *);
|
static int localevar(const char *);
|
||||||
|
static void setvareq_const(const char *s, int flags);
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -183,7 +184,7 @@ initvar(void)
|
|||||||
setvareq(*envp, VEXPORT|VTEXTFIXED);
|
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.
|
* Process a linked list of variable assignments.
|
||||||
|
Loading…
Reference in New Issue
Block a user