improve MKSH_NOPWNAM handling, whether MKSH_SMALL or not; it will cause
the entire ~fac/ expansion code to be omitted
This commit is contained in:
parent
5e3aba8b00
commit
bcf4080793
6
eval.c
6
eval.c
@ -22,11 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.62 2009/07/25 20:17:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.63 2009/07/25 20:26:31 tg Exp $");
|
||||||
|
|
||||||
#if defined(MKSH_SMALL) && !defined(MKSH_NOPWNAM)
|
|
||||||
#define MKSH_NOPWNAM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* string expansion
|
* string expansion
|
||||||
|
18
funcs.c
18
funcs.c
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@ -1048,8 +1048,8 @@ c_alias(const char **wp)
|
|||||||
prefix = builtin_opt.info & GI_PLUS ? '+' : '-';
|
prefix = builtin_opt.info & GI_PLUS ? '+' : '-';
|
||||||
switch (optc) {
|
switch (optc) {
|
||||||
case 'd':
|
case 'd':
|
||||||
#ifdef MKSH_SMALL
|
#ifdef MKSH_NOPWNAM
|
||||||
return (0);
|
t = NULL; /* fix "alias -dt" */
|
||||||
#else
|
#else
|
||||||
t = &homedirs;
|
t = &homedirs;
|
||||||
#endif
|
#endif
|
||||||
@ -1077,6 +1077,10 @@ c_alias(const char **wp)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef MKSH_NOPWNAM
|
||||||
|
if (t == NULL)
|
||||||
|
return (0);
|
||||||
|
#endif
|
||||||
wp += builtin_opt.optind;
|
wp += builtin_opt.optind;
|
||||||
|
|
||||||
if (!(builtin_opt.info & GI_MINUSMINUS) && *wp &&
|
if (!(builtin_opt.info & GI_MINUSMINUS) && *wp &&
|
||||||
@ -1187,8 +1191,8 @@ c_unalias(const char **wp)
|
|||||||
all = true;
|
all = true;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
#ifdef MKSH_SMALL
|
#ifdef MKSH_NOPWNAM
|
||||||
return (0);
|
t = NULL; /* fix "unalias -dt" */
|
||||||
#else
|
#else
|
||||||
t = &homedirs;
|
t = &homedirs;
|
||||||
#endif
|
#endif
|
||||||
@ -1199,6 +1203,10 @@ c_unalias(const char **wp)
|
|||||||
case '?':
|
case '?':
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
#ifdef MKSH_NOPWNAM
|
||||||
|
if (t == NULL)
|
||||||
|
return (0);
|
||||||
|
#endif
|
||||||
wp += builtin_opt.optind;
|
wp += builtin_opt.optind;
|
||||||
|
|
||||||
for (; *wp != NULL; wp++) {
|
for (; *wp != NULL; wp++) {
|
||||||
|
4
main.c
4
main.c
@ -33,7 +33,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#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;
|
extern char **environ;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ main(int argc, const char *argv[])
|
|||||||
/* set up variable and command dictionaries */
|
/* set up variable and command dictionaries */
|
||||||
ktinit(&taliases, APERM, 0);
|
ktinit(&taliases, APERM, 0);
|
||||||
ktinit(&aliases, APERM, 0);
|
ktinit(&aliases, APERM, 0);
|
||||||
#ifndef MKSH_SMALL
|
#ifndef MKSH_NOPWNAM
|
||||||
ktinit(&homedirs, APERM, 0);
|
ktinit(&homedirs, APERM, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
11
sh.h
11
sh.h
@ -122,7 +122,7 @@
|
|||||||
#define __SCCSID(x) __IDSTRING(sccsid,x)
|
#define __SCCSID(x) __IDSTRING(sccsid,x)
|
||||||
|
|
||||||
#ifdef EXTERN
|
#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
|
#endif
|
||||||
#define MKSH_VERSION "R39 2009/07/16"
|
#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)))
|
#define stristr(b,l) ((const char *)strcasestr((b), (l)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MKSH_SMALL) && !defined(MKSH_NOVI)
|
#ifdef MKSH_SMALL
|
||||||
|
#ifndef MKSH_NOPWNAM
|
||||||
|
#define MKSH_NOPWNAM
|
||||||
|
#endif
|
||||||
|
#ifndef MKSH_NOVI
|
||||||
#define MKSH_NOVI
|
#define MKSH_NOVI
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* simple grouping allocator
|
* simple grouping allocator
|
||||||
@ -951,7 +956,7 @@ EXTERN struct table taliases; /* tracked aliases */
|
|||||||
EXTERN struct table builtins; /* built-in commands */
|
EXTERN struct table builtins; /* built-in commands */
|
||||||
EXTERN struct table aliases; /* aliases */
|
EXTERN struct table aliases; /* aliases */
|
||||||
EXTERN struct table keywords; /* keywords */
|
EXTERN struct table keywords; /* keywords */
|
||||||
#ifndef MKSH_SMALL
|
#ifndef MKSH_NOPWNAM
|
||||||
EXTERN struct table homedirs; /* homedir() cache */
|
EXTERN struct table homedirs; /* homedir() cache */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user