expand ~foo to getpwnam("foo")->dir only #if !defined(MKSH_SMALL)
this makes it possible to build a (small) mksh on glibc systems statically
This commit is contained in:
parent
56e8571167
commit
e960fabf63
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.78 2007/01/06 17:08:14 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.79 2007/01/11 00:32:30 tg Exp $
|
||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||
@ -7,7 +7,7 @@
|
||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R29 2007/01/06
|
||||
@(#)MIRBSD KSH R29 2007/01/11
|
||||
description:
|
||||
Check version of shell.
|
||||
category: pdksh
|
||||
|
8
eval.c
8
eval.c
@ -2,7 +2,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.19 2006/11/12 14:58:14 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.20 2007/01/11 00:32:30 tg Exp $");
|
||||
|
||||
/*
|
||||
* string expansion
|
||||
@ -43,7 +43,11 @@ 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
|
||||
static char *homedir(char *);
|
||||
#else
|
||||
#define homedir(x) null
|
||||
#endif
|
||||
static void alt_expand(XPtrV *, char *, char *, char *, int);
|
||||
|
||||
/* compile and expand word */
|
||||
@ -1171,6 +1175,7 @@ tilde(char *cp)
|
||||
return dp;
|
||||
}
|
||||
|
||||
#ifndef MKSH_SMALL
|
||||
/*
|
||||
* map userid to user's home directory.
|
||||
* note that 4.3's getpw adds more than 6K to the shell,
|
||||
@ -1195,6 +1200,7 @@ homedir(char *name)
|
||||
}
|
||||
return ap->val.s;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
|
||||
|
10
funcs.c
10
funcs.c
@ -5,7 +5,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.39 2006/12/06 13:41:23 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.40 2007/01/11 00:32:31 tg Exp $");
|
||||
|
||||
int
|
||||
c_cd(char **wp)
|
||||
@ -815,7 +815,11 @@ c_alias(char **wp)
|
||||
prefix = builtin_opt.info & GI_PLUS ? '+' : '-';
|
||||
switch (optc) {
|
||||
case 'd':
|
||||
#ifdef MKSH_SMALL
|
||||
return (0);
|
||||
#else
|
||||
t = &homedirs;
|
||||
#endif
|
||||
break;
|
||||
case 'p':
|
||||
pflag = 1;
|
||||
@ -950,7 +954,11 @@ c_unalias(char **wp)
|
||||
all = 1;
|
||||
break;
|
||||
case 'd':
|
||||
#ifdef MKSH_SMALL
|
||||
return (0);
|
||||
#else
|
||||
t = &homedirs;
|
||||
#endif
|
||||
break;
|
||||
case 't':
|
||||
t = &taliases;
|
||||
|
4
main.c
4
main.c
@ -13,7 +13,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.64 2007/01/06 17:08:14 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.65 2007/01/11 00:32:31 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -117,7 +117,9 @@ main(int argc, char *argv[])
|
||||
/* set up variable and command dictionaries */
|
||||
ktinit(&taliases, APERM, 0);
|
||||
ktinit(&aliases, APERM, 0);
|
||||
#ifndef MKSH_SMALL
|
||||
ktinit(&homedirs, APERM, 0);
|
||||
#endif
|
||||
|
||||
/* define shell keywords */
|
||||
initkeywords();
|
||||
|
6
sh.h
6
sh.h
@ -8,8 +8,8 @@
|
||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.91 2007/01/06 18:48:27 tg Exp $"
|
||||
#define MKSH_VERSION "R29 2007/01/06"
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.92 2007/01/11 00:32:31 tg Exp $"
|
||||
#define MKSH_VERSION "R29 2007/01/11"
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
@ -683,7 +683,9 @@ 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
|
||||
EXTERN struct table homedirs; /* homedir() cache */
|
||||
#endif
|
||||
|
||||
struct builtin {
|
||||
const char *name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user