diff --git a/eval.c b/eval.c index 648b90e..fda1d4f 100644 --- a/eval.c +++ b/eval.c @@ -22,11 +22,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.62 2009/07/25 20:17:47 tg Exp $"); - -#if defined(MKSH_SMALL) && !defined(MKSH_NOPWNAM) -#define MKSH_NOPWNAM -#endif +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.63 2009/07/25 20:26:31 tg Exp $"); /* * string expansion diff --git a/funcs.c b/funcs.c index cd46a08..bb7d6b2 100644 --- a/funcs.c +++ b/funcs.c @@ -25,7 +25,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.115 2009/06/11 12:42:18 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.116 2009/07/25 20:26:32 tg Exp $"); #if HAVE_KILLPG /* @@ -1048,8 +1048,8 @@ c_alias(const char **wp) prefix = builtin_opt.info & GI_PLUS ? '+' : '-'; switch (optc) { case 'd': -#ifdef MKSH_SMALL - return (0); +#ifdef MKSH_NOPWNAM + t = NULL; /* fix "alias -dt" */ #else t = &homedirs; #endif @@ -1077,6 +1077,10 @@ c_alias(const char **wp) return (1); } } +#ifdef MKSH_NOPWNAM + if (t == NULL) + return (0); +#endif wp += builtin_opt.optind; if (!(builtin_opt.info & GI_MINUSMINUS) && *wp && @@ -1187,8 +1191,8 @@ c_unalias(const char **wp) all = true; break; case 'd': -#ifdef MKSH_SMALL - return (0); +#ifdef MKSH_NOPWNAM + t = NULL; /* fix "unalias -dt" */ #else t = &homedirs; #endif @@ -1199,6 +1203,10 @@ c_unalias(const char **wp) case '?': return (1); } +#ifdef MKSH_NOPWNAM + if (t == NULL) + return (0); +#endif wp += builtin_opt.optind; for (; *wp != NULL; wp++) { diff --git a/main.c b/main.c index 095f13e..962278e 100644 --- a/main.c +++ b/main.c @@ -33,7 +33,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.133 2009/06/11 12:42:19 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.134 2009/07/25 20:26:32 tg Exp $"); extern char **environ; @@ -141,7 +141,7 @@ main(int argc, const char *argv[]) /* set up variable and command dictionaries */ ktinit(&taliases, APERM, 0); ktinit(&aliases, APERM, 0); -#ifndef MKSH_SMALL +#ifndef MKSH_NOPWNAM ktinit(&homedirs, APERM, 0); #endif diff --git a/sh.h b/sh.h index b9bb115..b578b78 100644 --- a/sh.h +++ b/sh.h @@ -122,7 +122,7 @@ #define __SCCSID(x) __IDSTRING(sccsid,x) #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.314 2009/07/25 20:18:13 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.315 2009/07/25 20:26:33 tg Exp $"); #endif #define MKSH_VERSION "R39 2009/07/16" @@ -430,9 +430,14 @@ char *ucstrstr(char *, const char *); #define stristr(b,l) ((const char *)strcasestr((b), (l))) #endif -#if defined(MKSH_SMALL) && !defined(MKSH_NOVI) +#ifdef MKSH_SMALL +#ifndef MKSH_NOPWNAM +#define MKSH_NOPWNAM +#endif +#ifndef MKSH_NOVI #define MKSH_NOVI #endif +#endif /* * simple grouping allocator @@ -951,7 +956,7 @@ EXTERN struct table taliases; /* tracked aliases */ EXTERN struct table builtins; /* built-in commands */ EXTERN struct table aliases; /* aliases */ EXTERN struct table keywords; /* keywords */ -#ifndef MKSH_SMALL +#ifndef MKSH_NOPWNAM EXTERN struct table homedirs; /* homedir() cache */ #endif