diff --git a/commands/ash/Makefile b/commands/ash/Makefile index 9075a9f22..b0a06dec7 100644 --- a/commands/ash/Makefile +++ b/commands/ash/Makefile @@ -8,8 +8,6 @@ MAN= # Enable this line to disable command line editing #EDIT=-DNO_HISTORY -# Enable this line to use the editline library instead of libedit -EDIT=-DEDITLINE # Enable this line if your system does not have a #NO_PATHS_H=-DNO_PATHS_H @@ -18,7 +16,7 @@ EDIT=-DEDITLINE NO_JOBS=-DJOBS=0 MKB_NO_JOBS=-j -SRCS= alias.c arith.y arith_lex.l cd.c eval.c exec.c expand.c \ +SRCS= alias.c arith.y arith_lex.l cd.c complete.c eval.c exec.c expand.c \ histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \ mystring.c options.c output.c parser.c redir.c show.c \ trap.c var.c setmode.c diff --git a/commands/ash/bltin/echo.c b/commands/ash/bltin/echo.c index 9051c0c2c..72bb60e52 100644 --- a/commands/ash/bltin/echo.c +++ b/commands/ash/bltin/echo.c @@ -41,18 +41,8 @@ __FBSDID("$FreeBSD: src/bin/sh/bltin/echo.c,v 1.14 2004/04/06 20:06:53 markm Exp * Echo command. */ -#ifdef __minix -#define MINIX -#endif - #include "bltin.h" -#ifndef MINIX -/* #define eflag 1 */ -#else -#undef eflag -#endif - int echocmd(argc, argv) int argc; @@ -63,7 +53,7 @@ echocmd(argc, argv) char c; int count; int nflag = 0; -#ifndef eflag +#ifdef __minix int eflag = 0; #endif @@ -71,7 +61,7 @@ echocmd(argc, argv) if (argc) ap++; if ((p = *ap) != NULL) { -#ifdef MINIX +#ifdef __minix if (equal(p, "--")) { ap++; } @@ -80,7 +70,7 @@ echocmd(argc, argv) nflag++; ap++; } else if (equal(p, "-e")) { -#ifndef eflag +#ifdef __minix eflag++; #endif ap++; diff --git a/commands/ash/builtins.def b/commands/ash/builtins.def index 0deae5977..b55ba83eb 100644 --- a/commands/ash/builtins.def +++ b/commands/ash/builtins.def @@ -47,8 +47,9 @@ bltincmd builtin commandcmd command -#alloccmd alloc +#if JOBS bgcmd -j bg +#endif breakcmd break continue #catfcmd catf cdcmd cd chdir @@ -62,15 +63,17 @@ exportcmd export readonly exprcmd expr test [ falsecmd false histcmd -h fc +#if JOBS fgcmd -j fg +#endif getoptscmd getopts hashcmd hash jobidcmd jobid jobscmd jobs -#linecmd line localcmd local -#nlechocmd nlecho +#ifndef SMALL #printfcmd printf +#endif pwdcmd pwd readcmd read returncmd return @@ -84,11 +87,7 @@ umaskcmd umask unaliascmd unalias unsetcmd unset waitcmd wait -#foocmd foo aliascmd alias ulimitcmd ulimit bindcmd bind wordexpcmd wordexp - -# -# $PchId: builtins.def,v 1.5 2006/03/31 10:50:57 philip Exp $ diff --git a/commands/ash/eval.c b/commands/ash/eval.c index a44ead002..4c1df9c55 100644 --- a/commands/ash/eval.c +++ b/commands/ash/eval.c @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD: src/bin/sh/eval.c,v 1.42 2004/04/06 20:06:51 markm Exp $"); #include "error.h" #include "show.h" #include "mystring.h" -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) #include "myhistedit.h" #endif @@ -194,7 +194,7 @@ evaltree(union node *n, int flags) exitstatus = 0; goto out; } -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) displayhist = 1; /* show history substitutions done with fc */ #endif TRACE(("evaltree(0x%lx: %d) called\n", (long)n, n->type)); diff --git a/commands/ash/exec.c b/commands/ash/exec.c index 923515fc6..e6a12e9ad 100644 --- a/commands/ash/exec.c +++ b/commands/ash/exec.c @@ -155,7 +155,7 @@ tryexec(char *cmd, char **argv, char **envp) int e; execve(cmd, argv, envp); -#if !__minix_vmd + e = errno; if (e == ENOEXEC) { initshellproc(); @@ -166,7 +166,6 @@ tryexec(char *cmd, char **argv, char **envp) /*NOTREACHED*/ } errno = e; -#endif } /* diff --git a/commands/ash/histedit.c b/commands/ash/histedit.c index 1e6ed1a00..e341c56d8 100644 --- a/commands/ash/histedit.c +++ b/commands/ash/histedit.c @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD: src/bin/sh/histedit.c,v 1.26 2004/04/06 20:06:51 markm Exp $ #include "output.h" #include "mystring.h" #include "builtins.h" -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) #include "myhistedit.h" #include "complete.h" #include "error.h" @@ -179,7 +179,7 @@ sethistsize(hs) if (hs == NULL || *hs == '\0' || (histsize = atoi(hs)) < 0) histsize = 100; - history(hist, &he, H_EVENT, histsize); + history(hist, &he, H_SETSIZE, histsize); } } @@ -526,7 +526,7 @@ bindcmd(int argc, char **argv) error("not compiled with line editing support"); return (0); } -#endif /* !NO_HISTORY && !EDITLINE */ +#endif /* !NO_HISTORY */ /* * $PchId: histedit.c,v 1.6 2006/04/10 14:52:58 philip Exp $ diff --git a/commands/ash/input.c b/commands/ash/input.c index fb234d2a6..15fa04ccd 100644 --- a/commands/ash/input.c +++ b/commands/ash/input.c @@ -63,16 +63,7 @@ __FBSDID("$FreeBSD: src/bin/sh/input.c,v 1.22 2004/04/06 20:06:51 markm Exp $"); #include "error.h" #include "alias.h" #include "parser.h" -#ifdef EDITLINE -#ifdef __minix_vmd -#include -#else -/* What about other systems? */ -char *readline(char *prompt); -#endif -#else #include "myhistedit.h" -#endif #include "redir.h" #include "trap.h" @@ -118,9 +109,7 @@ STATIC struct parsefile *parsefile = &basepf; /* current input file */ int init_editline = 0; /* editline library initialized? */ int whichprompt; /* -1 == PSE, 1 == PS1, 2 == PS2 */ -#ifndef EDITLINE EditLine *el; /* cookie for editline package */ -#endif STATIC void pushfile(void); static int preadfd(void); @@ -193,7 +182,7 @@ preadfd(void) int nr; parsenextc = parsefile->buf; -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) if (el != NULL && gotwinch) { gotwinch = 0; el_resize(el); @@ -201,37 +190,6 @@ preadfd(void) #endif retry: #ifndef NO_HISTORY -#ifdef EDITLINE - if (parsefile->fd == 0 && editable) { - static const char *rl_cp= NULL; - static size_t rl_off= 0; - - if (!rl_cp) - { - rl_cp = readline(getprompt(NULL)); - if (rl_cp == NULL) - nr = 0; - } - if (rl_cp) - { - nr= strlen(rl_cp+rl_off); - if (nr >= BUFSIZ-1) - { - nr= BUFSIZ-1; - (void) memcpy(parsenextc, rl_cp+rl_off, nr); - rl_off += nr; - } - else - { - (void) memcpy(parsenextc, rl_cp+rl_off, nr); - parsenextc[nr++]= '\n'; - free((void *)rl_cp); - rl_cp= NULL; - rl_off= 0; - } - } - } else -#else /* !EDITLINE */ if (parsefile->fd == 0 && el) { const char *rl_cp; @@ -243,7 +201,6 @@ retry: (void) strcpy(parsenextc, rl_cp); } } else -#endif /* !EDITLINE */ #endif nr = read(parsefile->fd, parsenextc, BUFSIZ - 1); @@ -343,7 +300,7 @@ check: savec = *q; *q = '\0'; -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) if (parsefile->fd == 0 && hist && something) { HistEvent he; INTOFF; diff --git a/commands/ash/miscbltin.c b/commands/ash/miscbltin.c index 2b289160e..d63b1e27d 100644 --- a/commands/ash/miscbltin.c +++ b/commands/ash/miscbltin.c @@ -91,9 +91,7 @@ readcmd(int argc __unused, char **argv __unused) struct timeval tv; char *tvptr; #ifndef __minix -#ifndef __minix_vmd fd_set ifds; -#endif struct termios told, tnew; int tsaved; #endif diff --git a/commands/ash/options.c b/commands/ash/options.c index 5b8706d03..c93ca2be1 100644 --- a/commands/ash/options.c +++ b/commands/ash/options.c @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD: src/bin/sh/options.c,v 1.21 2004/04/06 20:06:51 markm Exp $" #include "error.h" #include "mystring.h" #include "builtins.h" -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) #include "myhistedit.h" #endif @@ -129,7 +129,7 @@ void optschanged(void) { setinteractive(iflag); -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) histedit(); #endif setjobctl(mflag); diff --git a/commands/ash/parser.c b/commands/ash/parser.c index 20d462a88..e06521400 100644 --- a/commands/ash/parser.c +++ b/commands/ash/parser.c @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD: src/bin/sh/parser.c,v 1.51.2.1 2005/03/03 03:43:20 obrien Ex #include "alias.h" #include "show.h" #include "eval.h" -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) #include "myhistedit.h" #endif @@ -1556,11 +1556,7 @@ setprompt(int which) whichprompt = which; #ifndef NO_HISTORY -#ifdef EDITLINE - if (!editable) -#else if (!el) -#endif /* EDITLINE */ #endif /* !NO_HISTORY */ out2str(getprompt(NULL)); } diff --git a/commands/ash/shell.h b/commands/ash/shell.h index 7e33f18c1..9d76acf0d 100644 --- a/commands/ash/shell.h +++ b/commands/ash/shell.h @@ -81,11 +81,6 @@ extern char nullstr[1]; /* null string */ #define TRACE(param) #endif -#if defined(__minix) && !defined(__NBSD_LIBC) -typedef long quad_t; /* XXX */ -typedef unsigned long u_quad_t; /* XXX */ -#endif - /* * $PchId: shell.h,v 1.7 2006/05/22 12:47:00 philip Exp $ */ diff --git a/commands/ash/trap.c b/commands/ash/trap.c index a1daa08eb..56dc8572f 100644 --- a/commands/ash/trap.c +++ b/commands/ash/trap.c @@ -57,19 +57,11 @@ __FBSDID("$FreeBSD: src/bin/sh/trap.c,v 1.29 2004/04/06 20:06:51 markm Exp $"); #include "error.h" #include "trap.h" #include "mystring.h" -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) #include "myhistedit.h" #endif #include "builtins.h" -#if defined(__minix) -#if !defined(__NBSD_LIBC) -#define NO_SIGINTERRUPT -#endif -#define NO_SYS_SIGNAME -#define NO_SYS_SIGLIST -#endif - typedef void (*sig_T)(int); /* @@ -511,7 +503,7 @@ int flag; } #endif -#ifdef NO_SYS_SIGNAME +#ifdef __minix static char *strsigname(sig) int sig; { @@ -524,11 +516,7 @@ int sig; case SIGILL: return "ill"; /* 4 */ case SIGTRAP: return "trap"; /* 5 */ case SIGABRT: return "abrt"; /* 6 */ -#ifdef __minix_vmd - case SIGEMT: return "emt"; /* 7 */ -#else case SIGBUS: return "bus"; /* 7 */ -#endif case SIGFPE: return "fpe"; /* 8 */ case SIGKILL: return "kill"; /* 9 */ case SIGUSR1: return "usr1"; /* 10 */ @@ -537,11 +525,7 @@ int sig; case SIGPIPE: return "pipe"; /* 13 */ case SIGALRM: return "alrm"; /* 14 */ case SIGTERM: return "term"; /* 15 */ -#ifdef __minix_vmd - case 16: return "Signal 16"; /* 16 */ -#else case SIGEMT: return "emt"; /* 16 */ -#endif case SIGCHLD: return "chld"; /* 17 */ case SIGCONT: return "cont"; /* 18 */ case SIGSTOP: return "stop"; /* 19 */ @@ -551,9 +535,6 @@ int sig; case SIGWINCH: return "winch"; /* 23 */ case SIGVTALRM: return "vtalrm"; /* 24 */ case SIGPROF: return "prof"; /* 25 */ -#ifdef __minix_vmd - case SIGFPEMU: return "fpemu"; /* 30 */ -#endif default: return "Signal n"; } } @@ -565,7 +546,7 @@ int sig; } #endif -#ifdef NO_SYS_SIGLIST +#ifdef __minix #include "signames.h" char *strsiglist(sig) int sig; diff --git a/commands/ash/var.c b/commands/ash/var.c index b6665b29f..061d3a5a0 100644 --- a/commands/ash/var.c +++ b/commands/ash/var.c @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD: src/bin/sh/var.c,v 1.26.2.1 2004/09/30 04:41:55 des Exp $"); #include "error.h" #include "mystring.h" #include "parser.h" -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) #include "myhistedit.h" #endif @@ -102,7 +102,7 @@ struct var vvers; STATIC struct var voptind; STATIC const struct varinit varinit[] = { -#if !defined(NO_HISTORY) && !defined(EDITLINE) +#if !defined(NO_HISTORY) { &vhistsize, VSTRFIXED|VTEXTFIXED|VUNSET, "HISTSIZE=", sethistsize }, #endif diff --git a/docs/UPDATING b/docs/UPDATING index d012c819e..04f49e13a 100644 --- a/docs/UPDATING +++ b/docs/UPDATING @@ -1,3 +1,12 @@ +20130130: + With the shell update, and following update of 'test', some + modifications are needed in .profile and .ashrc. + If you use the defaults, simply execute the following for all + of your users: + + # cp etc/ast/.ashrc ~/ + # cp etc/ast/.profile ~/ + 20130114: The terminfo update is also linked to the databases functions, which means the tool used to generate the termcap entries has to diff --git a/etc/ast/.ashrc b/etc/ast/.ashrc index 5d92c0466..5757405c2 100644 --- a/etc/ast/.ashrc +++ b/etc/ast/.ashrc @@ -12,8 +12,9 @@ export PATH=$HOME/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin: } # End of no-repeat. # Let cd display the current directory on the status line. -if [ "$-" : '.*i.*' -a -t 0 -a -f /usr/bin/tget ] && tget -flag hs +if [ -t 0 -a -f /usr/bin/tget ] && tget -flag hs then +case $- in *i*) hostname=$(expr $(uname -n) : '\([^.]*\)') eval "cd() { @@ -24,4 +25,6 @@ then }" unset hostname cd . + ;; +esac fi diff --git a/etc/ast/.profile b/etc/ast/.profile index 490b26d32..b74b16542 100644 --- a/etc/ast/.profile +++ b/etc/ast/.profile @@ -1,7 +1,7 @@ # Login shell profile. -# Erase character and erase line interrupt keys -stty sane erase '^H' kill '^U' +# Activate emacs keybindings and command line history support +set -o emacs # Check terminal type. case $TERM in diff --git a/lib/libedit/makelist b/lib/libedit/makelist index 588397bc6..bbb512bff 100644 --- a/lib/libedit/makelist +++ b/lib/libedit/makelist @@ -201,11 +201,12 @@ _EOF # generate editline.c from various .c files # +# LSC: Needed by MINIX's ASH, so do not hide those -e) echo "$FILES" | tr ' ' '\012' | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); - printf("#define protected static\n"); + printf("#define protected /* LSC: see makelist static*/\n"); printf("#define SCCSID\n"); } {