From a7ce246a37f06752debdc86d895817637f764f1d Mon Sep 17 00:00:00 2001 From: tg Date: Fri, 15 Jun 2007 22:00:00 +0000 Subject: [PATCH] =?UTF-8?q?if=20invoked=20as=20/bin/sh,=20-sh,=20sh.static?= =?UTF-8?q?,=20whatever,=20activate=20FPOSIX=20this=20should=20help=20infe?= =?UTF-8?q?riour=20operating=20systems=20like=20Debian=E2=80=A6=20(where?= =?UTF-8?q?=20some=20of=20the=20devs,=20hi=20waldi@,=20don't=20consider=20?= =?UTF-8?q?stop()=20{=20}=20invalid=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dot.mkshrc | 8 ++++---- edit.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dot.mkshrc b/dot.mkshrc index 6f4944c..fad43fe 100644 --- a/dot.mkshrc +++ b/dot.mkshrc @@ -1,9 +1,9 @@ : ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(ulimit -c 0;hostname -s 2>&-)} [[ $HOSTNAME = @(localhost|*([ ])) ]] && HOSTNAME=$(ulimit -c 0;hostname 2>&-) PS1='# '; [[ "$(ulimit -c 0; id -u 2>&-)" -eq 0 ]] || PS1='$ ' -PS1='$(integer e=$?; ((e)) && print $e\|)${USER:=$(ulimit -c 0; id -un 2>&- || \ - print nobody)}@${HOSTNAME:=nil}:$(local pfx=~ wd=${PWD:-$(builtin pwd)} - integer n=${COLUMNS:-80}/3; let n="n < 7 ? 7 : n" +PS1='$(((e = $?)) && print $e\|)${USER:=$(ulimit -c 0; id -un 2>&- || \ + print nobody)}@${HOSTNAME:=nil}:$(typeset pfx=~ wd=${PWD:-$(builtin pwd)} + typeset -i n=${COLUMNS:-80}/3; let n="n < 7 ? 7 : n" [[ ${wd#$pfx} = $wd || $pfx = ?(/) ]] || wd=\~${wd#$pfx} pfx=; while (( (${#pfx} + ${#wd}) > n )); do if [[ $wd = */* ]]; then @@ -38,4 +38,4 @@ function Lstripcom { # place customisations between this line and the “: RCSID” line below -: $MirOS: src/bin/mksh/dot.mkshrc,v 1.15 2007/05/25 13:51:42 tg Rel $ +: $MirOS: src/bin/mksh/dot.mkshrc,v 1.16 2007/06/15 22:00:00 tg Rel $ diff --git a/edit.c b/edit.c index f4e2b21..a5e2ba8 100644 --- a/edit.c +++ b/edit.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.102 2007/06/09 22:01:41 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.103 2007/06/15 22:00:00 tg Exp $"); /* tty driver characters we are interested in */ typedef struct { @@ -38,7 +38,9 @@ static void x_free_words(int, char **); static int x_escape(const char *, size_t, int (*)(const char *, size_t)); static int x_emacs(char *, size_t); static void x_init_emacs(void); +#ifndef MKSH_NOVI static int x_vi(char *, size_t); +#endif #ifdef TIOCGWINSZ static void chkwinsz(void); @@ -107,8 +109,10 @@ x_read(char *buf, size_t len) x_mode(true); if (Flag(FEMACS) || Flag(FGMACS)) i = x_emacs(buf, len); +#ifndef MKSH_NOVI else if (Flag(FVI)) i = x_vi(buf, len); +#endif else i = -1; /* internal error */ x_mode(false); @@ -1091,10 +1095,10 @@ static char *killstack[KILLSIZE]; static int killsp, killtp; static int x_curprefix; static char *macroptr; +#ifndef MKSH_NOVI static int cur_col; /* current column on line */ static int pwidth; /* width of prompt */ static int prompt_trunc; /* how much of prompt to truncate */ -static int prompt_redraw; /* 0 if newline forced after prompt */ static int winwidth; /* width of window */ static char *wbuf[2]; /* window buffers */ static int wbuf_len; /* length of window buffers (x_cols-3)*/ @@ -1103,6 +1107,8 @@ static char morec; /* more character at right of window */ static int lastref; /* argument to last refresh() */ static char holdbuf[LINE]; /* place to hold last edit buffer */ static int holdlen; /* length of holdbuf */ +#endif +static int prompt_redraw; /* 0 if newline forced after prompt */ static int x_ins(const char *); static void x_delete(int, int); @@ -3317,6 +3323,7 @@ x_mode(bool onoff) return prev; } +#ifndef MKSH_NOVI /* +++ vi editing mode +++ */ #define Ctrl(c) (c&0x1f) @@ -5384,3 +5391,4 @@ vi_macro_reset(void) memset((char *)¯o, 0, sizeof(macro)); } } +#endif /* !MKSH_NOVI */