From 6646fff759c06b4d9633c5b917cece5de1fdc9b7 Mon Sep 17 00:00:00 2001 From: tg Date: Wed, 17 Jan 2007 18:01:51 +0000 Subject: [PATCH] oops unbreak -DMKSH_NOPWNAM --- eval.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/eval.c b/eval.c index ccfc5df..3bce92f 100644 --- a/eval.c +++ b/eval.c @@ -2,7 +2,11 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.21 2007/01/17 17:42:22 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.22 2007/01/17 18:01:51 tg Exp $"); + +#ifdef MKSH_SMALL +#define MKSH_NOPWNAM +#endif /* * string expansion @@ -43,10 +47,8 @@ static void glob(char *, XPtrV *, int); static void globit(XString *, char **, char *, XPtrV *, int); static char *maybe_expand_tilde(char *, XString *, char **, int); static char *tilde(char *); -#ifndef MKSH_SMALL +#ifndef MKSH_NOPWNAM static char *homedir(char *); -#else -#define homedir(x) null #endif static void alt_expand(XPtrV *, char *, char *, char *, int); @@ -1159,7 +1161,7 @@ maybe_expand_tilde(char *p, XString *dsp, char **dpp, int isassign) static char * tilde(char *cp) { - char *dp; + char *dp = null; if (cp[0] == '\0') dp = str_val(global("HOME")); @@ -1167,15 +1169,17 @@ tilde(char *cp) dp = str_val(global("PWD")); else if (cp[0] == '-' && cp[1] == '\0') dp = str_val(global("OLDPWD")); +#ifndef MKSH_NOPWNAM else dp = homedir(cp); +#endif /* If HOME, PWD or OLDPWD are not set, don't expand ~ */ if (dp == null) dp = NULL; return dp; } -#if !defined(MKSH_SMALL) && !defined(MKSH_NOPWNAM) +#ifndef MKSH_NOPWNAM /* * map userid to user's home directory. * note that 4.3's getpw adds more than 6K to the shell,