sh: Various warning fixes (from WARNS=6 NO_WERROR=1):
- const - initializations to silence -Wuninitialized (it was safe anyway) - remove nested extern declarations - rename "index" locals to "idx"
This commit is contained in:
parent
5cb5104246
commit
384aedab58
@ -314,7 +314,7 @@ yyerror(const char *s)
|
||||
int
|
||||
expcmd(int argc, char **argv)
|
||||
{
|
||||
char *p;
|
||||
const char *p;
|
||||
char *concat;
|
||||
char **ap;
|
||||
arith_t i;
|
||||
|
@ -79,7 +79,7 @@ STATIC char *cdcomppath;
|
||||
int
|
||||
cdcmd(int argc, char **argv)
|
||||
{
|
||||
char *dest;
|
||||
const char *dest;
|
||||
const char *path;
|
||||
char *p;
|
||||
struct stat statb;
|
||||
|
@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
MKINIT int evalskip; /* set if we are skipping commands */
|
||||
int evalskip; /* set if we are skipping commands */
|
||||
STATIC int skipcount; /* number of levels to skip */
|
||||
MKINIT int loopnest; /* current loop nesting level */
|
||||
int funcnest; /* depth of function calls */
|
||||
@ -407,8 +407,7 @@ evalsubshell(union node *n, int flags)
|
||||
flags &=~ EV_TESTED;
|
||||
redirect(n->nredir.redirect, 0);
|
||||
evaltree(n->nredir.n, flags | EV_EXIT); /* never returns */
|
||||
}
|
||||
if (! backgnd) {
|
||||
} else if (! backgnd) {
|
||||
INTOFF;
|
||||
exitstatus = waitforjob(jp, (int *)NULL);
|
||||
INTON;
|
||||
@ -849,7 +848,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
listsetvar(cmdenviron);
|
||||
commandname = argv[0];
|
||||
argptr = argv + 1;
|
||||
optptr = NULL; /* initialize nextopt */
|
||||
nextopt_optptr = NULL; /* initialize nextopt */
|
||||
builtin_flags = flags;
|
||||
exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv);
|
||||
flushall();
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
extern char *commandname; /* currently executing command */
|
||||
extern int exitstatus; /* exit status of last command */
|
||||
extern int oexitstatus; /* saved exit status */
|
||||
extern struct strlist *cmdenviron; /* environment for builtin command */
|
||||
|
||||
|
||||
|
@ -109,7 +109,7 @@ STATIC void delete_cmd_entry(void);
|
||||
*/
|
||||
|
||||
void
|
||||
shellexec(char **argv, char **envp, const char *path, int index)
|
||||
shellexec(char **argv, char **envp, const char *path, int idx)
|
||||
{
|
||||
char *cmdname;
|
||||
int e;
|
||||
@ -120,7 +120,7 @@ shellexec(char **argv, char **envp, const char *path, int index)
|
||||
} else {
|
||||
e = ENOENT;
|
||||
while ((cmdname = padvance(&path, argv[0])) != NULL) {
|
||||
if (--index < 0 && pathopt == NULL) {
|
||||
if (--idx < 0 && pathopt == NULL) {
|
||||
tryexec(cmdname, argv, envp);
|
||||
if (errno != ENOENT && errno != ENOTDIR)
|
||||
e = errno;
|
||||
@ -268,17 +268,17 @@ hashcmd(int argc __unused, char **argv __unused)
|
||||
STATIC void
|
||||
printentry(struct tblentry *cmdp, int verbose)
|
||||
{
|
||||
int index;
|
||||
int idx;
|
||||
const char *path;
|
||||
char *name;
|
||||
|
||||
if (cmdp->cmdtype == CMDNORMAL) {
|
||||
index = cmdp->param.index;
|
||||
idx = cmdp->param.index;
|
||||
path = pathval();
|
||||
do {
|
||||
name = padvance(&path, cmdp->cmdname);
|
||||
stunalloc(name);
|
||||
} while (--index >= 0);
|
||||
} while (--idx >= 0);
|
||||
out1str(name);
|
||||
} else if (cmdp->cmdtype == CMDBUILTIN) {
|
||||
out1fmt("builtin %s", cmdp->cmdname);
|
||||
@ -314,7 +314,7 @@ find_command(const char *name, struct cmdentry *entry, int printerr,
|
||||
const char *path)
|
||||
{
|
||||
struct tblentry *cmdp;
|
||||
int index;
|
||||
int idx;
|
||||
int prev;
|
||||
char *fullname;
|
||||
struct stat statb;
|
||||
@ -354,11 +354,11 @@ find_command(const char *name, struct cmdentry *entry, int printerr,
|
||||
}
|
||||
|
||||
e = ENOENT;
|
||||
index = -1;
|
||||
idx = -1;
|
||||
loop:
|
||||
while ((fullname = padvance(&path, name)) != NULL) {
|
||||
stunalloc(fullname);
|
||||
index++;
|
||||
idx++;
|
||||
if (pathopt) {
|
||||
if (prefix("builtin", pathopt)) {
|
||||
if ((i = find_builtin(name, &spec)) < 0)
|
||||
@ -377,8 +377,8 @@ loop:
|
||||
}
|
||||
}
|
||||
/* if rehash, don't redo absolute path names */
|
||||
if (fullname[0] == '/' && index <= prev) {
|
||||
if (index < prev)
|
||||
if (fullname[0] == '/' && idx <= prev) {
|
||||
if (idx < prev)
|
||||
goto loop;
|
||||
TRACE(("searchexec \"%s\": no change\n", name));
|
||||
goto success;
|
||||
@ -415,7 +415,7 @@ loop:
|
||||
INTOFF;
|
||||
cmdp = cmdlookup(name, 1);
|
||||
cmdp->cmdtype = CMDNORMAL;
|
||||
cmdp->param.index = index;
|
||||
cmdp->param.index = idx;
|
||||
INTON;
|
||||
goto success;
|
||||
}
|
||||
@ -494,18 +494,18 @@ void
|
||||
changepath(const char *newval)
|
||||
{
|
||||
const char *old, *new;
|
||||
int index;
|
||||
int idx;
|
||||
int firstchange;
|
||||
int bltin;
|
||||
|
||||
old = pathval();
|
||||
new = newval;
|
||||
firstchange = 9999; /* assume no change */
|
||||
index = 0;
|
||||
idx = 0;
|
||||
bltin = -1;
|
||||
for (;;) {
|
||||
if (*old != *new) {
|
||||
firstchange = index;
|
||||
firstchange = idx;
|
||||
if ((*old == '\0' && *new == ':')
|
||||
|| (*old == ':' && *new == '\0'))
|
||||
firstchange++;
|
||||
@ -514,9 +514,9 @@ changepath(const char *newval)
|
||||
if (*new == '\0')
|
||||
break;
|
||||
if (*new == '%' && bltin < 0 && prefix("builtin", new + 1))
|
||||
bltin = index;
|
||||
bltin = idx;
|
||||
if (*new == ':') {
|
||||
index++;
|
||||
idx++;
|
||||
}
|
||||
new++, old++;
|
||||
}
|
||||
@ -724,15 +724,14 @@ typecmd_impl(int argc, char **argv, int cmd)
|
||||
{
|
||||
struct cmdentry entry;
|
||||
struct tblentry *cmdp;
|
||||
char **pp;
|
||||
const char *const *pp;
|
||||
struct alias *ap;
|
||||
int i;
|
||||
int error = 0;
|
||||
extern char *const parsekwd[];
|
||||
int error1 = 0;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
/* First look at the keywords */
|
||||
for (pp = (char **)parsekwd; *pp; pp++)
|
||||
for (pp = parsekwd; *pp; pp++)
|
||||
if (**pp == *argv[i] && equal(*pp, argv[i]))
|
||||
break;
|
||||
|
||||
@ -793,7 +792,7 @@ typecmd_impl(int argc, char **argv, int cmd)
|
||||
if (cmd != TYPECMD_SMALLV)
|
||||
outfmt(out2, "%s: %s\n",
|
||||
argv[i], strerror(errno));
|
||||
error |= 127;
|
||||
error1 |= 127;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -818,11 +817,11 @@ typecmd_impl(int argc, char **argv, int cmd)
|
||||
default:
|
||||
if (cmd != TYPECMD_SMALLV)
|
||||
outfmt(out2, "%s: not found\n", argv[i]);
|
||||
error |= 127;
|
||||
error1 |= 127;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return error;
|
||||
return error1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -855,7 +855,6 @@ varvalue(char *name, int quoted, int subtype, int flag)
|
||||
int num;
|
||||
char *p;
|
||||
int i;
|
||||
extern int oexitstatus;
|
||||
char sep;
|
||||
char **ap;
|
||||
char const *syntax;
|
||||
@ -979,7 +978,7 @@ ifsbreakup(char *string, struct arglist *arglist)
|
||||
char *start;
|
||||
char *p;
|
||||
char *q;
|
||||
char *ifs;
|
||||
const char *ifs;
|
||||
const char *ifsspc;
|
||||
int had_param_ch = 0;
|
||||
|
||||
|
@ -164,19 +164,19 @@ int
|
||||
histcmd(int argc, char **argv)
|
||||
{
|
||||
int ch;
|
||||
char *editor = NULL;
|
||||
const char *editor = NULL;
|
||||
HistEvent he;
|
||||
int lflg = 0, nflg = 0, rflg = 0, sflg = 0;
|
||||
int i, retval;
|
||||
char *firststr, *laststr;
|
||||
const char *firststr, *laststr;
|
||||
int first, last, direction;
|
||||
char *pat = NULL, *repl;
|
||||
char *pat = NULL, *repl = NULL;
|
||||
static int active = 0;
|
||||
struct jmploc jmploc;
|
||||
struct jmploc *savehandler;
|
||||
char editfilestr[PATH_MAX];
|
||||
char *volatile editfile;
|
||||
FILE *efp;
|
||||
FILE *efp = NULL;
|
||||
int oldhistnum;
|
||||
|
||||
if (hist == NULL)
|
||||
|
@ -93,7 +93,7 @@ struct parsefile {
|
||||
|
||||
|
||||
int plinno = 1; /* input line number */
|
||||
MKINIT int parsenleft; /* copy of parsefile->nleft */
|
||||
int parsenleft; /* copy of parsefile->nleft */
|
||||
MKINIT int parselleft; /* copy of parsefile->lleft */
|
||||
char *parsenextc; /* copy of parsefile->nextc */
|
||||
MKINIT struct parsefile basepf; /* top level input file */
|
||||
@ -111,9 +111,9 @@ static int preadfd(void);
|
||||
INCLUDE "input.h"
|
||||
INCLUDE "error.h"
|
||||
|
||||
INIT {
|
||||
extern char basebuf[];
|
||||
MKINIT char basebuf[];
|
||||
|
||||
INIT {
|
||||
basepf.nextc = basepf.buf = basebuf;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ STATIC struct job *getjob(char *);
|
||||
STATIC pid_t dowait(int, struct job *);
|
||||
STATIC pid_t waitproc(int, int *);
|
||||
STATIC void cmdtxt(union node *);
|
||||
STATIC void cmdputs(char *);
|
||||
STATIC void cmdputs(const char *);
|
||||
#if JOBS
|
||||
STATIC void setcurjob(struct job *);
|
||||
STATIC void deljob(struct job *);
|
||||
@ -1083,7 +1083,7 @@ cmdtxt(union node *n)
|
||||
{
|
||||
union node *np;
|
||||
struct nodelist *lp;
|
||||
char *p;
|
||||
const char *p;
|
||||
int i;
|
||||
char s[2];
|
||||
|
||||
@ -1212,9 +1212,10 @@ redir:
|
||||
|
||||
|
||||
STATIC void
|
||||
cmdputs(char *s)
|
||||
cmdputs(const char *s)
|
||||
{
|
||||
char *p, *q;
|
||||
const char *p;
|
||||
char *q;
|
||||
char c;
|
||||
int subtype = 0;
|
||||
|
||||
|
@ -77,7 +77,7 @@ int rootpid;
|
||||
int rootshell;
|
||||
struct jmploc main_handler;
|
||||
|
||||
STATIC void read_profile(char *);
|
||||
STATIC void read_profile(const char *);
|
||||
STATIC char *find_dot_file(char *);
|
||||
|
||||
/*
|
||||
@ -248,7 +248,7 @@ cmdloop(int top)
|
||||
*/
|
||||
|
||||
STATIC void
|
||||
read_profile(char *name)
|
||||
read_profile(const char *name)
|
||||
{
|
||||
int fd;
|
||||
|
||||
@ -334,8 +334,6 @@ dotcmd(int argc, char **argv)
|
||||
int
|
||||
exitcmd(int argc, char **argv)
|
||||
{
|
||||
extern int oexitstatus;
|
||||
|
||||
if (stoppedjobs())
|
||||
return 0;
|
||||
if (argc > 1)
|
||||
|
@ -93,7 +93,7 @@ readcmd(int argc __unused, char **argv __unused)
|
||||
char c;
|
||||
int rflag;
|
||||
char *prompt;
|
||||
char *ifs;
|
||||
const char *ifs;
|
||||
char *p;
|
||||
int startword;
|
||||
int status;
|
||||
@ -254,7 +254,7 @@ readcmd(int argc __unused, char **argv __unused)
|
||||
|
||||
|
||||
int
|
||||
umaskcmd(int argc __unused, char **argv)
|
||||
umaskcmd(int argc __unused, char **argv __unused)
|
||||
{
|
||||
char *ap;
|
||||
int mask;
|
||||
|
@ -88,7 +88,7 @@ tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ < $temp |
|
||||
awk '{ printf "#define %s %d\n", $1, NR-1}'
|
||||
echo '
|
||||
struct builtincmd {
|
||||
char *name;
|
||||
const char *name;
|
||||
int code;
|
||||
int special;
|
||||
};
|
||||
|
@ -102,9 +102,9 @@ struct block {
|
||||
*/
|
||||
|
||||
struct event {
|
||||
char *name; /* name of event (e.g. INIT) */
|
||||
char *routine; /* name of routine called on event */
|
||||
char *comment; /* comment describing routine */
|
||||
const char *name; /* name of event (e.g. INIT) */
|
||||
const char *routine; /* name of routine called on event */
|
||||
const char *comment; /* comment describing routine */
|
||||
struct text code; /* code for handling event */
|
||||
};
|
||||
|
||||
@ -140,7 +140,7 @@ struct event event[] = {
|
||||
};
|
||||
|
||||
|
||||
char *curfile; /* current file */
|
||||
const char *curfile; /* current file */
|
||||
int linno; /* current line */
|
||||
char *header_files[200]; /* list of header files */
|
||||
struct text defines; /* #define statements */
|
||||
@ -148,20 +148,20 @@ struct text decls; /* declarations */
|
||||
int amiddecls; /* for formatting */
|
||||
|
||||
|
||||
void readfile(char *);
|
||||
int match(char *, char *);
|
||||
int gooddefine(char *);
|
||||
void doevent(struct event *, FILE *, char *);
|
||||
void readfile(const char *);
|
||||
int match(const char *, const char *);
|
||||
int gooddefine(const char *);
|
||||
void doevent(struct event *, FILE *, const char *);
|
||||
void doinclude(char *);
|
||||
void dodecl(char *, FILE *);
|
||||
void output(void);
|
||||
void addstr(char *, struct text *);
|
||||
void addstr(const char *, struct text *);
|
||||
void addchar(int, struct text *);
|
||||
void writetext(struct text *, FILE *);
|
||||
FILE *ckfopen(char *, char *);
|
||||
FILE *ckfopen(const char *, const char *);
|
||||
void *ckmalloc(size_t);
|
||||
char *savestr(char *);
|
||||
void error(char *);
|
||||
char *savestr(const char *);
|
||||
void error(const char *);
|
||||
|
||||
#define equal(s1, s2) (strcmp(s1, s2) == 0)
|
||||
|
||||
@ -170,9 +170,9 @@ main(int argc __unused, char *argv[])
|
||||
{
|
||||
char **ap;
|
||||
|
||||
header_files[0] = "\"shell.h\"";
|
||||
header_files[1] = "\"mystring.h\"";
|
||||
header_files[2] = "\"init.h\"";
|
||||
header_files[0] = savestr("\"shell.h\"");
|
||||
header_files[1] = savestr("\"mystring.h\"");
|
||||
header_files[2] = savestr("\"init.h\"");
|
||||
for (ap = argv + 1 ; *ap ; ap++)
|
||||
readfile(*ap);
|
||||
output();
|
||||
@ -186,7 +186,7 @@ main(int argc __unused, char *argv[])
|
||||
*/
|
||||
|
||||
void
|
||||
readfile(char *fname)
|
||||
readfile(const char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
char line[1024];
|
||||
@ -230,9 +230,9 @@ readfile(char *fname)
|
||||
|
||||
|
||||
int
|
||||
match(char *name, char *line)
|
||||
match(const char *name, const char *line)
|
||||
{
|
||||
char *p, *q;
|
||||
const char *p, *q;
|
||||
|
||||
p = name, q = line;
|
||||
while (*p) {
|
||||
@ -246,9 +246,9 @@ match(char *name, char *line)
|
||||
|
||||
|
||||
int
|
||||
gooddefine(char *line)
|
||||
gooddefine(const char *line)
|
||||
{
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
if (! match("#define", line))
|
||||
return 0; /* not a define */
|
||||
@ -269,11 +269,11 @@ gooddefine(char *line)
|
||||
|
||||
|
||||
void
|
||||
doevent(struct event *ep, FILE *fp, char *fname)
|
||||
doevent(struct event *ep, FILE *fp, const char *fname)
|
||||
{
|
||||
char line[1024];
|
||||
int indent;
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
sprintf(line, "\n /* from %s: */\n", fname);
|
||||
addstr(line, &ep->code);
|
||||
@ -407,7 +407,7 @@ output(void)
|
||||
*/
|
||||
|
||||
void
|
||||
addstr(char *s, struct text *text)
|
||||
addstr(const char *s, struct text *text)
|
||||
{
|
||||
while (*s) {
|
||||
if (--text->nleft < 0)
|
||||
@ -452,7 +452,7 @@ writetext(struct text *text, FILE *fp)
|
||||
}
|
||||
|
||||
FILE *
|
||||
ckfopen(char *file, char *mode)
|
||||
ckfopen(const char *file, const char *mode)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
@ -474,7 +474,7 @@ ckmalloc(size_t nbytes)
|
||||
}
|
||||
|
||||
char *
|
||||
savestr(char *s)
|
||||
savestr(const char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -484,7 +484,7 @@ savestr(char *s)
|
||||
}
|
||||
|
||||
void
|
||||
error(char *msg)
|
||||
error(const char *msg)
|
||||
{
|
||||
if (curfile != NULL)
|
||||
fprintf(stderr, "%s:%d: ", curfile, linno);
|
||||
|
@ -55,8 +55,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
|
||||
struct synclass {
|
||||
char *name;
|
||||
char *comment;
|
||||
const char *name;
|
||||
const char *comment;
|
||||
};
|
||||
|
||||
/* Syntax classes */
|
||||
@ -101,16 +101,16 @@ static char writer[] = "\
|
||||
|
||||
static FILE *cfile;
|
||||
static FILE *hfile;
|
||||
static char *syntax[513];
|
||||
static const char *syntax[513];
|
||||
static int base;
|
||||
static int size; /* number of values which a char variable can have */
|
||||
static int nbits; /* number of bits in a character */
|
||||
static int digit_contig;/* true if digits are contiguous */
|
||||
|
||||
static void filltable(char *);
|
||||
static void filltable(const char *);
|
||||
static void init(void);
|
||||
static void add(char *, char *);
|
||||
static void print(char *);
|
||||
static void add(const char *, const char *);
|
||||
static void print(const char *);
|
||||
static void output_type_macros(void);
|
||||
static void digit_convert(void);
|
||||
|
||||
@ -259,7 +259,7 @@ main(int argc __unused, char **argv __unused)
|
||||
*/
|
||||
|
||||
static void
|
||||
filltable(char *dftval)
|
||||
filltable(const char *dftval)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -293,7 +293,7 @@ init(void)
|
||||
*/
|
||||
|
||||
static void
|
||||
add(char *p, char *type)
|
||||
add(const char *p, const char *type)
|
||||
{
|
||||
while (*p)
|
||||
syntax[*p++ + base] = type;
|
||||
@ -306,7 +306,7 @@ add(char *p, char *type)
|
||||
*/
|
||||
|
||||
static void
|
||||
print(char *name)
|
||||
print(const char *name)
|
||||
{
|
||||
int i;
|
||||
int col;
|
||||
@ -338,7 +338,7 @@ print(char *name)
|
||||
* contiguous, we can test for them quickly.
|
||||
*/
|
||||
|
||||
static char *macro[] = {
|
||||
static const char *macro[] = {
|
||||
"#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)",
|
||||
"#define is_eof(c)\t((c) == PEOF)",
|
||||
"#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))",
|
||||
@ -351,7 +351,7 @@ static char *macro[] = {
|
||||
static void
|
||||
output_type_macros(void)
|
||||
{
|
||||
char **pp;
|
||||
const char **pp;
|
||||
|
||||
if (digit_contig)
|
||||
macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)";
|
||||
|
@ -108,7 +108,7 @@ int
|
||||
number(const char *s)
|
||||
{
|
||||
if (! is_number(s))
|
||||
error("Illegal number: %s", (char *)s);
|
||||
error("Illegal number: %s", s);
|
||||
return atoi(s);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ char *arg0; /* value of $0 */
|
||||
struct shparam shellparam; /* current positional parameters */
|
||||
char **argptr; /* argument list for builtin commands */
|
||||
char *shoptarg; /* set by nextopt (like getopt) */
|
||||
char *optptr; /* used by nextopt */
|
||||
char *nextopt_optptr; /* used by nextopt */
|
||||
|
||||
char *minusc; /* argument to -c option */
|
||||
|
||||
@ -560,7 +560,7 @@ nextopt(const char *optstring)
|
||||
const char *q;
|
||||
char c;
|
||||
|
||||
if ((p = optptr) == NULL || *p == '\0') {
|
||||
if ((p = nextopt_optptr) == NULL || *p == '\0') {
|
||||
p = *argptr;
|
||||
if (p == NULL || *p != '-' || *++p == '\0')
|
||||
return '\0';
|
||||
@ -581,6 +581,6 @@ nextopt(const char *optstring)
|
||||
shoptarg = p;
|
||||
p = NULL;
|
||||
}
|
||||
optptr = p;
|
||||
nextopt_optptr = p;
|
||||
return c;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ extern char *arg0; /* $0 */
|
||||
extern struct shparam shellparam; /* $@ */
|
||||
extern char **argptr; /* argument list for builtin commands */
|
||||
extern char *shoptarg; /* set by nextopt */
|
||||
extern char *optptr; /* used by nextopt */
|
||||
extern char *nextopt_optptr; /* used by nextopt */
|
||||
|
||||
void procargs(int, char **);
|
||||
void optschanged(void);
|
||||
|
@ -113,7 +113,7 @@ STATIC int xxreadtoken(void);
|
||||
STATIC int readtoken1(int, char const *, char *, int);
|
||||
STATIC int noexpand(char *);
|
||||
STATIC void synexpect(int);
|
||||
STATIC void synerror(char *);
|
||||
STATIC void synerror(const char *);
|
||||
STATIC void setprompt(int);
|
||||
|
||||
|
||||
@ -1547,7 +1547,7 @@ synexpect(int token)
|
||||
|
||||
|
||||
STATIC void
|
||||
synerror(char *msg)
|
||||
synerror(const char *msg)
|
||||
{
|
||||
if (commandname)
|
||||
outfmt(&errout, "%s: %d: ", commandname, startlinno);
|
||||
@ -1579,13 +1579,14 @@ getprompt(void *unused __unused)
|
||||
static char ps[PROMPTLEN];
|
||||
char *fmt;
|
||||
int i, j, trim;
|
||||
static char internal_error[] = "<internal prompt error>";
|
||||
|
||||
/*
|
||||
* Select prompt format.
|
||||
*/
|
||||
switch (whichprompt) {
|
||||
case 0:
|
||||
fmt = "";
|
||||
fmt = nullstr;
|
||||
break;
|
||||
case 1:
|
||||
fmt = ps1val();
|
||||
@ -1594,7 +1595,7 @@ getprompt(void *unused __unused)
|
||||
fmt = ps2val();
|
||||
break;
|
||||
default:
|
||||
return "<internal prompt error>";
|
||||
return internal_error;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -73,6 +73,7 @@
|
||||
extern int tokpushback;
|
||||
#define NEOF ((union node *)&tokpushback)
|
||||
extern int whichprompt; /* 1 == PS1, 2 == PS2 */
|
||||
extern const char *const parsekwd[];
|
||||
|
||||
|
||||
union node *parsecmd(int);
|
||||
|
@ -132,9 +132,9 @@ STATIC int localevar(const char *);
|
||||
|
||||
#ifdef mkinit
|
||||
INCLUDE "var.h"
|
||||
MKINIT char **environ;
|
||||
INIT {
|
||||
char **envp;
|
||||
extern char **environ;
|
||||
|
||||
initvar();
|
||||
for (envp = environ ; *envp ; envp++) {
|
||||
@ -258,11 +258,11 @@ setvar(const char *name, const char *val, int flags)
|
||||
STATIC int
|
||||
localevar(const char *s)
|
||||
{
|
||||
static char *lnames[7] = {
|
||||
static const char *lnames[7] = {
|
||||
"ALL", "COLLATE", "CTYPE", "MONETARY",
|
||||
"NUMERIC", "TIME", NULL
|
||||
};
|
||||
char **ss;
|
||||
const char **ss;
|
||||
|
||||
if (*s != 'L')
|
||||
return 0;
|
||||
@ -469,9 +469,9 @@ environment(void)
|
||||
* VSTACK set since these are currently allocated on the stack.
|
||||
*/
|
||||
|
||||
#ifdef mkinit
|
||||
MKINIT void shprocvar(void);
|
||||
|
||||
#ifdef mkinit
|
||||
SHELLPROC {
|
||||
shprocvar();
|
||||
}
|
||||
|
@ -108,7 +108,6 @@ void listsetvar(struct strlist *);
|
||||
char *lookupvar(const char *);
|
||||
char *bltinlookup(const char *, int);
|
||||
char **environment(void);
|
||||
void shprocvar(void);
|
||||
int showvarscmd(int, char **);
|
||||
int exportcmd(int, char **);
|
||||
int localcmd(int, char **);
|
||||
|
Loading…
x
Reference in New Issue
Block a user