Patch from Aaron Lehmann <aaronl@vitelus.com>;
This diff does 2 things: 1) removes an unnecessary function. saves 64 bytes on i386 2) allows you to disable checking of mail (actually, it's now disabled by default). this would be a nice CML1 option, but for now it's a #(define|undef) in the C file like the other internal ash options. this saves an additional 352 bytes if you leave mail disabled.
This commit is contained in:
parent
31a0ece3a7
commit
ec07469a3e
50
shell/ash.c
50
shell/ash.c
@ -67,6 +67,8 @@
|
|||||||
* standalone shell. Adds about 272 bytes. */
|
* standalone shell. Adds about 272 bytes. */
|
||||||
#undef ASH_CMDCMD
|
#undef ASH_CMDCMD
|
||||||
|
|
||||||
|
/* Check for new mail on interactive shells? */
|
||||||
|
#undef ASH_MAIL
|
||||||
|
|
||||||
/* Optimize size vs speed as size */
|
/* Optimize size vs speed as size */
|
||||||
#define ASH_OPTIMIZE_FOR_SIZE
|
#define ASH_OPTIMIZE_FOR_SIZE
|
||||||
@ -1399,16 +1401,6 @@ rmaliases(void)
|
|||||||
INTON;
|
INTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct alias *
|
|
||||||
lookupalias(const char *name, int check)
|
|
||||||
{
|
|
||||||
struct alias *ap = *__lookupalias(name);
|
|
||||||
|
|
||||||
if (check && ap && (ap->flag & ALIASINUSE))
|
|
||||||
return (NULL);
|
|
||||||
return (ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
printalias(const struct alias *ap) {
|
printalias(const struct alias *ap) {
|
||||||
char *p;
|
char *p;
|
||||||
@ -3101,8 +3093,10 @@ true_main(argc, argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void setsignal(int signo);
|
static void setsignal(int signo);
|
||||||
static void chkmail(int silent);
|
|
||||||
|
|
||||||
|
#ifdef ASH_MAIL
|
||||||
|
static void chkmail(int silent);
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setinteractive(int on)
|
setinteractive(int on)
|
||||||
@ -3115,7 +3109,9 @@ setinteractive(int on)
|
|||||||
setsignal(SIGINT);
|
setsignal(SIGINT);
|
||||||
setsignal(SIGQUIT);
|
setsignal(SIGQUIT);
|
||||||
setsignal(SIGTERM);
|
setsignal(SIGTERM);
|
||||||
|
#ifdef ASH_MAIL
|
||||||
chkmail(1);
|
chkmail(1);
|
||||||
|
#endif
|
||||||
is_interactive = on;
|
is_interactive = on;
|
||||||
if (do_banner==0 && is_interactive) {
|
if (do_banner==0 && is_interactive) {
|
||||||
/* Looks like they want an interactive shell */
|
/* Looks like they want an interactive shell */
|
||||||
@ -3576,7 +3572,7 @@ hashcmd(argc, argv)
|
|||||||
delete_cmd_entry();
|
delete_cmd_entry();
|
||||||
#ifdef ASH_ALIAS
|
#ifdef ASH_ALIAS
|
||||||
/* Then look at the aliases */
|
/* Then look at the aliases */
|
||||||
if ((ap = lookupalias(name, 0)) != NULL) {
|
if ((ap = *__lookupalias(name)) != NULL) {
|
||||||
if (verbose=='v')
|
if (verbose=='v')
|
||||||
printf("%s is an alias for %s\n", name, ap->val);
|
printf("%s is an alias for %s\n", name, ap->val);
|
||||||
else
|
else
|
||||||
@ -7523,8 +7519,11 @@ static void waitonint(int sig) {
|
|||||||
intreceived = 1;
|
intreceived = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ASH_MAIL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routines to check for mail. (Perhaps make part of main.c?)
|
* Routines to check for mail.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -7582,6 +7581,8 @@ chkmail(int silent)
|
|||||||
popstackmark(&smark);
|
popstackmark(&smark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* ASH_MAIL */
|
||||||
|
|
||||||
#define PROFILE 0
|
#define PROFILE 0
|
||||||
|
|
||||||
#if PROFILE
|
#if PROFILE
|
||||||
@ -7749,7 +7750,9 @@ cmdloop(int top)
|
|||||||
if (iflag && top) {
|
if (iflag && top) {
|
||||||
inter++;
|
inter++;
|
||||||
showjobs(1);
|
showjobs(1);
|
||||||
|
#ifdef ASH_MAIL
|
||||||
chkmail(0);
|
chkmail(0);
|
||||||
|
#endif
|
||||||
flushall();
|
flushall();
|
||||||
}
|
}
|
||||||
n = parsecmd(inter);
|
n = parsecmd(inter);
|
||||||
@ -10188,7 +10191,7 @@ top:
|
|||||||
lasttoken = t = TASSIGN;
|
lasttoken = t = TASSIGN;
|
||||||
#ifdef ASH_ALIAS
|
#ifdef ASH_ALIAS
|
||||||
} else if (checkalias) {
|
} else if (checkalias) {
|
||||||
if (!quoteflag && (ap = lookupalias(wordtext, 1)) != NULL) {
|
if (!quoteflag && (ap = *__lookupalias(wordtext)) != NULL && !(ap->flag & ALIASINUSE)) {
|
||||||
if (*ap->val) {
|
if (*ap->val) {
|
||||||
pushstring(ap->val, strlen(ap->val), ap);
|
pushstring(ap->val, strlen(ap->val), ap);
|
||||||
}
|
}
|
||||||
@ -11454,6 +11457,9 @@ dup_as_newfd(from, to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
/*
|
||||||
|
* Debugging stuff.
|
||||||
|
*/
|
||||||
static void shtree (union node *, int, char *, FILE*);
|
static void shtree (union node *, int, char *, FILE*);
|
||||||
static void shcmd (union node *, FILE *);
|
static void shcmd (union node *, FILE *);
|
||||||
static void sharg (union node *, FILE *);
|
static void sharg (union node *, FILE *);
|
||||||
@ -11578,8 +11584,6 @@ shcmd(cmd, fp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sharg(arg, fp)
|
sharg(arg, fp)
|
||||||
union node *arg;
|
union node *arg;
|
||||||
@ -11681,16 +11685,8 @@ indent(amount, pfx, fp)
|
|||||||
putc('\t', fp);
|
putc('\t', fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Debugging stuff.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
FILE *tracefile;
|
FILE *tracefile;
|
||||||
|
|
||||||
#if DEBUG == 2
|
#if DEBUG == 2
|
||||||
@ -12200,12 +12196,14 @@ setvareq(s, flags)
|
|||||||
vp->flags |= flags;
|
vp->flags |= flags;
|
||||||
vp->text = s;
|
vp->text = s;
|
||||||
|
|
||||||
|
#ifdef ASH_MAIL
|
||||||
/*
|
/*
|
||||||
* We could roll this to a function, to handle it as
|
* We could roll this to a function, to handle it as
|
||||||
* a regular variable function callback, but why bother?
|
* a regular variable function callback, but why bother?
|
||||||
*/
|
*/
|
||||||
if (iflag && (vp == &vmpath || (vp == &vmail && !mpathset())))
|
if (iflag && (vp == &vmpath || (vp == &vmail && !mpathset())))
|
||||||
chkmail(1);
|
chkmail(1);
|
||||||
|
#endif
|
||||||
INTON;
|
INTON;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -12246,7 +12244,7 @@ listsetvar(mylist)
|
|||||||
static const char *
|
static const char *
|
||||||
lookupvar(name)
|
lookupvar(name)
|
||||||
const char *name;
|
const char *name;
|
||||||
{
|
{
|
||||||
struct var *v;
|
struct var *v;
|
||||||
|
|
||||||
if ((v = *findvar(hashvar(name), name)) && !(v->flags & VUNSET)) {
|
if ((v = *findvar(hashvar(name), name)) && !(v->flags & VUNSET)) {
|
||||||
@ -12650,7 +12648,7 @@ findvar(struct var **vpp, const char *name)
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
|
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
|
||||||
* This file contains code for the times builtin.
|
* This file contains code for the times builtin.
|
||||||
* $Id: ash.c,v 1.33 2001/10/31 10:40:37 andersen Exp $
|
* $Id: ash.c,v 1.34 2001/10/31 11:05:49 andersen Exp $
|
||||||
*/
|
*/
|
||||||
static int timescmd (int argc, char **argv)
|
static int timescmd (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user