* standalone shell. Adds about 272 bytes. */
#undef ASH_CMDCMD
+/* Check for new mail on interactive shells? */
+#undef ASH_MAIL
/* Optimize size vs speed as size */
#define ASH_OPTIMIZE_FOR_SIZE
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
printalias(const struct alias *ap) {
char *p;
*/
static void setsignal(int signo);
-static void chkmail(int silent);
+#ifdef ASH_MAIL
+static void chkmail(int silent);
+#endif
static void
setinteractive(int on)
setsignal(SIGINT);
setsignal(SIGQUIT);
setsignal(SIGTERM);
+#ifdef ASH_MAIL
chkmail(1);
+#endif
is_interactive = on;
if (do_banner==0 && is_interactive) {
/* Looks like they want an interactive shell */
delete_cmd_entry();
#ifdef ASH_ALIAS
/* Then look at the aliases */
- if ((ap = lookupalias(name, 0)) != NULL) {
+ if ((ap = *__lookupalias(name)) != NULL) {
if (verbose=='v')
printf("%s is an alias for %s\n", name, ap->val);
else
intreceived = 1;
return;
}
+
+#ifdef ASH_MAIL
+
/*
- * Routines to check for mail. (Perhaps make part of main.c?)
+ * Routines to check for mail.
*/
popstackmark(&smark);
}
+#endif /* ASH_MAIL */
+
#define PROFILE 0
#if PROFILE
if (iflag && top) {
inter++;
showjobs(1);
+#ifdef ASH_MAIL
chkmail(0);
+#endif
flushall();
}
n = parsecmd(inter);
lasttoken = t = TASSIGN;
#ifdef ASH_ALIAS
} else if (checkalias) {
- if (!quoteflag && (ap = lookupalias(wordtext, 1)) != NULL) {
+ if (!quoteflag && (ap = *__lookupalias(wordtext)) != NULL && !(ap->flag & ALIASINUSE)) {
if (*ap->val) {
pushstring(ap->val, strlen(ap->val), ap);
}
}
#ifdef DEBUG
+/*
+ * Debugging stuff.
+ */
static void shtree (union node *, int, char *, FILE*);
static void shcmd (union node *, FILE *);
static void sharg (union node *, FILE *);
}
}
-
-
static void
sharg(arg, fp)
union node *arg;
putc('\t', fp);
}
}
-#endif
-
-
-
-/*
- * Debugging stuff.
- */
-#ifdef DEBUG
FILE *tracefile;
#if DEBUG == 2
vp->flags |= flags;
vp->text = s;
+#ifdef ASH_MAIL
/*
* We could roll this to a function, to handle it as
* a regular variable function callback, but why bother?
*/
if (iflag && (vp == &vmpath || (vp == &vmail && !mpathset())))
chkmail(1);
+#endif
INTON;
return;
}
static const char *
lookupvar(name)
const char *name;
- {
+{
struct var *v;
if ((v = *findvar(hashvar(name), name)) && !(v->flags & VUNSET)) {
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* 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)
{