diff options
author | Sadrul Habib Chowdhury <sadrul@users.sourceforge.net> | 2009-02-06 10:29:05 -0500 |
---|---|---|
committer | Sadrul Habib Chowdhury <sadrul@users.sourceforge.net> | 2009-02-06 10:29:05 -0500 |
commit | f823083eee6bb3bf4c52cc2b32b1617bf291b1c0 (patch) | |
tree | 01a8a8924c2c03d10d9ffb52a4b1f6a912935e29 | |
parent | 940c63996183bd7d609d2bce50123d5a9f92686c (diff) | |
parent | 98b6b4105b60150c5bf9d022b2e7de698a62a797 (diff) | |
download | screen-f823083eee6bb3bf4c52cc2b32b1617bf291b1c0.tar.gz |
Merge branch 'master' into cmd-alias
-rw-r--r-- | src/acconfig.h | 9 | ||||
-rw-r--r-- | src/configure.in | 13 | ||||
-rw-r--r-- | src/doc/screen.1 | 2 | ||||
-rw-r--r-- | src/doc/screen.texinfo | 2 | ||||
-rw-r--r-- | src/extern.h | 4 | ||||
-rw-r--r-- | src/fileio.c | 82 | ||||
-rw-r--r-- | src/os.h | 4 | ||||
-rw-r--r-- | src/screen.c | 10 | ||||
-rw-r--r-- | src/socket.c | 22 | ||||
-rw-r--r-- | src/window.c | 8 |
10 files changed, 82 insertions, 74 deletions
diff --git a/src/acconfig.h b/src/acconfig.h index 8fda78f..bc324d5 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -543,15 +543,6 @@ #undef SHADOWPW /* - * If you are on a SYS V machine that restricts filename length to 14 - * characters, you may need to enforce that by setting NAME_MAX to 14 - */ -/* KEEP_UNDEF_HERE override system value - * (Will this even work as expected? -mjc) */ -#undef NAME_MAX -#undef NAME_MAX - -/* * define HAVE_NL_LANGINFO if your system has the nl_langinfo() call * and <langinfo.h> defines CODESET. */ diff --git a/src/configure.in b/src/configure.in index 9cd5d3a..9db3dd6 100644 --- a/src/configure.in +++ b/src/configure.in @@ -45,6 +45,7 @@ AC_PROG_CC AC_PROG_CPP AC_PROG_GCC_TRADITIONAL AC_ISC_POSIX +AC_USE_SYSTEM_EXTENSIONS AC_TRY_RUN(main(){exit(0);},,[ if test $CC != cc ; then @@ -1201,17 +1202,7 @@ main() { exit(0); /* libc version works properly. */ }], AC_DEFINE(USEMEMCPY)) -AC_MSG_CHECKING(long file names) -(echo 1 > /tmp/conftest9012345) 2>/dev/null -(echo 2 > /tmp/conftest9012346) 2>/dev/null -val=`cat /tmp/conftest9012345 2>/dev/null` -if test -f /tmp/conftest9012345 && test "$val" = 1; then -AC_MSG_RESULT(yes) -else -AC_MSG_RESULT(no) -AC_DEFINE(NAME_MAX, 14) -fi -rm -f /tmp/conftest* +AC_SYS_LONG_FILE_NAMES AC_MSG_CHECKING(for vsprintf) AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no)) diff --git a/src/doc/screen.1 b/src/doc/screen.1 index 284e640..879dc83 100644 --- a/src/doc/screen.1 +++ b/src/doc/screen.1 @@ -3639,7 +3639,7 @@ up to 8. Bash users will probably want to echo the escape sequence in the PROMPT_COMMAND: .IP -PROMPT_COMMAND='echo -n -e "\e033k\e033\e134"' +PROMPT_COMMAND='printf "\e033k\e033\e134"' .PP (I used \*Q\134\*U to output a `\e' because of a bug in bash v1.04). diff --git a/src/doc/screen.texinfo b/src/doc/screen.texinfo index f8e2ce4..2c60317 100644 --- a/src/doc/screen.texinfo +++ b/src/doc/screen.texinfo @@ -2002,7 +2002,7 @@ Bash users will probably want to echo the escape sequence in the PROMPT_COMMAND: @example -PROMPT_COMMAND='echo -n -e "\033k\033\134"' +PROMPT_COMMAND='printf "\033k\033\134"' @end example (I used @samp{\134} to output a @samp{\} because of a bug in v1.04). diff --git a/src/extern.h b/src/extern.h index af5cc09..6ca155b 100644 --- a/src/extern.h +++ b/src/extern.h @@ -51,7 +51,11 @@ extern void MakeNewEnv __P((void)); extern char *MakeWinMsg __P((char *, struct win *, int)); extern char *MakeWinMsgEv __P((char *, struct win *, int, int, struct event *, int)); extern void PutWinMsg __P((char *, int, int)); +#ifdef BSDWAIT +extern void WindowDied __P((struct win *, union wait, int)); +#else extern void WindowDied __P((struct win *, int, int)); +#endif extern void setbacktick __P((int, int, int, char **)); /* ansi.c */ diff --git a/src/fileio.c b/src/fileio.c index 282c1a8..1dd13c2 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -100,6 +100,42 @@ char *rcfile; char buf[256]; char *p; + /* Tilde prefix support courtesy <hesso@pool.math.tu-berlin.de>, + * taken from a Debian patch. */ + if (rcfile && *rcfile == '~') + { + static char rcfilename_tilde_exp[MAXPATHLEN+1]; + char *slash_position = strchr(rcfile, '/'); + if (slash_position == rcfile+1) + { + char *home = getenv("HOME"); + if (!home) + { + Msg(0, "%s: source: tilde expansion failed", rc_name); + return; + } + snprintf(rcfilename_tilde_exp, MAXPATHLEN, "%s/%s", home, rcfile+2); + } + else if (slash_position) + { + struct passwd *p; + *slash_position = 0; + p = getpwnam(rcfile+1); + if (!p) + { + Msg(0, "%s: source: tilde expansion failed for user %s", rc_name, rcfile+1); + return; + } + snprintf(rcfilename_tilde_exp, MAXPATHLEN, "%s/%s", p->pw_dir, slash_position+1); + } + else + { + Msg(0, "%s: source: illegal tilde expression.", rc_name); + return; + } + rcfile = rcfilename_tilde_exp; + } + if (rcfile) { char *rcend = rindex(rc_name, '/'); @@ -304,49 +340,9 @@ char *rcfilename; Msg(0, "%s: source: recursion limit reached", rc_name); return; } - /* Tilde prefix support courtesy <hesso@pool.math.tu-berlin.de>, - * taken from a Debian patch. */ - if (*rcfilename == '~') - { - char rcfilename_tilde_exp[MAXPATHLEN+1]; - char *slash_position = strchr(rcfilename, '/'); - if (slash_position == rcfilename+1) - { - char *home = getenv("HOME"); - if (!home) - { - Msg(0, "%s: source: tilde expansion failed", rc_name); - return; - } - snprintf(rcfilename_tilde_exp, MAXPATHLEN, "%s/%s", home, rcfilename+2); - } - else if (slash_position) - { - struct passwd *p; - *slash_position = 0; - p = getpwnam(rcfilename+1); - if (!p) - { - Msg(0, "%s: source: tilde expansion failed for user %s", rc_name, rcfilename+1); - return; - } - snprintf(rcfilename_tilde_exp, MAXPATHLEN, "%s/%s", p->pw_dir, slash_position+1); - } - else - { - Msg(0, "%s: source: illegal tilde expression.", rc_name); - return; - } - rc_recursion++; - FinishRc(rcfilename_tilde_exp); - rc_recursion--; - } - else - { - rc_recursion++; - FinishRc(rcfilename); - rc_recursion--; - } + rc_recursion++; + FinishRc(rcfilename); + rc_recursion--; } @@ -41,6 +41,10 @@ # include <signal.h> #endif /* __bsdi__ || __386BSD__ || _CX_UX || hpux || _IBMR2 || linux */ +#ifndef HAVE_LONG_FILE_NAMES +#define NAME_MAX 14 +#endif + #ifdef ISC # ifdef ENAMETOOLONG # undef ENAMETOOLONG diff --git a/src/screen.c b/src/screen.c index cf3e39d..7239560 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1420,6 +1420,10 @@ char **av; /* NOTREACHED */ } } + else if (ac) /* Screen was invoked with a command */ + { + MakeWindow(&nwin); + } #ifdef HAVE_BRAILLE StartBraille(); @@ -1455,7 +1459,11 @@ char **av; void WindowDied(p, wstat, wstat_valid) struct win *p; -int wstat; +#ifdef BSDWAIT + union wait wstat; +#else + int wstat; +#endif int wstat_valid; { int killit = 0; diff --git a/src/socket.c b/src/socket.c index 94a0342..48e8ad9 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1563,8 +1563,10 @@ struct msg *mp; { char *args[MAXARGS]; int argl[MAXARGS]; - int n, *lp; - register char **pp = args, *p = mp->m.command.cmd; + char fullcmd[MAXSTR]; + register char *fc; + int n; + register char *p = mp->m.command.cmd; struct acluser *user; #ifdef MULTIUSER extern struct acluser *EffectiveAclUser; /* acls.c */ @@ -1572,17 +1574,21 @@ struct msg *mp; extern struct acluser *users; /* acls.c */ #endif - lp = argl; n = mp->m.command.nargs; if (n > MAXARGS - 1) n = MAXARGS - 1; - for (; n > 0; n--) + for (fc = fullcmd; n > 0; n--) { - *pp++ = p; - *lp = strlen(p); - p += *lp++ + 1; + int len = strlen(p); + strncpy(fc, p, fullcmd + sizeof(fullcmd) - fc - 1); + p += len + 1; + fc += len; + *fc++ = ' '; } - *pp = 0; + if (fc != fullcmd) + *--fc = 0; + if (Parse(fullcmd, fc - fullcmd, args, argl) <= 0) + return; #ifdef MULTIUSER user = *FindUserPtr(mp->m.attach.auser); if (user == 0) diff --git a/src/window.c b/src/window.c index 86a5f68..5b15878 100644 --- a/src/window.c +++ b/src/window.c @@ -1855,13 +1855,21 @@ char *data; return; #endif debug2("Window %d: read error (errno %d) - killing window\n", p->w_number, errno); +#ifdef BSDWAIT + WindowDied(p, (union wait)0, 0); +#else WindowDied(p, 0, 0); +#endif return; } if (len == 0) { debug1("Window %d: EOF - killing window\n", p->w_number); +#ifdef BSDWAIT + WindowDied(p, (union wait)0, 0); +#else WindowDied(p, 0, 0); +#endif return; } debug1(" -> %d bytes\n", len); |