kill dead code
This commit is contained in:
parent
fa0d9fc499
commit
79a083baaa
6
sh.h
6
sh.h
@ -164,7 +164,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.648 2013/04/26 17:23:15 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.649 2013/04/26 18:27:06 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R44 2013/03/31"
|
#define MKSH_VERSION "R44 2013/03/31"
|
||||||
|
|
||||||
@ -1263,10 +1263,6 @@ EXTERN const char *prompt;
|
|||||||
EXTERN int cur_prompt; /* PS1 or PS2 */
|
EXTERN int cur_prompt; /* PS1 or PS2 */
|
||||||
EXTERN int current_lineno; /* LINENO value */
|
EXTERN int current_lineno; /* LINENO value */
|
||||||
|
|
||||||
#define NOBLOCK ((struct op *)NULL)
|
|
||||||
#define NOWORD ((char *)NULL)
|
|
||||||
#define NOWORDS ((char **)NULL)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Description of a command or an operation on commands.
|
* Description of a command or an operation on commands.
|
||||||
*/
|
*/
|
||||||
|
30
syn.c
30
syn.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.88 2012/12/28 02:28:39 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.89 2013/04/26 18:27:07 tg Exp $");
|
||||||
|
|
||||||
struct nesting_state {
|
struct nesting_state {
|
||||||
int start_token; /* token than began nesting (eg, FOR) */
|
int start_token; /* token than began nesting (eg, FOR) */
|
||||||
@ -53,7 +53,7 @@ static struct op *caselist(void);
|
|||||||
static struct op *casepart(int);
|
static struct op *casepart(int);
|
||||||
static struct op *function_body(char *, bool);
|
static struct op *function_body(char *, bool);
|
||||||
static char **wordlist(void);
|
static char **wordlist(void);
|
||||||
static struct op *block(int, struct op *, struct op *, char **);
|
static struct op *block(int, struct op *, struct op *);
|
||||||
static struct op *newtp(int);
|
static struct op *newtp(int);
|
||||||
static void syntaxerr(const char *) MKSH_A_NORETURN;
|
static void syntaxerr(const char *) MKSH_A_NORETURN;
|
||||||
static void nesting_push(struct nesting_state *, int);
|
static void nesting_push(struct nesting_state *, int);
|
||||||
@ -108,9 +108,9 @@ pipeline(int cf)
|
|||||||
if ((p = get_command(CONTIN)) == NULL)
|
if ((p = get_command(CONTIN)) == NULL)
|
||||||
syntaxerr(NULL);
|
syntaxerr(NULL);
|
||||||
if (tl == NULL)
|
if (tl == NULL)
|
||||||
t = tl = block(TPIPE, t, p, NOWORDS);
|
t = tl = block(TPIPE, t, p);
|
||||||
else
|
else
|
||||||
tl = tl->right = block(TPIPE, tl->right, p, NOWORDS);
|
tl = tl->right = block(TPIPE, tl->right, p);
|
||||||
}
|
}
|
||||||
REJECT;
|
REJECT;
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ andor(void)
|
|||||||
while ((c = token(0)) == LOGAND || c == LOGOR) {
|
while ((c = token(0)) == LOGAND || c == LOGOR) {
|
||||||
if ((p = pipeline(CONTIN)) == NULL)
|
if ((p = pipeline(CONTIN)) == NULL)
|
||||||
syntaxerr(NULL);
|
syntaxerr(NULL);
|
||||||
t = block(c == LOGAND? TAND: TOR, t, p, NOWORDS);
|
t = block(c == LOGAND? TAND: TOR, t, p);
|
||||||
}
|
}
|
||||||
REJECT;
|
REJECT;
|
||||||
}
|
}
|
||||||
@ -157,16 +157,15 @@ c_list(bool multi)
|
|||||||
} else if (!p)
|
} else if (!p)
|
||||||
break;
|
break;
|
||||||
else if (c == '&' || c == COPROC)
|
else if (c == '&' || c == COPROC)
|
||||||
p = block(c == '&' ? TASYNC : TCOPROC,
|
p = block(c == '&' ? TASYNC : TCOPROC, p, NULL);
|
||||||
p, NOBLOCK, NOWORDS);
|
|
||||||
else if (c != ';')
|
else if (c != ';')
|
||||||
have_sep = false;
|
have_sep = false;
|
||||||
if (!t)
|
if (!t)
|
||||||
t = p;
|
t = p;
|
||||||
else if (!tl)
|
else if (!tl)
|
||||||
t = tl = block(TLIST, t, p, NOWORDS);
|
t = tl = block(TLIST, t, p);
|
||||||
else
|
else
|
||||||
tl = tl->right = block(TLIST, tl->right, p, NOWORDS);
|
tl = tl->right = block(TLIST, tl->right, p);
|
||||||
if (!have_sep)
|
if (!have_sep)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -240,7 +239,7 @@ nested(int type, int smark, int emark)
|
|||||||
t = c_list(true);
|
t = c_list(true);
|
||||||
musthave(emark, KEYWORD|sALIAS);
|
musthave(emark, KEYWORD|sALIAS);
|
||||||
nesting_pop(&old_nesting);
|
nesting_pop(&old_nesting);
|
||||||
return (block(type, t, NOBLOCK, NOWORDS));
|
return (block(type, t, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char let_cmd[] = {
|
static const char let_cmd[] = {
|
||||||
@ -465,7 +464,7 @@ get_command(int cf)
|
|||||||
t = pipeline(0);
|
t = pipeline(0);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
syntaxerr(NULL);
|
syntaxerr(NULL);
|
||||||
t = block(TBANG, NOBLOCK, t, NOWORDS);
|
t = block(TBANG, NULL, t);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TIME:
|
case TIME:
|
||||||
@ -477,7 +476,7 @@ get_command(int cf)
|
|||||||
t->str[0] = '\0';
|
t->str[0] = '\0';
|
||||||
t->str[1] = '\0';
|
t->str[1] = '\0';
|
||||||
}
|
}
|
||||||
t = block(TTIME, t, NOBLOCK, NOWORDS);
|
t = block(TTIME, t, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION:
|
case FUNCTION:
|
||||||
@ -505,7 +504,7 @@ get_command(int cf)
|
|||||||
XPput(args, NULL);
|
XPput(args, NULL);
|
||||||
t->args = (const char **)XPclose(args);
|
t->args = (const char **)XPclose(args);
|
||||||
XPput(vars, NULL);
|
XPput(vars, NULL);
|
||||||
t->vars = (char **) XPclose(vars);
|
t->vars = (char **)XPclose(vars);
|
||||||
} else {
|
} else {
|
||||||
XPfree(args);
|
XPfree(args);
|
||||||
XPfree(vars);
|
XPfree(vars);
|
||||||
@ -632,7 +631,7 @@ casepart(int endtok)
|
|||||||
} while (token(0) == '|');
|
} while (token(0) == '|');
|
||||||
REJECT;
|
REJECT;
|
||||||
XPput(ptns, NULL);
|
XPput(ptns, NULL);
|
||||||
t->vars = (char **) XPclose(ptns);
|
t->vars = (char **)XPclose(ptns);
|
||||||
musthave(')', 0);
|
musthave(')', 0);
|
||||||
|
|
||||||
t->left = c_list(true);
|
t->left = c_list(true);
|
||||||
@ -757,14 +756,13 @@ wordlist(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static struct op *
|
static struct op *
|
||||||
block(int type, struct op *t1, struct op *t2, char **wp)
|
block(int type, struct op *t1, struct op *t2)
|
||||||
{
|
{
|
||||||
struct op *t;
|
struct op *t;
|
||||||
|
|
||||||
t = newtp(type);
|
t = newtp(type);
|
||||||
t->left = t1;
|
t->left = t1;
|
||||||
t->right = t2;
|
t->right = t2;
|
||||||
t->vars = wp;
|
|
||||||
return (t);
|
return (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user