diff -Nur screen-3.7.4/NEWS screen-3.7.6/NEWS --- screen-3.7.4/NEWS Mon Nov 20 19:03:04 1995 +++ screen-3.7.6/NEWS Sun Aug 23 02:35:10 1998 @@ -1,4 +1,6 @@ +[ See patchlevel.h for the differences between every patchlevel ] + ---------------------------- What's new in screen-3.7 ? ---------------------------- @@ -57,19 +59,19 @@ It is obsoleted by '%n' and will vanish in future releases. * 'defhstatus' command to give every window a default - hardstatus line. '^E' is used as a string escape instead of '%'. - All the above substitution codes apply, but you must use ^E (octal - 005) here, as '%' is likely to appear in automaticaly generated - hardstatus lines. Try 'defhstatus "Screen: window ^E (^Et)"'. + hardstatus line. '^E' is used as a string escape instead of '%'. + All the above substitution codes apply, but you must use ^E (octal + 005) here, as '%' is likely to appear in automaticaly generated + hardstatus lines. Try 'defhstatus "Screen: window ^E (^Et)"'. * In screenrc files and colon command mode: Input parser changed to also understand caret notation ('^') to mean "Control-" (as in the ^E example above). * "logdir" command changed to "logfile". You can now specify the - filename instead of the directory. The same directives as - understood by the activity/bell messages can be used. - The default is "screenlog.%n". + filename instead of the directory. The same directives as + understood by the activity/bell messages can be used. + The default is "screenlog.%n". * Special terminfo workaround make delay processing work for the first time! If you had trouble with padding, then try again. diff -Nur screen-3.7.4/acls.c screen-3.7.6/acls.c --- screen-3.7.4/acls.c Thu May 1 19:55:19 1997 +++ screen-3.7.6/acls.c Sun Oct 18 21:31:54 1998 @@ -70,7 +70,10 @@ */ static int GrowBitfield __P((AclBits *, int, int, int)); - +static int AclSetPermCmd __P((struct user *, char *, struct comm *)); +static int AclSetPermWin __P((struct user *, struct user *, char *, struct win *)); +static int UserAcl __P((struct user *, struct user **, int, char **)); +static int UserAclCopy __P((struct user **, struct user **)); static int @@ -411,6 +414,8 @@ { while (--j >= 0) free((char *)w->w_userbits[j]); + free((char *)w->w_mon_notify); + free((char *)w->w_lio_notify); return -1; } for (i = 0; i < maxusercount; i++) @@ -420,6 +425,19 @@ } return 0; } + +void +FreeWindowAcl(w) +struct win *w; +{ + int i; + + for (i = 0; i < ACL_BITS_PER_WIN; i++) + free((char *)w->w_userbits[i]); + free((char *)w->w_mon_notify); + free((char *)w->w_lio_notify); +} + /* if mode starts with '-' we remove the users exec bit for cmd */ /* diff -Nur screen-3.7.4/ansi.c screen-3.7.6/ansi.c --- screen-3.7.4/ansi.c Sat Jun 14 22:27:47 1997 +++ screen-3.7.6/ansi.c Wed Nov 25 17:26:17 1998 @@ -281,6 +281,8 @@ #endif fore = D_fore; + if (y >= fore->w_height || x2 > fore->w_width) + return EXPENSIVE; dx = x2 - x1; if (doit) { @@ -294,6 +296,10 @@ #ifdef COLOR c = fore->w_mlines[y].color + x1; #endif +#ifdef KANJI + if (D_rend.font == KANJI) + return EXPENSIVE; +#endif cost = dx = x2 - x1; if (D_insert) @@ -755,8 +761,10 @@ MakeStatus(curr->w_string); if (D_status && !(use_hardstatus && D_HS) && len > 1) { + if (len > IOSIZE + 1) + len = IOSIZE + 1; curr->w_outlen = len - 1; - bcopy(buf, curr->w_outbuf, curr->w_outlen); + bcopy(buf, curr->w_outbuf, curr->w_outlen - 1); return; } break; @@ -879,6 +887,10 @@ break; case LIT: default: +#ifdef KANJI + if (c <= ' ' || c == 0x7f || (c >= 0x80 && c < 0xa0 && curr->w_c1)) + curr->w_mbcs = 0; +#endif if (c < ' ') { if (c == '\033') @@ -938,6 +950,8 @@ break; } } + if (font == KANJI && c == ' ') + font = curr->w_rend.font = 0; if (font == KANJI || curr->w_mbcs) { int t = c; @@ -1051,6 +1065,10 @@ if (display && D_AM && D_x != cols) /* write char again */ { SetRenditionMline(&curr->w_mlines[curr->w_y], cols - 1); +#ifdef KANJI + if (curr->w_y == D_bot) + D_mbcs = D_lp_mbcs; +#endif RAW_PUTCHAR(curr->w_mlines[curr->w_y].image[cols - 1]); SetRendition(&curr->w_rend); if (curr->w_y == D_bot) @@ -2355,6 +2373,10 @@ if (cmp_mchar_mline(&curr->w_rend, ml, x)) return; +#ifdef KANJI + D_lp_mbcs = D_mbcs; + D_mbcs = 0; +#endif if (!cmp_mchar(&mchar_blank, &curr->w_rend)) /* is new not blank */ D_lp_missing = 1; if (!cmp_mchar_mline(&mchar_blank, ml, x)) /* is old char not blank? */ diff -Nur screen-3.7.4/attacher.c screen-3.7.6/attacher.c --- screen-3.7.4/attacher.c Sat Jun 14 18:19:03 1997 +++ screen-3.7.6/attacher.c Sun Aug 23 16:42:34 1998 @@ -26,6 +26,9 @@ #include #include +#if !defined(sun) || defined(SUNOS3) +#include +#endif #include #include #include "config.h" @@ -317,7 +320,7 @@ #ifdef PASSWORD -static trysendstatok, trysendstatfail; +static int trysendstatok, trysendstatfail; static sigret_t trysendok SIGDEFARG diff -Nur screen-3.7.4/configure screen-3.7.6/configure --- screen-3.7.4/configure Fri May 2 16:37:26 1997 +++ screen-3.7.6/configure Sun Oct 18 22:37:39 1998 @@ -328,6 +328,22 @@ if test -z "$prefix" then + test -n "$silent" || echo "checking for screen to derive installation directory prefix" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$IFS:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test $ac_dir != . && test -f $ac_dir/screen; then + # Not all systems have dirname. + prefix=`echo $ac_dir|sed 's%/[^/][^/]*$%%'` + break + fi + done + IFS="$ac_save_ifs" + test -n "$verbose" && echo " chose installation directory prefix ${prefix}" +fi + +if test -z "$prefix" +then test -n "$silent" || echo "checking for gzip to derive installation directory prefix" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$IFS:" for ac_dir in $PATH; do @@ -626,9 +642,18 @@ fi +oldlibs="$LIBS" +LIBS="$LIBS -lmld" test -n "$silent" || echo "checking for MIPS" -if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then -test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha. +cat > conftest.${ac_ext} < conftest.${ac_ext} < conftest.${ac_ext} < conftest.out 2>&1" +if egrep "yes" conftest.out >/dev/null 2>&1; then + rm -rf conftest* + LIBS="$LIBS -lkstat" + +fi +rm -f conftest* + @@ -1527,6 +1575,18 @@ : else rm -rf conftest* + LIBS="-lncurses $olibs" +test -n "$silent" || echo "checking for libncurses" +cat > conftest.${ac_ext} <&2; exit 1 fi rm -f conftest* @@ -1537,6 +1597,9 @@ fi rm -f conftest* +fi +rm -f conftest* + cat > conftest.${ac_ext} < 2) # define nlist nlist64 # endif #endif @@ -2096,7 +2163,7 @@ _CUT_HERE_ -#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || defined(__alpha) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k)) +#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || (!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k)) loadtype=long # if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) loadscale=65536 @@ -2331,6 +2398,22 @@ test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec" test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow" +cat > conftest.${ac_ext} < conftest.out 2>&1" +if egrep "yes" conftest.out >/dev/null 2>&1; then + rm -rf conftest* + LIBS="$LIBS -lsocket -lcrypt_i -lc -lx" + +fi +rm -f conftest* + + oldlibs="$LIBS" LIBS="$LIBS -lsun" test -n "$silent" || echo "checking for IRIX sun library" @@ -2623,7 +2706,6 @@ cat > conftest.${ac_ext} < int main() { return 0; } int t() { vsprintf(0,0,0);; return 0; } EOF diff -Nur screen-3.7.4/configure.in screen-3.7.6/configure.in --- screen-3.7.4/configure.in Fri May 2 16:37:15 1997 +++ screen-3.7.6/configure.in Sun Oct 18 21:48:53 1998 @@ -35,6 +35,7 @@ VERSION="$rev.$vers.$pat" AC_NOTE(this is screen version $VERSION) AC_SUBST(VERSION) +AC_PREFIX(screen) AC_PREFIX(gzip) AC_PROG_CC @@ -79,9 +80,10 @@ AC_DEFINE(sysV68) fi -AC_CHECKING(for MIPS) -if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then -test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha. +oldlibs="$LIBS" +LIBS="$LIBS -lmld" +AC_COMPILE_CHECK(MIPS,,, +test -f /bin/mx && LIBS="$oldlibs" # not on alpha dnl djm@eng.umd.edu: "... for one thing, it doubles the size of the executable" dnl if test -r /dev/ptc; then @@ -95,7 +97,7 @@ AC_DEFINE(USE_WAIT2) LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd" )) fi -fi +,LIBS="$oldlibs") AC_CHECKING(for Ultrix) AC_PROGRAM_EGREP(yes, @@ -155,6 +157,12 @@ AC_HEADER_CHECK(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))) ,LIBS="$oldlibs") +AC_CHECKING(for Solaris) +AC_PROGRAM_EGREP(yes, +[#if defined(sun) && defined(SVR4) + yes +#endif +], LIBS="$LIBS -lkstat") dnl dnl **** typedefs **** @@ -552,7 +560,9 @@ AC_COMPILE_CHECK(libtermcap,,tgetent((char *)0, (char *)0);,, LIBS="-ltermlib $olibs" AC_COMPILE_CHECK(libtermlib,,tgetent((char *)0, (char *)0);,, -AC_ERROR(!!! no tgetent - no screen)))) +LIBS="-lncurses $olibs" +AC_COMPILE_CHECK(libncurses,,tgetent((char *)0, (char *)0);,, +AC_ERROR(!!! no tgetent - no screen))))) AC_TEST_PROGRAM([ main() @@ -576,7 +586,12 @@ else pdir='/dev' fi +dnl SCO uses ptyp%d +if test -c /dev/ptyp19; then +ptys=`echo /dev/ptyp??` +else ptys=`echo $pdir/pty??` +fi if test "$ptys" != "$pdir/pty??" ; then p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` @@ -737,7 +752,7 @@ #endif #ifdef __sgi -# if _MIPS_SZLONG == 64 +# if _MIPS_SZLONG == 64 || (defined(_MIPS_ISA) && _MIPS_ISA > 2) # define nlist nlist64 # endif #endif @@ -776,7 +791,7 @@ #include #include ],[ -#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || defined(__alpha) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k)) +#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || (!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k)) loadtype=long # if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) loadscale=65536 @@ -890,6 +905,13 @@ test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec" test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow" +dnl SCO stuff +AC_PROGRAM_EGREP(yes, +[#ifdef M_UNIX + yes +#endif +], LIBS="$LIBS -lsocket -lcrypt_i -lc -lx") + oldlibs="$LIBS" LIBS="$LIBS -lsun" AC_COMPILE_CHECK(IRIX sun library,,,,LIBS="$oldlibs") @@ -978,8 +1000,7 @@ fi rm -f /tmp/conftest* -AC_COMPILE_CHECK(vsprintf, [ -#include ], [vsprintf(0,0,0);], AC_DEFINE(USEVARARGS)) +AC_COMPILE_CHECK(vsprintf, , [vsprintf(0,0,0);], AC_DEFINE(USEVARARGS)) AC_DIR_HEADER AC_XENIX_DIR diff -Nur screen-3.7.4/display.c screen-3.7.6/display.c --- screen-3.7.4/display.c Thu May 1 18:51:23 1997 +++ screen-3.7.6/display.c Wed Nov 25 17:12:43 1998 @@ -32,8 +32,8 @@ #include "screen.h" #include "extern.h" -static void CountChars __P((int)); -static void PutChar __P((int)); +static int CountChars __P((int)); +static int PutChar __P((int)); static int BlankResize __P((int, int)); @@ -443,6 +443,10 @@ } D_lp_missing = 1; D_rend.image = c; +#ifdef KANJI + D_lp_mbcs = D_mbcs; + D_mbcs = 0; +#endif D_lpchar = D_rend; } @@ -520,12 +524,13 @@ #endif } -static void +static int PutChar(c) int c; { /* this PutChar for ESC-sequences only (AddChar is a macro) */ AddChar(c); + return c; } void @@ -644,11 +649,12 @@ static int StrCost; /* ARGSUSED */ -static void +static int CountChars(c) int c; { StrCost++; + return c; } int @@ -1168,6 +1174,7 @@ { char *tparm(); SetFont(ASCII); + ospeed = D_dospeed; tputs(tparm(D_SA, new & A_SO, new & A_US, new & A_RV, new & A_BL, new & A_DI, new & A_BD, 0 , 0 , 0), 1, PutChar); @@ -1385,9 +1392,23 @@ { debug1("using STATLINE %d\n", STATLINE); GotoPos(0, STATLINE); - SetRendition(&mchar_so); + SetRendition(&mchar_so); InsertMode(0); AddStr(msg); + if (D_status_len < max) + { + /* Wayne Davison: add extra space for readability */ + D_status_len++; + SetRendition(&mchar_null); + AddChar(' '); + if (D_status_len < max) + { + D_status_len++; + AddChar(' '); + AddChar('\b'); + } + AddChar('\b'); + } D_x = -1; } else @@ -1473,7 +1494,7 @@ PutStr(D_DS); if (D_fore && D_fore->w_hstatus) { - buf = MakeWinMsg(D_fore->w_hstatus, D_fore, '\005'); + buf = MakeWinMsg(D_fore->w_hstatus, D_fore, '\005', 0); CPutStr(D_TS, 0); if (strlen(buf) > D_WS) AddStrn(buf, D_WS); @@ -1485,7 +1506,7 @@ } else if (D_fore && D_fore->w_hstatus) { - buf = MakeWinMsg(D_fore->w_hstatus, D_fore, '\005'); + buf = MakeWinMsg(D_fore->w_hstatus, D_fore, '\005', 0); Msg(0, "%s", buf); } } @@ -1516,6 +1537,10 @@ ASSERT(display); oldrend = D_rend; +#ifdef KANJI + if (D_lpchar.font == KANJI && (D_mbcs = D_lp_mbcs) != 0) + x2--; +#endif GotoPos(x2, y2); SetRendition(&D_lpchar); PUTCHAR(D_lpchar.image); @@ -1577,7 +1602,7 @@ PUTCHAR(ml->image[++x]); #endif } - if (to == D_width - 1 && y < D_height - 1 && ml->image[to + 1] == ' ') + if (to == D_width - 1 && y < D_height - 1 && D_x == D_width && ml->image[to + 1] == ' ') GotoPos(0, y + 1); if (last2flag) { @@ -1933,11 +1958,13 @@ int x; { int i, j; - if (f[x] != KANJI) + + f += x; + if (*f-- != KANJI) return 0; - for (i = j = 0; i < x; i++) - if (*f++ == KANJI) - j ^= 1; + for (j = 0, i = x - 1; i >= 0; i--, j ^= 1) + if (*f-- != KANJI) + break; return j; } #endif diff -Nur screen-3.7.4/display.h screen-3.7.6/display.h --- screen-3.7.4/display.h Mon Nov 20 19:03:04 1995 +++ screen-3.7.6/display.h Mon Aug 17 22:45:31 1998 @@ -65,6 +65,7 @@ #ifdef KANJI int d_mbcs; /* saved char for multibytes charset */ int d_kanji; /* what kanji type the display is */ + int d_lp_mbcs; /* mbcs part of lp_missing */ #endif int d_insert; /* insert mode flag */ int d_keypad; /* application keypad flag */ @@ -153,6 +154,7 @@ #define D_atyp DISPLAY(d_atyp) #define D_mbcs DISPLAY(d_mbcs) #define D_kanji DISPLAY(d_kanji) +#define D_lp_mbcs DISPLAY(d_lp_mbcs) #define D_insert DISPLAY(d_insert) #define D_keypad DISPLAY(d_keypad) #define D_cursorkeys DISPLAY(d_cursorkeys) diff -Nur screen-3.7.4/doc/screen.1 screen-3.7.6/doc/screen.1 --- screen-3.7.4/doc/screen.1 Mon Apr 14 19:36:14 1997 +++ screen-3.7.6/doc/screen.1 Wed Nov 25 17:28:01 1998 @@ -1,5 +1,5 @@ .\" vi:set wm=5 -.TH SCREEN 1 "15 Oct 1995" +.TH SCREEN 1 "21 Aug 1998" .if n .ds Q \&" .if n .ds U \&" .if t .ds Q `` @@ -3102,6 +3102,9 @@ .BI XC " (str)" Describe a translation of characters to strings depending on the current font. More details follow in the next section. +.TP 13 +.BI TF " (bool)" +Add missing capabilities to the termcap/info entry. (Set by default). .SH CHARACTER TRANSLATION \fIScreen\fP has a powerful mechanism to translate characters to arbitrary @@ -3136,7 +3139,7 @@ termcap hp700 'XC=B\eE(K%\eE(B,\e304[,\e326\e\e\e\e,\e334]' -This tells \fIscreen\fP, how to translate ISOlatin1 (charset 'B') +This tells \fIscreen\fP how to translate ISOlatin1 (charset 'B') upper case umlaut characters on a hp700 terminal that has a german charset. '\e304' gets translated to '\eE(K[\eE(B' and so on. Note that this line gets parsed *three* times before the internal @@ -3292,7 +3295,7 @@ .SH VERSION -This is version 3.7.0. Its roots are a merge of a custom version +This is version 3.7.6. Its roots are a merge of a custom version 2.3PR7 by Wayne Davison and several enhancements to Oliver Laumann's version 2.0. Note that all versions numbered 2.x are copyright by Oliver Laumann. diff -Nur screen-3.7.4/doc/screen.info screen-3.7.6/doc/screen.info --- screen-3.7.4/doc/screen.info Mon Nov 20 19:08:21 1995 +++ screen-3.7.6/doc/screen.info Wed Nov 25 17:28:23 1998 @@ -23,8 +23,8 @@ Indirect: screen.info-1: 873 screen.info-2: 50135 -screen.info-3: 99940 -screen.info-4: 149859 +screen.info-3: 99947 +screen.info-4: 148475  Tag Table: (Indirect) @@ -91,77 +91,77 @@ Node: Copy84262 Node: Line Termination85107 Node: Scrollback85516 -Node: Copy Mode Keys86005 -Node: Movement86820 -Node: Marking87974 -Node: Repeat count88349 -Node: Searching88663 -Node: Specials88925 -Node: Paste90857 -Node: Registers93418 -Node: Screen-Exchange94424 -Node: History95507 -Node: Subprocess Execution96247 -Node: Exec96611 -Node: Using Exec98201 -Node: Key Binding99940 -Node: Bind100583 -Node: Bind Examples101570 -Node: Command Character102250 -Node: Help103758 -Node: Bindkey104271 -Node: Bindkey Examples105814 -Node: Bindkey Control106699 -Node: Flow Control107296 -Node: Flow Control Summary107872 -Node: Flow110806 -Node: XON/XOFF111580 -Node: Termcap111953 -Node: Window Termcap112810 -Node: Dump Termcap117968 -Node: Termcap Syntax118683 -Node: Termcap Examples120843 -Node: Special Capabilities122884 -Node: Autonuke125348 -Node: Obuflimit125998 -Node: Character Translation126827 -Node: Message Line129438 -Node: Privacy Message130349 -Node: Hardware Status Line130846 -Node: Last Message131475 -Node: Message Wait131902 -Node: Logging132328 -Node: Hardcopy132652 -Node: Log133448 -Node: Startup134196 -Node: echo134603 -Node: sleep135009 -Node: Startup Message135350 -Node: Miscellaneous135623 -Node: At136612 -Node: Break137920 -Node: Debug138323 -Node: License138707 -Node: Nethack138972 -Node: Number139648 -Node: Silence140017 -Node: Time140784 -Node: Version141158 -Node: Zombie141364 -Node: Printcmd142418 -Node: Sorendition143124 -Node: Environment143775 -Node: Files144857 -Node: Credits145983 -Node: Bugs147900 -Node: Known Bugs148370 -Node: Reporting Bugs149859 -Node: Availability150635 -Node: Installation151081 -Node: Socket Directory151471 -Node: Compiling Screen152001 -Node: Concept Index153393 -Node: Command Index155173 -Node: Keystroke Index162058 +Node: Copy Mode Keys86012 +Node: Movement86827 +Node: Marking87981 +Node: Repeat count88356 +Node: Searching88670 +Node: Specials88932 +Node: Paste90864 +Node: Registers93425 +Node: Screen-Exchange94431 +Node: History95514 +Node: Subprocess Execution96254 +Node: Exec96618 +Node: Using Exec98208 +Node: Key Binding99947 +Node: Bind100590 +Node: Bind Examples101577 +Node: Command Character102257 +Node: Help103765 +Node: Bindkey104278 +Node: Bindkey Examples105821 +Node: Bindkey Control106706 +Node: Flow Control107303 +Node: Flow Control Summary107879 +Node: Flow110813 +Node: XON/XOFF111587 +Node: Termcap111960 +Node: Window Termcap112817 +Node: Dump Termcap117975 +Node: Termcap Syntax118690 +Node: Termcap Examples120850 +Node: Special Capabilities122891 +Node: Autonuke125453 +Node: Obuflimit126103 +Node: Character Translation126932 +Node: Message Line129543 +Node: Privacy Message130454 +Node: Hardware Status Line130951 +Node: Last Message131580 +Node: Message Wait132007 +Node: Logging132433 +Node: Hardcopy132757 +Node: Log133553 +Node: Startup134301 +Node: echo134708 +Node: sleep135114 +Node: Startup Message135455 +Node: Miscellaneous135728 +Node: At136717 +Node: Break138025 +Node: Debug138428 +Node: License138812 +Node: Nethack139077 +Node: Number139753 +Node: Silence140122 +Node: Time140889 +Node: Version141263 +Node: Zombie141469 +Node: Printcmd142523 +Node: Sorendition143229 +Node: Environment143880 +Node: Files144962 +Node: Credits146088 +Node: Bugs148005 +Node: Known Bugs148475 +Node: Reporting Bugs149964 +Node: Availability150740 +Node: Installation151186 +Node: Socket Directory151576 +Node: Compiling Screen152106 +Node: Concept Index153498 +Node: Command Index155278 +Node: Keystroke Index162163  End Tag Table diff -Nur screen-3.7.4/doc/screen.info-1 screen-3.7.6/doc/screen.info-1 --- screen-3.7.4/doc/screen.info-1 Mon Nov 20 19:08:21 1995 +++ screen-3.7.6/doc/screen.info-1 Wed Nov 25 17:28:23 1998 @@ -26,7 +26,7 @@ ****** This file documents the `Screen' virtual terminal manager, version -3.7.0. +3.7.6. * Menu: diff -Nur screen-3.7.4/doc/screen.info-2 screen-3.7.6/doc/screen.info-2 --- screen-3.7.4/doc/screen.info-2 Mon Nov 20 19:08:21 1995 +++ screen-3.7.6/doc/screen.info-2 Wed Nov 25 17:28:23 1998 @@ -866,9 +866,9 @@ - Command: scrollback NUM (none) - Set the size of the scrollback buffer for new windows to NUM - lines. The default scrollback is 100 lines. Use `C-a i' to view - the current setting. + Set the size of the scrollback buffer for the current window to + NUM lines. The default scrollback is 100 lines. Use `C-a i' to + view the current setting.  File: screen.info, Node: Copy Mode Keys, Next: Movement, Prev: Scrollback, Up: Copy diff -Nur screen-3.7.4/doc/screen.info-3 screen-3.7.6/doc/screen.info-3 --- screen-3.7.4/doc/screen.info-3 Mon Nov 20 19:08:21 1995 +++ screen-3.7.6/doc/screen.info-3 Wed Nov 25 17:28:23 1998 @@ -648,6 +648,11 @@ Describe a translation of characters to strings depending on the current font. (*note Character Translation::.). +`TF' + (bool) + Add missing capabilities to the termcap/info entry. (Set by + default). +  File: screen.info, Node: Autonuke, Next: Obuflimit, Prev: Special Capabilities, Up: Termcap @@ -1316,7 +1321,7 @@ Version ======= - This manual describes version 3.7.0 of the `screen' program. Its + This manual describes version 3.7.6 of the `screen' program. Its roots are a merge of a custom version 2.3PR7 by Wayne Davison and several enhancements to Oliver Laumann's version 2.0. Note that all versions numbered 2.x are copyright by Oliver Laumann. @@ -1338,44 +1343,4 @@ * Known Bugs:: Problems we know about. * Reporting Bugs:: How to contact the maintainers. * Availability:: Where to find the lastest screen version. - - -File: screen.info, Node: Known Bugs, Next: Reporting Bugs, Up: Bugs - -Known Bugs -========== - - * `dm' (delete mode) and `xs' are not handled correctly (they are - ignored). `xn' is treated as a magic-margin indicator. - - * `screen' has no clue about double-high or double-wide characters. - But this is the only area where `vttest' is allowed to fail. - - * It is not possible to change the environment variable `$TERMCAP' - when reattaching under a different terminal type. - - * The support of terminfo based systems is very limited. Adding extra - capabilities to `$TERMCAP' may not have any effects. - - * `screen' does not make use of hardware tabs. - - * `screen' must be installed setuid root in order to be able to - correctly change the owner of the tty device file for each window. - Special permission may also be required to write the file - `/etc/utmp'. - - * Entries in `/etc/utmp' are not removed when `screen' is killed - with SIGKILL. This will cause some programs (like "w" or "rwho") - to advertise that a user is logged on who really isn't. - - * `screen' may give a strange warning when your tty has no utmp - entry. - - * When the modem line was hung up, `screen' may not automatically - detach (or quit) unless the device driver sends a HANGUP signal. - To detach such a `screen' session use the -D or -d command line - option. - - * A weird imagination is most useful to gain full advantage of all - the features. diff -Nur screen-3.7.4/doc/screen.info-4 screen-3.7.6/doc/screen.info-4 --- screen-3.7.4/doc/screen.info-4 Mon Nov 20 19:08:21 1995 +++ screen-3.7.6/doc/screen.info-4 Wed Nov 25 17:28:23 1998 @@ -20,6 +20,46 @@ translation approved by the Foundation.  +File: screen.info, Node: Known Bugs, Next: Reporting Bugs, Up: Bugs + +Known Bugs +========== + + * `dm' (delete mode) and `xs' are not handled correctly (they are + ignored). `xn' is treated as a magic-margin indicator. + + * `screen' has no clue about double-high or double-wide characters. + But this is the only area where `vttest' is allowed to fail. + + * It is not possible to change the environment variable `$TERMCAP' + when reattaching under a different terminal type. + + * The support of terminfo based systems is very limited. Adding extra + capabilities to `$TERMCAP' may not have any effects. + + * `screen' does not make use of hardware tabs. + + * `screen' must be installed setuid root in order to be able to + correctly change the owner of the tty device file for each window. + Special permission may also be required to write the file + `/etc/utmp'. + + * Entries in `/etc/utmp' are not removed when `screen' is killed + with SIGKILL. This will cause some programs (like "w" or "rwho") + to advertise that a user is logged on who really isn't. + + * `screen' may give a strange warning when your tty has no utmp + entry. + + * When the modem line was hung up, `screen' may not automatically + detach (or quit) unless the device driver sends a HANGUP signal. + To detach such a `screen' session use the -D or -d command line + option. + + * A weird imagination is most useful to gain full advantage of all + the features. + + File: screen.info, Node: Reporting Bugs, Next: Availability, Prev: Known Bugs, Up: Bugs Reporting Bugs diff -Nur screen-3.7.4/doc/screen.texinfo screen-3.7.6/doc/screen.texinfo --- screen-3.7.4/doc/screen.texinfo Mon Nov 20 19:03:15 1995 +++ screen-3.7.6/doc/screen.texinfo Wed Nov 25 17:28:12 1998 @@ -5,7 +5,7 @@ @finalout @setchapternewpage odd @c %**end of header -@set version 3.7.0 +@set version 3.7.6 @c For examples, use a literal escape in info. @ifinfo @@ -2221,9 +2221,9 @@ @deffn Command scrollback num (none)@* -Set the size of the scrollback buffer for new windows to @var{num} -lines. The default scrollback is 100 lines. Use @kbd{C-a i} to view -the current setting. +Set the size of the scrollback buffer for the current window to +@var{num} lines. The default scrollback is 100 lines. Use @kbd{C-a i} +to view the current setting. @end deffn @node Copy Mode Keys, Movement, Scrollback, Copy @@ -3262,6 +3262,10 @@ (str)@* Describe a translation of characters to strings depending on the current font. (@pxref{Character Translation}). + +@item TF +(bool)@* +Add missing capabilities to the termcap/info entry. (Set by default). @end table @node Autonuke, Obuflimit, Special Capabilities, Termcap diff -Nur screen-3.7.4/etc/ccdefs screen-3.7.6/etc/ccdefs --- screen-3.7.4/etc/ccdefs Thu Jan 1 01:00:00 1970 +++ screen-3.7.6/etc/ccdefs Mon Mar 16 22:07:39 1998 @@ -0,0 +1,45 @@ +#!/bin/sh +cd /tmp +umask 022 + +CC=cc +CPP=/lib/cpp + +TEMP=def$$ +trap 'rm -f ${TEMP}*; trap 0; exit' 0 1 2 3 15 + +set `type $CC` +q=$# +set x `type $CC` +shift $q +cc=$1 + +set `type $CPP` +q=$# +set x `type $CPP` +shift $q +cpp=$1 + +strings - "$cc" 2>/dev/null | tr ' ' '\012' > ${TEMP}.x + +if test -x "$cpp"; then +strings - "$cpp" 2>/dev/null | tr ' ' '\012' >> ${TEMP}.x +else +echo "Warning: cpp not found." +fi + +sort < ${TEMP}.x | uniq | awk ' +/^-D[A-Za-z_][A-Za-z_0-9]*$/ { + printf("#ifdef %s\n", substr($0,3)) + printf("\"%s\": %s\n", substr($0,3), substr($0,3)) + print "#endif" + } +/^[A-Za-z_][A-Za-z_0-9]*$/ { + printf("#ifdef %s\n", $0) + printf("\"%s\": %s\n", $0, $0) + print "#endif" + } +' > ${TEMP}.c + +echo "Defines in cc are:" +cc -E ${TEMP}.c | sed -n -e 's/"\([^:]*\)":/\1:/p' | sort | uniq diff -Nur screen-3.7.4/etc/screenrc screen-3.7.6/etc/screenrc --- screen-3.7.4/etc/screenrc Mon Jun 23 23:05:42 1997 +++ screen-3.7.6/etc/screenrc Wed Nov 25 19:25:55 1998 @@ -28,7 +28,7 @@ # shellaka '$ |sh' # set every new windows hardstatus line to somenthing descriptive -# defhstatus "screen: ^E (^Et)" +# defhstatus "screen: ^En (^Et)" defscrollback 1000 @@ -71,6 +71,12 @@ # emulate part of the 'K' charset termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337' + +# xterm-52 tweaks: +# - uses background color for delete operations +# - maps F1-4 to PF1-4 +# termcapinfo xterm ut +# termcapinfo xterm 'k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS' ################ # diff -Nur screen-3.7.4/extern.h screen-3.7.6/extern.h --- screen-3.7.4/extern.h Fri May 2 15:52:28 1997 +++ screen-3.7.6/extern.h Sun Oct 18 21:32:11 1998 @@ -47,7 +47,7 @@ extern void DisplaySleep __P((int)); extern void Finit __P((int)); extern void MakeNewEnv __P((void)); -extern char *MakeWinMsg __P((char *, struct win *, int)); +extern char *MakeWinMsg __P((char *, struct win *, int, int)); /* ansi.c */ extern void Activate __P((int)); @@ -113,6 +113,7 @@ extern int MakeWindow __P((struct NewWindow *)); extern int RemakeWindow __P((struct win *)); extern void FreeWindow __P((struct win *)); +extern void CloseDevice __P((struct win *)); #ifdef PSEUDOS extern int winexec __P((char **)); extern void FreePseudowin __P((struct win *)); @@ -253,7 +254,7 @@ extern int MakeServerSocket __P((void)); extern int RecoverSocket __P((void)); extern int chsock __P((void)); -extern void ReceiveMsg __P(()); +extern void ReceiveMsg __P((void)); extern void SendCreateMsg __P((char *, struct NewWindow *)); #ifdef USEVARARGS extern void SendErrorMsg __P((char *, ...)) @@ -267,6 +268,7 @@ /* misc.c */ extern char *SaveStr __P((const char *)); +extern char *InStr __P((char *, const char *)); #ifndef HAVE_STRERROR extern char *strerror __P((int)); #endif @@ -319,6 +321,7 @@ extern int UsersAcl __P((struct user *, int, char **)); extern void AclWinSwap __P((int, int)); extern int NewWindowAcl __P((struct win *, struct user *)); +extern void FreeWindowAcl __P((struct win *)); #endif /* MULTIUSER */ extern struct user **FindUserPtr __P((char *)); extern int UserAdd __P((char *, char *, struct user **)); diff -Nur screen-3.7.4/fileio.c screen-3.7.6/fileio.c --- screen-3.7.4/fileio.c Thu May 1 17:50:25 1997 +++ screen-3.7.6/fileio.c Wed Nov 25 18:23:24 1998 @@ -38,7 +38,7 @@ #include "extern.h" #ifdef NETHACK -extern nethackflag; +extern int nethackflag; #endif extern struct display *display; @@ -54,6 +54,7 @@ extern int hardcopy_append; extern char *hardcopydir; +static char *findrcfile __P((char *)); static char *CatExtra __P((char *, char *)); @@ -143,12 +144,13 @@ { register int argc, len; register char *p, *cp; - char buf[256]; + char buf[2048]; char *args[MAXARGS]; + /* always fix termcap/info capabilities */ + extra_incap = CatExtra("TF", extra_incap); /* Special settings for vt100 and others */ - if (display && (!strncmp(D_termname, "vt", 2) || !strncmp(D_termname, "xterm", 5))) extra_incap = CatExtra("xn:f0=\033Op:f1=\033Oq:f2=\033Or:f3=\033Os:f4=\033Ot:f5=\033Ou:f6=\033Ov:f7=\033Ow:f8=\033Ox:f9=\033Oy:f.=\033On:f,=\033Ol:fe=\033OM:f+=\033Ok:f-=\033Om:f*=\033Oj:f/=\033Oo:fq=\033OX", extra_incap); @@ -248,7 +250,7 @@ FinishRc(rcfilename) char *rcfilename; { - char buf[256]; + char buf[2048]; rc_name = findrcfile(rcfilename); @@ -306,6 +308,18 @@ register FILE *f; char fn[1024]; char *mode = "w"; +#ifdef COPY_PASTE + int public = 0; +# ifdef _MODE_T + mode_t old_umask; +# else + int old_umask; +# endif +# ifdef HAVE_LSTAT + struct stat stb, stb2; + int fd, exists = 0; +# endif +#endif switch (dump) { @@ -328,7 +342,15 @@ case DUMP_EXCHANGE: strncpy(fn, BufferFile, sizeof(fn) - 1); fn[sizeof(fn) - 1] = 0; - umask(0); + public = !strcmp(fn, DEFAULT_BUFFERFILE); +# ifdef HAVE_LSTAT + exists = !lstat(fn, &stb); + if (public && exists && (S_ISLNK(stb.st_mode) || stb.st_nlink > 1)) + { + Msg(0, "No write to links, please."); + return; + } +# endif break; #endif } @@ -337,7 +359,36 @@ if (UserContext() > 0) { debug("Writefile: usercontext\n"); - if ((f = fopen(fn, mode)) == NULL) +#ifdef COPY_PASTE + if (dump == DUMP_EXCHANGE && public) + { + old_umask = umask(0); +# ifdef HAVE_LSTAT + if (exists) + { + if ((fd = open(fn, O_WRONLY, 0666)) >= 0) + { + if (fstat(fd, &stb2) == 0 && stb.st_dev == stb2.st_dev && stb.st_ino == stb2.st_ino) + ftruncate(fd, 0); + else + { + close(fd); + fd = -1; + } + } + } + else + fd = open(fn, O_WRONLY|O_CREAT|O_EXCL, 0666); + f = fd >= 0 ? fdopen(fd, mode) : 0; +# else + f = fopen(fn, mode); +# endif + umask(old_umask); + } + else +#endif /* COPY_PASTE */ + f = fopen(fn, mode); + if (f == NULL) { debug2("WriteFile: fopen(%s,\"%s\") failed\n", fn, mode); UserReturn(0); diff -Nur screen-3.7.4/help.c screen-3.7.6/help.c --- screen-3.7.4/help.c Thu May 1 18:42:51 1997 +++ screen-3.7.6/help.c Sat Sep 12 21:01:30 1998 @@ -460,7 +460,7 @@ \n\ Screen version %v\n\ \n\ -Copyright (c) 1993 Juergen Weigert, Michael Schroeder\n\ +Copyright (c) 1993-1998 Juergen Weigert, Michael Schroeder\n\ Copyright (c) 1987 Oliver Laumann\n\ \n\ This program is free software; you can redistribute it and/or \ diff -Nur screen-3.7.4/kmapdef.c.dist screen-3.7.6/kmapdef.c.dist --- screen-3.7.4/kmapdef.c.dist Sat Jun 14 22:22:35 1997 +++ screen-3.7.6/kmapdef.c.dist Wed Nov 25 17:13:57 1998 @@ -28,8 +28,6 @@ 0, 0, 0, -"\010", -"\033[1~", 0, 0, 0, @@ -39,21 +37,23 @@ 0, 0, 0, -"\033[3~", 0, 0, -"\033[4~", -"\033[2~", 0, 0, -"\033[6~", -"\033[5~", 0, 0, 0, 0, 0, +"\033[1~", 0, +"\033[4~", +0, +"\033[6~", +"\033[5~", +"\033[2~", +"\033[3~", "\033[A", "\033[B", "\033[C", @@ -104,29 +104,19 @@ }; char *kmapmdef[] = { -"\201", -0, -0, -0, -0, -0, +"\004", 0, 0, +"\025", 0, 0, 0, +"\201", 0, -"\004", "\205", 0, -0, -0, "\006", "\002", -"\025", -0, -0, -0, 0, 0, "\220", diff -Nur screen-3.7.4/loadav.c screen-3.7.6/loadav.c --- screen-3.7.4/loadav.c Mon Nov 20 19:03:04 1995 +++ screen-3.7.6/loadav.c Sun Oct 18 21:39:09 1998 @@ -156,6 +156,84 @@ /***************************************************************/ +#if defined(sun) && defined(SVR4) && !defined(LOADAV_DONE) +#define LOADAV_DONE + +#include + +static kstat_ctl_t *kc; + +void +InitLoadav() +{ + loadok = (kc = kstat_open()) != 0; +} + +static int +GetLoadav() +{ + kstat_t *ks; + kstat_named_t *avgs[3]; + int i; + + kstat_chain_update(kc); + if ((ks = kstat_lookup(kc, "unix", -1, "system_misc")) == 0 || kstat_read(kc, ks, (void *)0) == -1) + return (loadok = 0); + avgs[0] = kstat_data_lookup(ks, "avenrun_1min"); + avgs[1] = kstat_data_lookup(ks, "avenrun_5min"); + avgs[2] = kstat_data_lookup(ks, "avenrun_15min"); + for (i = 0; i < 3; i++) + { + if (avgs[i] == 0 || avgs[i]->data_type != KSTAT_DATA_ULONG) + return (loadok = 0); + loadav[i] = avgs[i]->value.ul; + } + return 3; +} + +#endif + +/***************************************************************/ + +#if defined(__osf__) && defined(__alpha) && !defined(LOADAV_DONE) +#define LOADAV_DONE + +struct rtentry; struct mbuf; /* shut up gcc on OSF/1 4.0 */ +#include + +void +InitLoadav() +{ + loadok = 1; +} + +static int +GetLoadav() +{ + struct tbl_loadavg tbl; + int i; + + if (table(TBL_LOADAVG, 0, &tbl, 1, sizeof(struct tbl_loadavg)) != 1) + return 0; + + if (tbl.tl_lscale) + { + /* in long */ + for (i = 0; i < LOADAV_NUM; i++) + loadav[i] = (double) tbl.tl_avenrun.l[i] / tbl.tl_lscale; + } + else + { + /* in double */ + for (i = 0; i < LOADAV_NUM; i++) + loadav[i] = tbl.tl_avenrun.d[i]; + } + return LOADAV_NUM; +} +#endif + +/***************************************************************/ + #if !defined(LOADAV_DONE) /* * The old fashion way: open kernel and read avenrun @@ -173,7 +251,7 @@ # endif #ifdef __sgi -# if _MIPS_SZLONG == 64 +# if _MIPS_SZLONG == 64 || (defined(_MIPS_ISA) && _MIPS_ISA > 2) # define nlist nlist64 # endif #endif diff -Nur screen-3.7.4/mark.c screen-3.7.6/mark.c --- screen-3.7.4/mark.c Tue Apr 15 17:50:27 1997 +++ screen-3.7.6/mark.c Tue Nov 10 16:38:59 1998 @@ -53,9 +53,10 @@ extern char *null, *blank; extern struct mline mline_blank, mline_null; extern struct mchar mchar_so; +extern int use_hardstatus; #ifdef NETHACK -extern nethackflag; +extern int nethackflag; #endif int pastefont = 1; @@ -511,6 +512,9 @@ return; } + if (D_status && !(use_hardstatus && D_HS)) + RemoveStatus(); + GotoPos(markdata->cx, W2D(markdata->cy)); inbuf= *inbufp; inlen= *inlenp; @@ -990,6 +994,16 @@ ty = fore->w_histheight + D_height - 1; fx = markdata->cx; fy = markdata->cy; + +#ifdef KANJI + /* don't just move inside of a kanji, the user wants to see something */ + ml = WIN(ty); + if (ty == fy && fx + 1 == tx && badkanji(ml->font, tx) && tx < D_width - 1) + tx++; + if (ty == fy && fx - 1 == tx && badkanji(ml->font, fx) && tx) + tx--; +#endif + markdata->cx = tx; markdata->cy = ty; /* @@ -1226,6 +1240,8 @@ markdata = (struct markdata *)D_lay->l_data; fore = D_fore; + if (ry >= fore->w_height || xe > fore->w_width) + return EXPENSIVE; y = D2W(ry); ml = WIN(y); dx = xe - xs; @@ -1261,11 +1277,13 @@ { if (pastefont) mchar_marked.font = ml->font[x]; + D_rend.image = mchar_marked.image; if (!cmp_mchar(&D_rend, &mchar_marked)) return EXPENSIVE; } else { + D_rend.image = ml->image[x]; if (!cmp_mchar_mline(&D_rend, ml, x)) return EXPENSIVE; } diff -Nur screen-3.7.4/misc.c screen-3.7.6/misc.c --- screen-3.7.4/misc.c Mon Jun 23 22:57:18 1997 +++ screen-3.7.6/misc.c Tue Nov 10 16:10:38 1998 @@ -55,6 +55,19 @@ return cp; } +/* cheap strstr replacement */ +char * +InStr(str, pat) +char *str; +const char *pat; +{ + int npat = strlen(pat); + for (;*str; str++) + if (!strncmp(str, pat, npat)) + return str; + return 0; +} + #ifndef HAVE_STRERROR char * strerror(err) @@ -284,7 +297,7 @@ f = rl.rlim_max; else #endif /* SVR4 */ -#if defined(SYSV) && !defined(ISC) +#if defined(SYSV) && defined(NOFILE) && !defined(ISC) f = NOFILE; #else /* SYSV && !ISC */ f = getdtablesize(); @@ -493,7 +506,7 @@ struct display *d; { static char ebuf[2048]; - register int esize = 2047, vtype, quofl = 0; + int esize = sizeof(ebuf) - 1, vtype, quofl = 0; register char *e = ebuf; register char *s = ss; register char *v; @@ -627,7 +640,7 @@ int _delay(delay, outc) register int delay; -int (*outc)(); +int (*outc) __P((int)); { int pad; extern short ospeed; @@ -643,6 +656,41 @@ (*outc)(0); return 0; } + + +# ifdef linux + +/* stupid stupid linux ncurses! It won't to padding with + * zeros but sleeps instead. This breaks CalcCost, of course. + * Also, the ncurses wait functions use a global variable + * to store the current outc function. Oh well... + */ + +int (*save_outc) __P((int)); + +# undef tputs + +void +xtputs(str, affcnt, outc) +char *str; +int affcnt; +int (*outc) __P((int)); +{ + extern int tputs __P((const char *, int, int (*)(int))); + save_outc = outc; + tputs(str, affcnt, outc); +} + +int +_nc_timed_wait(mode, ms, tlp) +int mode, ms, *tlp; +{ + _delay(ms * 10, save_outc); + return 0; +} + +# endif /* linux */ + #endif diff -Nur screen-3.7.4/os.h screen-3.7.6/os.h --- screen-3.7.4/os.h Sat Jun 14 18:08:09 1997 +++ screen-3.7.6/os.h Tue Nov 24 15:39:31 1998 @@ -32,9 +32,9 @@ # define hpux #endif -#if defined(BSDI) || defined(__386BSD__) || defined(_CX_UX) || defined(hpux) +#if defined(BSDI) || defined(__386BSD__) || defined(_CX_UX) || defined(hpux) || defined(_IBMR2) # include -#endif /* BSDI || __386BSD__ || _CX_UX */ +#endif /* BSDI || __386BSD__ || _CX_UX || hpux || _IBMR2 */ #ifdef ISC # ifdef ENAMETOOLONG @@ -104,9 +104,10 @@ #endif #include -#if (defined(TIOCGWINSZ) || defined(TIOCSWINSZ)) && defined(M_UNIX) +#ifdef M_UNIX /* SCO */ # include # include +# define ftruncate(fd, s) chsize(fd, s) #endif #ifdef SYSV @@ -116,7 +117,9 @@ # define bcmp memcmp # define killpg(pgrp,sig) kill( -(pgrp), sig) #else -# define getcwd(b,l) getwd(b) +# ifndef linux +# define getcwd(b,l) getwd(b) +# endif #endif #ifndef USEBCOPY @@ -206,6 +209,11 @@ # undef TIOCPKT #endif +/* linux ncurses is broken, we have to use our own tputs */ +#ifdef linux +# define tputs xtputs +#endif + /***************************************************************** * utmp handling @@ -318,6 +326,9 @@ #if defined(S_IFDIR) && defined(S_IFMT) && !defined(S_ISDIR) #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif +#if defined(S_IFLNK) && defined(S_IFMT) && !defined(S_ISLNK) +#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) +#endif /* * SunOS 4.1.3: `man 2V open' has only one line that mentions O_NOBLOCK: @@ -406,7 +417,7 @@ * Wait stuff */ -#if (!defined(sysV68) && !defined(M_XENIX)) || defined(NeXT) +#if (!defined(sysV68) && !defined(M_XENIX)) || defined(NeXT) || defined(M_UNIX) # include #endif diff -Nur screen-3.7.4/osdef.h.in screen-3.7.6/osdef.h.in --- screen-3.7.4/osdef.h.in Fri May 2 15:56:45 1997 +++ screen-3.7.6/osdef.h.in Fri Oct 9 14:52:24 1998 @@ -88,9 +88,10 @@ extern int putenv __P((char *)); extern int tgetent __P((char *, char *)); +extern char *tgetstr __P((char *, char **)); extern int tgetnum __P((char *)); extern int tgetflag __P((char *)); -extern void tputs __P((char *, int, void (*)(int))); +extern void tputs __P((char *, int, int (*)(int))); extern char *tgoto __P((char *, int, int)); #ifdef POSIX @@ -161,7 +162,9 @@ #endif struct timeval; /* for select __P */ extern int select __P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); +#ifdef HAVE_UTIMES extern int utimes __P((char *, struct timeval *)); +#endif extern void unsetenv __P((char *)); diff -Nur screen-3.7.4/patchlevel.h screen-3.7.6/patchlevel.h --- screen-3.7.4/patchlevel.h Mon Jun 23 23:05:21 1997 +++ screen-3.7.6/patchlevel.h Wed Nov 25 17:11:59 1998 @@ -241,11 +241,34 @@ * vsnprintf() support. exit -> _exit in window.c. * AddXChars now tolerates NULL string. * -- DISTRIBUTED + * 10.11.98 -- 3.07.05 Wayne's resize.c patch to keep the cursor + * onscreen. FindWindow corrected. AIX4 patch + * from robert@mayday.cix.co.uk. + * Fixed kanji am & markcursor bugs. + * SCO support (Gert Doering). + * Wayne's statusline extra space. New flag nospc + * for MakeWinMsg. New TF capability: add missing + * termcap/info caps. screen-exchange security + * fix. Use kstat for Solaris' loadavg. + * Check for mode 775 if screen runs setgid. + * Fixed typo in silence command. + * Allow detach with no tty. HPUX10.20 ltchars + * hack. Use @1/@7 as replacement for kh/kH. + * Use seteuid before calling tgetent. + * Check for displays in Msg(). + * Linux ncurses hack: redefine _nc_timed_wait. + * Configure check for ncurses (sigh). + * ITOH Yasufumi: kanji fixes, osf support, + * bug fixes. More secure Rewrite(). + * Increased line buffer size to 2048 bytes. + * SCO-5 Fixes (Brian L. Gentry). + * 25.11.98 -- 3.07.06 resize code now handles tabs correctly. + * -- DISTRIBUTED */ #define ORIGIN "FAU" #define REV 3 #define VERS 7 -#define PATCHLEVEL 4 -#define DATE "23-Jun-97" +#define PATCHLEVEL 6 +#define DATE "25-Nov-98" #define STATE "" diff -Nur screen-3.7.4/process.c screen-3.7.6/process.c --- screen-3.7.4/process.c Thu May 1 20:00:05 1997 +++ screen-3.7.6/process.c Wed Nov 11 22:29:12 1998 @@ -1807,7 +1807,7 @@ { if (ParseNum(act, &i)) break; - n = i; + n = i > 0; } else if (ParseSwitch(act, &n)) break; @@ -1817,8 +1817,8 @@ if (display) /* we tell only this user */ ACLBYTE(fore->w_lio_notify, D_user->u_id) |= ACLBIT(D_user->u_id); else - for (i = 0; i < maxusercount; i++) - ACLBYTE(fore->w_mon_notify, i) |= ACLBIT(i); + for (n = 0; n < maxusercount; n++) + ACLBYTE(fore->w_lio_notify, n) |= ACLBIT(n); if (!fore->w_tstamp.seconds) #endif fore->w_tstamp.lastio = time(0); @@ -1841,8 +1841,8 @@ ACLBYTE(fore->w_lio_notify, D_user->u_id) &= ~ACLBIT(D_user->u_id); else - for (i = 0; i < maxusercount; i++) - ACLBYTE(fore->w_lio_notify, i) &= ~ACLBIT(i); + for (n = 0; n < maxusercount; n++) + ACLBYTE(fore->w_lio_notify, n) &= ~ACLBIT(n); for (i = maxusercount - 1; i >= 0; i--) if (ACLBYTE(fore->w_lio_notify, i)) break; @@ -3080,7 +3080,7 @@ Msg(0, "You are %s logging.", on ? "already" : "not"); return; } - strncpy(buf, MakeWinMsg(screenlogfile, fore, '%'), 1023); + strncpy(buf, MakeWinMsg(screenlogfile, fore, '%', 1), 1023); buf[1023] = 0; if (fore->w_logfp != NULL) { @@ -3178,7 +3178,6 @@ p->w_monitor = MON_ON; } } - *s++ = ' '; *s = '\0'; if (ss - buf > D_width / 2) { @@ -3587,12 +3586,17 @@ } if (pp->buf) free(pp->buf); - if ((pp->buf = (char *)malloc(D_user->u_copylen)) == NULL) + pp->buf = 0; + pp->len = 0; + if (D_user->u_copylen) { - Msg(0, strnomem); - return; + if ((pp->buf = (char *)malloc(D_user->u_copylen)) == NULL) + { + Msg(0, strnomem); + return; + } + bcopy(D_user->u_copybuffer, pp->buf, D_user->u_copylen); } - bcopy(D_user->u_copybuffer, pp->buf, D_user->u_copylen); pp->len = D_user->u_copylen; Msg(0, "Copied %d characters into register %c", D_user->u_copylen, *buf); } diff -Nur screen-3.7.4/pty.c screen-3.7.6/pty.c --- screen-3.7.4/pty.c Mon Nov 20 19:03:05 1995 +++ screen-3.7.6/pty.c Wed Nov 18 21:19:14 1998 @@ -62,6 +62,11 @@ # define PTYRANGE1 "0123456789abcdef" #endif +/* SVR4 pseudo ttys don't seem to work with SCO-5 */ +#ifdef M_UNIX +# undef SVR4 +#endif + extern int eff_uid; /* used for opening a new pty-pair: */ @@ -72,8 +77,13 @@ static char PtyProto[] = "/dev/ptym/ptyXY"; static char TtyProto[] = "/dev/pty/ttyXY"; # else +# ifdef M_UNIX +static char PtyProto[] = "/dev/ptypXY"; +static char TtyProto[] = "/dev/ttypXY"; +# else static char PtyProto[] = "/dev/ptyXY"; static char TtyProto[] = "/dev/ttyXY"; +# endif # endif /* hpux */ #endif @@ -154,7 +164,7 @@ char **ttyn; { int f; - char *name; + char *name, *_getpty(); sigret_t (*sigcld)__P(SIGPROTOARG); /* diff -Nur screen-3.7.4/resize.c screen-3.7.6/resize.c --- screen-3.7.4/resize.c Mon Nov 20 19:03:05 1995 +++ screen-3.7.6/resize.c Tue Nov 17 16:25:03 1998 @@ -44,6 +44,7 @@ static void FreeMline __P((struct mline *)); static int AllocMline __P((struct mline *ml, int)); static void MakeBlankLine __P((char *, int)); +static int BcopyMline __P((struct mline *, int, struct mline *, int, int, int)); extern struct display *display, *displays; extern char *blank, *null; @@ -445,6 +446,7 @@ struct mline *mlf = 0, *mlt = 0, *ml, *nmlines, *nhlines; int fy, ty, l, lx, lf, lt, yy, oty, addone; int ncx, ncy, naka, t; + int y, shift; if (wi == 0) he = hi = 0; @@ -519,6 +521,38 @@ p->w_x--; } + /* handle the cursor and autoaka lines now if the widths are equal */ + if (p->w_width == wi) + { + ncx = p->w_x + addone; + ncy = p->w_y + he - p->w_height; + /* never lose sight of the line with the cursor on it */ + shift = -ncy; + for (yy = p->w_y + p->w_histheight - 1; yy >= 0 && ncy + shift < he; yy--) + { + ml = OLDWIN(yy); + if (ml->image[p->w_width] == ' ') + break; + shift++; + } + if (shift < 0) + shift = 0; + else + debug1("resize: cursor out of bounds, shifting %d\n", shift); + ncy += shift; + if (p->w_autoaka > 0) + { + naka = p->w_autoaka + he - p->w_height + shift; + if (naka < 1 || naka > he) + naka = 0; + } + while (shift-- > 0) + { + ml = OLDWIN(fy); + FreeMline(ml); + fy--; + } + } debug2("fy %d ty %d\n", fy, ty); if (fy >= 0) mlf = OLDWIN(fy); @@ -532,13 +566,6 @@ /* here is a simple shortcut: just copy over */ *mlt = *mlf; *mlf = mline_zero; - if (fy == p->w_y + p->w_histheight) - { - ncx = p->w_x + addone; - ncy = ty - hi >= 0 ? ty - hi : 0; - } - if (p->w_autoaka > 0 && fy == p->w_autoaka - 1 + p->w_histheight) - naka = ty - hi >= 0 ? 1 + ty - hi : 0; if (--fy >= 0) mlf = OLDWIN(fy); if (--ty >= 0) @@ -584,7 +611,30 @@ if (fy == p->w_y + p->w_histheight && lf - lx <= p->w_x && lf > p->w_x) { ncx = p->w_x + lt - lf + addone; - ncy = ty - hi >= 0 ? ty - hi : 0; + ncy = ty - hi; + shift = wi ? -ncy + (l - lx) / wi : 0; + if (ty + shift > hi + he - 1) + shift = hi + he - 1 - ty; + if (shift > 0) + { + debug3("resize: cursor out of bounds, shifting %d [%d/%d]\n", shift, lt - lx, wi); + for (y = hi + he - 1; y >= ty; y--) + { + mlt = NEWWIN(y); + FreeMline(mlt); + if (y - shift < ty) + continue; + ml = NEWWIN(y - shift); + *mlt = *ml; + *ml = mline_zero; + } + ncy += shift; + ty += shift; + mlt = NEWWIN(ty); + if (naka > 0) + naka = naka + shift > he ? 0 : naka + shift; + } + ASSERT(ncy >= 0); } /* did we copy autoaka line ? */ if (p->w_autoaka > 0 && fy == p->w_autoaka - 1 + p->w_histheight && lf - lx <= 0) @@ -652,7 +702,7 @@ { /* tabs get wi+1 because 0 <= x <= wi */ p->w_tabs = malloc((unsigned) wi + 1); - t = 8; + t = 0; } else { @@ -680,8 +730,9 @@ Msg(0, strnomem); return -1; } - for (t = (t + 7) & 8; t < wi; t += 8) - p->w_tabs[t] = 1; + for (; t < wi; t++) + p->w_tabs[t] = t && !(t & 7) ? 1 : 0; + p->w_tabs[wi] = 0; } else { diff -Nur screen-3.7.4/screen.c screen-3.7.6/screen.c --- screen-3.7.4/screen.c Sat May 10 14:21:27 1997 +++ screen-3.7.6/screen.c Sun Oct 18 21:22:20 1998 @@ -124,7 +124,8 @@ static sigret_t FinitHandler __P(SIGPROTOARG); static void DoWait __P((void)); static void WindowDied __P((struct win *)); - +static void mkfdsets __P((fd_set *, fd_set *)); +static int IsSymbol __P((register char *, register char *)); int nversion; /* numerical version, used for secondary DA */ @@ -277,7 +278,7 @@ if (p->w_lay->l_block) continue; /* - * Don't accept input from window or pseudowin if there is to much + * Don't accept input from window or pseudowin if there is too much * output pending on display . */ if (p->w_active && (D_obufp - D_obuf) > D_obufmax) @@ -845,7 +846,8 @@ if (strlen(home) > MAXPATHLEN - 25) Panic(0, "$HOME too long - sorry."); - if (!detached && !lsflag) + attach_tty = ""; + if (!detached && !lsflag && !(dflag && !mflag && !rflag && !xflag)) { /* ttyname implies isatty */ if (!(attach_tty = ttyname(0))) @@ -949,7 +951,9 @@ Panic(0, "'%s' must be a directory.", SockDir); if (eff_uid == 0 && st.st_uid != eff_uid) Panic(0, "Directory '%s' must be owned by root.", SockDir); - n = eff_uid ? 0777 : 0755; + n = (eff_uid == 0) ? 0755 : + (eff_gid == st.st_gid && eff_gid != real_gid) ? 0775 : + 0777; if ((st.st_mode & 0777) != n) Panic(0, "Directory '%s' must have mode %03o.", SockDir, n); } @@ -1383,11 +1387,16 @@ if ((nsel = select(FD_SETSIZE, &r, &w, (fd_set *)0, (tv.tv_sec || tv.tv_usec) ? &tv : (struct timeval *) 0)) < 0) { debug1("Bad select - errno %d\n", errno); -#if defined(sgi) && defined(SVR4) +#if (defined(sgi) && defined(SVR4)) || defined(__osf__) /* Ugly workaround for braindead IRIX5.2 select. * read() should return EIO, not select()! */ +# ifdef __osf__ + if (errno == EBADF /* OSF/1 3.x bug */ + || errno == EIO) /* OSF/1 4.x bug */ +# else if (errno == EIO) +# endif { debug("IRIX5.2 workaround: searching for bad display\n"); for (display = displays; display; ) @@ -1750,7 +1759,7 @@ break; /* so we just break */ } #ifdef TIOCPKT - if ((p->w_t.flags & TTY_FLAG_PLAIN) == 0) + if (p->w_type == TTY_TYPE_PTY) { if (buf[0]) { @@ -1796,7 +1805,7 @@ { p->w_bell = BELL_MSG; for (display = displays; display; display = display->d_next) - Msg(0, "%s", MakeWinMsg(BellString, p, '%')); + Msg(0, "%s", MakeWinMsg(BellString, p, '%', 0)); if (p->w_monitor == MON_FOUND) p->w_monitor = MON_DONE; } @@ -1818,7 +1827,7 @@ { p->w_monitor = MON_MSG; for (display = displays; display; display = display->d_next) - Msg(0, "%s", MakeWinMsg(ActivityString, p, '%')); + Msg(0, "%s", MakeWinMsg(ActivityString, p, '%', 0)); } } #if defined(DEBUG) && !defined(SELECT_BROKEN) @@ -1850,15 +1859,10 @@ RemoveUtmp(p); p->w_slot = 0; /* "detached" */ } -#endif - (void) chmod(p->w_tty, 0666); - (void) chown(p->w_tty, 0, 0); - close(p->w_ptyfd); - p->w_ptyfd = -1; -#ifdef UTMPOK /* zap saved utmp as the slot may change */ bzero((char *)&p->w_savut, sizeof(p->w_savut)); #endif + CloseDevice(p); p->w_pid = 0; ResetWindow(p); p->w_y = p->w_bot; @@ -2321,7 +2325,6 @@ for (op = environ; *op; ++op) { -debug1("MakeNewEnv: %s\n", *op); if (!IsSymbol(*op, "TERM") && !IsSymbol(*op, "TERMCAP") && !IsSymbol(*op, "STY") && !IsSymbol(*op, "WINDOW") && !IsSymbol(*op, "SCREENCAP") && !IsSymbol(*op, "SHELL") @@ -2373,7 +2376,7 @@ sprintf(p, ": %s", strerror(err)); } debug2("Msg('%s') (%#x);\n", buf, (unsigned int)display); - if (display) + if (display && displays) MakeStatus(buf); else if (displays) { @@ -2474,10 +2477,11 @@ static const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; char * -MakeWinMsg(s, win, esc) +MakeWinMsg(s, win, esc, nospc) register char *s; struct win *win; int esc; +int nospc; { static char buf[MAXSTR]; register char *p = buf; @@ -2564,10 +2568,10 @@ sprintf(p, "%02d", tm->tm_sec); break; case 'w': - sprintf(p, "%2d:%02d", tm->tm_hour, tm->tm_min); + sprintf(p, nospc ? "%02d:%02d" : "%2d:%02d", tm->tm_hour, tm->tm_min); break; case 'W': - sprintf(p, "%2d:%02d", (tm->tm_hour + 11) % 12 + 1, tm->tm_min); + sprintf(p, nospc ? "%02d:%02d" : "%2d:%02d", (tm->tm_hour + 11) % 12 + 1, tm->tm_min); break; default: break; diff -Nur screen-3.7.4/screen.h screen-3.7.6/screen.h --- screen-3.7.4/screen.h Mon Apr 14 19:36:17 1997 +++ screen-3.7.6/screen.h Sat Aug 22 17:39:58 1998 @@ -89,22 +89,23 @@ */ #define MAXHISTHEIGHT 3000 #define DEFAULTHISTHEIGHT 100 -#define DEFAULT_BUFFERFILE "/tmp/screen-exchange" +#ifdef NAME_MAX +# define DEFAULT_BUFFERFILE "/tmp/screen-xchg" +#else +# define DEFAULT_BUFFERFILE "/tmp/screen-exchange" +#endif -#define TTY_FLAG_PLAIN 0x01 - -struct tty_attr -{ - int flags; /* a PLAIN tty or a process behind */ -}; +#if defined(hpux) && !(defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT)) +# define HPUX_LTCHARS_HACK +#endif struct mode { #ifdef POSIX struct termios tio; -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK struct ltchars m_ltchars; -# endif /* hpux */ +# endif /* HPUX_LTCHARS_HACK */ #else /* POSIX */ # ifdef TERMIO struct termio tio; diff -Nur screen-3.7.4/socket.c screen-3.7.6/socket.c --- screen-3.7.4/socket.c Sat Jun 14 19:12:47 1997 +++ screen-3.7.6/socket.c Wed Nov 25 19:25:36 1998 @@ -50,6 +50,9 @@ static int CheckPid __P((int)); static void ExecCreate __P((struct msg *)); +#ifdef PASSWORD +static int CheckPasswd __P((char *, int, char *)); +#endif #if defined(_SEQUENT_) && !defined(NAMEDPIPE) # define connect sconnect /* _SEQUENT_ has braindamaged connect */ static int sconnect __P((int, struct sockaddr *, int)); @@ -64,7 +67,7 @@ extern struct win *fore, *wtab[], *console_window, *windows; extern struct NewWindow nwin_undef; #ifdef NETHACK -extern nethackflag; +extern int nethackflag; #endif #ifdef MULTIUSER extern char *multi; @@ -359,6 +362,7 @@ break; case -3: printf("\t%s\t(Remote or dead)\n", sent->name); + break; case -4: printf("\t%s\t(Private)\n", sent->name); break; @@ -1115,11 +1119,11 @@ /* try to get another window */ #ifdef MULTIUSER for (wi = windows; wi; wi = wi->w_next) - if (!wi->w_display && !AclCheckPermWin(D_user, ACL_WRITE, fore)) + if (!wi->w_display && !AclCheckPermWin(D_user, ACL_WRITE, wi)) break; if (!wi) for (wi = windows; wi; wi = wi->w_next) - if (!wi->w_display && !AclCheckPermWin(D_user, ACL_READ, fore)) + if (!wi->w_display && !AclCheckPermWin(D_user, ACL_READ, wi)) break; if (!wi) #endif diff -Nur screen-3.7.4/term.c screen-3.7.6/term.c --- screen-3.7.4/term.c Tue Apr 15 17:26:48 1997 +++ screen-3.7.6/term.c Wed Nov 25 17:12:09 1998 @@ -117,6 +117,8 @@ { "AB", T_STR }, { "Sf", T_STR }, { "Sb", T_STR }, + { "op", T_STR }, + { "be", T_FLG }, { "AX", T_FLG }, /* keypad/cursorkeys */ @@ -156,6 +158,7 @@ { "KJ", T_STR }, { "VR", T_STR }, { "VN", T_STR }, + { "TF", T_FLG }, /* d_font setting */ { "G0", T_FLG }, @@ -194,8 +197,7 @@ { "F9", T_STR }, { "FA", T_STR }, - { "kb", T_STR }, KMAPDEF("\010") - { "kh", T_STR }, KMAPDEF("\033[1~") KMAPMDEF("\201") + { "kb", T_STR }, { "K1", T_STR }, { "K2", T_STR }, { "K3", T_STR }, @@ -206,21 +208,26 @@ { "ka", T_STR }, { "kB", T_STR }, { "kC", T_STR }, - { "kD", T_STR }, KMAPDEF("\033[3~") { "kE", T_STR }, { "kF", T_STR }, KMAPMDEF("\004") - { "kH", T_STR }, KMAPDEF("\033[4~") KMAPMDEF("\205") - { "kI", T_STR }, KMAPDEF("\033[2~") { "kL", T_STR }, { "kM", T_STR }, - { "kN", T_STR }, KMAPDEF("\033[6~") KMAPMDEF("\006") - { "kP", T_STR }, KMAPDEF("\033[5~") KMAPMDEF("\002") { "kR", T_STR }, KMAPMDEF("\025") { "kS", T_STR }, { "kT", T_STR }, { "kt", T_STR }, + +/* keys above the cursor */ +/* define T_NAVIGATE */ + { "kh", T_STR }, KMAPDEF("\033[1~") KMAPMDEF("\201") { "@1", T_STR }, + { "kH", T_STR }, KMAPDEF("\033[4~") KMAPMDEF("\205") { "@7", T_STR }, + { "kN", T_STR }, KMAPDEF("\033[6~") KMAPMDEF("\006") + { "kP", T_STR }, KMAPDEF("\033[5~") KMAPMDEF("\002") + { "kI", T_STR }, KMAPDEF("\033[2~") + { "kD", T_STR }, KMAPDEF("\033[3~") + /* keys that can have two bindings */ /* define T_CURSOR */ { "ku", T_STR }, KMAPDEF("\033[A") KMAPADEF("\033OA") KMAPMDEF("\220") diff -Nur screen-3.7.4/term.h.dist screen-3.7.6/term.h.dist --- screen-3.7.4/term.h.dist Sat Jun 14 22:22:34 1997 +++ screen-3.7.6/term.h.dist Wed Nov 25 17:13:57 1998 @@ -148,90 +148,97 @@ #define D_CSF (D_tcs[62].str) #define d_CSB d_tcs[63].str #define D_CSB (D_tcs[63].str) -#define d_CAX d_tcs[64].flg -#define D_CAX (D_tcs[64].flg) -#define d_KS d_tcs[65].str -#define D_KS (D_tcs[65].str) -#define d_KE d_tcs[66].str -#define D_KE (D_tcs[66].str) -#define d_CCS d_tcs[67].str -#define D_CCS (D_tcs[67].str) -#define d_CCE d_tcs[68].str -#define D_CCE (D_tcs[68].str) -#define d_PO d_tcs[69].str -#define D_PO (D_tcs[69].str) -#define d_PF d_tcs[70].str -#define D_PF (D_tcs[70].str) -#define d_HS d_tcs[71].flg -#define D_HS (D_tcs[71].flg) -#define d_WS d_tcs[72].num -#define D_WS (D_tcs[72].num) -#define d_TS d_tcs[73].str -#define D_TS (D_tcs[73].str) -#define d_FS d_tcs[74].str -#define D_FS (D_tcs[74].str) -#define d_DS d_tcs[75].str -#define D_DS (D_tcs[75].str) -#define d_VI d_tcs[76].str -#define D_VI (D_tcs[76].str) -#define d_VS d_tcs[77].str -#define D_VS (D_tcs[77].str) -#define d_VE d_tcs[78].str -#define D_VE (D_tcs[78].str) -#define d_AM d_tcs[79].flg -#define D_AM (D_tcs[79].flg) -#define d_XV d_tcs[80].flg -#define D_XV (D_tcs[80].flg) -#define d_XN d_tcs[81].flg -#define D_XN (D_tcs[81].flg) -#define d_COP d_tcs[82].flg -#define D_COP (D_tcs[82].flg) -#define d_CLP d_tcs[83].flg -#define D_CLP (D_tcs[83].flg) -#define d_CNF d_tcs[84].flg -#define D_CNF (D_tcs[84].flg) -#define d_NX d_tcs[85].flg -#define D_NX (D_tcs[85].flg) -#define d_CAN d_tcs[86].flg -#define D_CAN (D_tcs[86].flg) -#define d_COL d_tcs[87].num -#define D_COL (D_tcs[87].num) -#define d_CKJ d_tcs[88].str -#define D_CKJ (D_tcs[88].str) -#define d_CVR d_tcs[89].str -#define D_CVR (D_tcs[89].str) -#define d_CVN d_tcs[90].str -#define D_CVN (D_tcs[90].str) -#define d_CG0 d_tcs[91].flg -#define D_CG0 (D_tcs[91].flg) -#define d_CS0 d_tcs[92].str -#define D_CS0 (D_tcs[92].str) -#define d_CE0 d_tcs[93].str -#define D_CE0 (D_tcs[93].str) -#define d_CC0 d_tcs[94].str -#define D_CC0 (D_tcs[94].str) -#define d_AS d_tcs[95].str -#define D_AS (D_tcs[95].str) -#define d_AE d_tcs[96].str -#define D_AE (D_tcs[96].str) -#define d_AC d_tcs[97].str -#define D_AC (D_tcs[97].str) -#define d_EA d_tcs[98].str -#define D_EA (D_tcs[98].str) -#define d_CXC d_tcs[99].str -#define D_CXC (D_tcs[99].str) -#define T_CAPS 100 -#define T_CURSOR 147 -#define T_KEYPAD 151 -#define T_OCAPS 169 -#define T_ECAPS 182 -#define T_N 182 +#define d_OP d_tcs[64].str +#define D_OP (D_tcs[64].str) +#define d_BE d_tcs[65].flg +#define D_BE (D_tcs[65].flg) +#define d_CAX d_tcs[66].flg +#define D_CAX (D_tcs[66].flg) +#define d_KS d_tcs[67].str +#define D_KS (D_tcs[67].str) +#define d_KE d_tcs[68].str +#define D_KE (D_tcs[68].str) +#define d_CCS d_tcs[69].str +#define D_CCS (D_tcs[69].str) +#define d_CCE d_tcs[70].str +#define D_CCE (D_tcs[70].str) +#define d_PO d_tcs[71].str +#define D_PO (D_tcs[71].str) +#define d_PF d_tcs[72].str +#define D_PF (D_tcs[72].str) +#define d_HS d_tcs[73].flg +#define D_HS (D_tcs[73].flg) +#define d_WS d_tcs[74].num +#define D_WS (D_tcs[74].num) +#define d_TS d_tcs[75].str +#define D_TS (D_tcs[75].str) +#define d_FS d_tcs[76].str +#define D_FS (D_tcs[76].str) +#define d_DS d_tcs[77].str +#define D_DS (D_tcs[77].str) +#define d_VI d_tcs[78].str +#define D_VI (D_tcs[78].str) +#define d_VS d_tcs[79].str +#define D_VS (D_tcs[79].str) +#define d_VE d_tcs[80].str +#define D_VE (D_tcs[80].str) +#define d_AM d_tcs[81].flg +#define D_AM (D_tcs[81].flg) +#define d_XV d_tcs[82].flg +#define D_XV (D_tcs[82].flg) +#define d_XN d_tcs[83].flg +#define D_XN (D_tcs[83].flg) +#define d_COP d_tcs[84].flg +#define D_COP (D_tcs[84].flg) +#define d_CLP d_tcs[85].flg +#define D_CLP (D_tcs[85].flg) +#define d_CNF d_tcs[86].flg +#define D_CNF (D_tcs[86].flg) +#define d_NX d_tcs[87].flg +#define D_NX (D_tcs[87].flg) +#define d_CAN d_tcs[88].flg +#define D_CAN (D_tcs[88].flg) +#define d_COL d_tcs[89].num +#define D_COL (D_tcs[89].num) +#define d_CKJ d_tcs[90].str +#define D_CKJ (D_tcs[90].str) +#define d_CVR d_tcs[91].str +#define D_CVR (D_tcs[91].str) +#define d_CVN d_tcs[92].str +#define D_CVN (D_tcs[92].str) +#define d_CTF d_tcs[93].flg +#define D_CTF (D_tcs[93].flg) +#define d_CG0 d_tcs[94].flg +#define D_CG0 (D_tcs[94].flg) +#define d_CS0 d_tcs[95].str +#define D_CS0 (D_tcs[95].str) +#define d_CE0 d_tcs[96].str +#define D_CE0 (D_tcs[96].str) +#define d_CC0 d_tcs[97].str +#define D_CC0 (D_tcs[97].str) +#define d_AS d_tcs[98].str +#define D_AS (D_tcs[98].str) +#define d_AE d_tcs[99].str +#define D_AE (D_tcs[99].str) +#define d_AC d_tcs[100].str +#define D_AC (D_tcs[100].str) +#define d_EA d_tcs[101].str +#define D_EA (D_tcs[101].str) +#define d_CXC d_tcs[102].str +#define D_CXC (D_tcs[102].str) +#define T_CAPS 103 +#define T_NAVIGATE 142 +#define T_CURSOR 150 +#define T_KEYPAD 154 +#define T_OCAPS 172 +#define T_ECAPS 185 +#define T_N 185 #ifdef MAPKEYS -# define KMAPDEFSTART 100 +# define KMAPDEFSTART 103 # define NKMAPDEF 69 -# define KMAPADEFSTART 147 +# define KMAPADEFSTART 150 # define NKMAPADEF 22 -# define KMAPMDEFSTART 122 -# define NKMAPMDEF 29 +# define KMAPMDEFSTART 135 +# define NKMAPMDEF 19 #endif diff -Nur screen-3.7.4/termcap.c screen-3.7.6/termcap.c --- screen-3.7.4/termcap.c Thu May 1 18:32:52 1997 +++ screen-3.7.6/termcap.c Wed Nov 25 17:12:23 1998 @@ -29,12 +29,27 @@ #include "screen.h" #include "extern.h" + extern struct display *display, *displays; +extern int real_uid, real_gid, eff_uid, eff_gid; +extern struct term term[]; /* terminal capabilities */ +extern struct NewWindow nwin_undef, nwin_default, nwin_options; +extern int force_vt, assume_LP; +extern int Z0width, Z1width; +#ifdef MAPKEYS +extern struct action umtab[]; +extern struct action mmtab[]; +extern struct action dmtab[]; +extern char *kmap_extras[]; +extern int kmap_extras_fl[]; +extern int DefaultEsc; +#endif static void AddCap __P((char *)); static void MakeString __P((char *, char *, int, char *)); static char *findcap __P((char *, char **, int)); static int copyarg __P((char **, char *)); +static int e_tgetent __P((char *, char *)); static char *e_tgetstr __P((char *, char **)); static int e_tgetflag __P((char *)); static int e_tgetnum __P((char *)); @@ -47,19 +62,6 @@ #endif -extern struct term term[]; /* terminal capabilities */ -extern struct NewWindow nwin_undef, nwin_default, nwin_options; -extern int force_vt, assume_LP; -extern int Z0width, Z1width; -#ifdef MAPKEYS -extern struct action umtab[]; -extern struct action mmtab[]; -extern struct action dmtab[]; -extern char *kmap_extras[]; -extern int kmap_extras_fl[]; -extern int DefaultEsc; -#endif - char Termcap[TERMCAP_BUFSIZE + 8]; /* new termcap +8:"TERMCAP=" */ static int Termcaplen; static int tcLineLen; @@ -105,7 +107,7 @@ ASSERT(display); bzero(tbuf, sizeof(tbuf)); debug1("InitTermcap: looking for tgetent('%s')\n", D_termname); - if (*D_termname == 0 || tgetent(tbuf, D_termname) != 1) + if (*D_termname == 0 || e_tgetent(tbuf, D_termname) != 1) { #ifdef TERMINFO Msg(0, "Cannot find terminfo entry for '%s'.", D_termname); @@ -183,12 +185,35 @@ if (D_LI <= 0) D_LI = 24; + if (D_CTF) + { + /* standard fixes for xterms etc */ + /* assume color if name doesn't begin with vt but it + looks like a vt */ + if (!D_CAF && D_ME && InStr(D_ME, "\033[m")) + { +#ifdef TERMINFO + D_CAF = "\033[3%p1%dm"; + D_CAB = "\033[4%p1%dm"; +#else + D_CAF = "\033[3%dm"; + D_CAB = "\033[4%dm"; +#endif + } + if (D_OP && InStr(D_OP, "\033[39;49m")) + D_CAX = 1; + if (strcmp(D_termname, "xterm-color") == 0) + D_BE = 1; + /* ISO2022 */ + if ((D_EA && InStr(D_EA, "\033(B")) || (D_AS && InStr(D_AS, "\033(0"))) + D_CG0 = 1; + } + if (nwin_options.flowflag == nwin_undef.flowflag) nwin_default.flowflag = D_CNF ? FLOW_NOW * 0 : D_NX ? FLOW_NOW * 1 : FLOW_AUTOFLAG; - D_CLP |= (assume_LP || !D_AM || D_XV || D_XN || - (!extra_incap && !strncmp(D_termname, "vt", 2))); + D_CLP |= (assume_LP || !D_AM || D_XV || D_XN); if (!D_BL) D_BL = "\007"; if (!D_BC) @@ -290,6 +315,8 @@ D_CAF = D_CSF; D_CAB = D_CSB; } + if (D_BE) /* screen erased with background color */ + D_UT = 1; if (!D_DO) D_DO = D_NL; @@ -321,6 +348,7 @@ if (D_CE0 == 0) D_CE0 = "\033(B"; D_AC = 0; + D_EA = 0; } else if (D_AC || (D_AS && D_AE)) /* some kind of graphics */ { @@ -382,6 +410,10 @@ D_kanji = SJIS; } #endif + if (!D_tcs[T_NAVIGATE].str && D_tcs[T_NAVIGATE + 1].str) + D_tcs[T_NAVIGATE].str = D_tcs[T_NAVIGATE + 1].str; /* kh = @1 */ + if (!D_tcs[T_NAVIGATE + 2].str && D_tcs[T_NAVIGATE + 3].str) + D_tcs[T_NAVIGATE + 2].str = D_tcs[T_NAVIGATE + 3].str; /* kH = @7 */ D_UPcost = CalcCost(D_UP); D_DOcost = CalcCost(D_DO); @@ -696,17 +728,17 @@ if (!aflag && strlen(screenterm) + strlen(tname) < MAXSTR-1) { sprintf(p, "%s.%s", screenterm, tname); - if (tgetent(buf, p) == 1) + if (e_tgetent(buf, p) == 1) break; } if (wi >= 132) { sprintf(p, "%s-w", screenterm); - if (tgetent(buf, p) == 1) + if (e_tgetent(buf, p) == 1) break; } strcpy(p, screenterm); - if (tgetent(buf, p) == 1) + if (e_tgetent(buf, p) == 1) break; strcpy(p, "vt100"); } @@ -714,7 +746,7 @@ /* check for compatibility problems, displays == 0 after fork */ { - char *tgetstr(), xbuf[TERMCAP_BUFSIZE], *xbp = xbuf; + char xbuf[TERMCAP_BUFSIZE], *xbp = xbuf; if (tgetstr("im", &xbp) && tgetstr("ic", &xbp) && displays) { #ifdef TERMINFO @@ -728,8 +760,7 @@ tcLineLen = 100; /* Force NL */ if (strlen(Term) > TERMCAP_BUFSIZE - 40) strcpy(Term, "too_long"); - sprintf(Termcap, - "TERMCAP=SC|%s|VT 100/ANSI X3.64 virtual terminal", Term + 5); + sprintf(Termcap, "TERMCAP=SC|%s|VT 100/ANSI X3.64 virtual terminal:", Term + 5); Termcaplen = strlen(Termcap); debug1("MakeTermcap decided '%s'\n", p); if (extra_outcap && *extra_outcap) @@ -1106,6 +1137,24 @@ ** */ +static int +e_tgetent(bp, name) +char *bp, *name; +{ + int r; + +#ifdef USE_SETEUID + xseteuid(real_uid); + xsetegid(real_gid); +#endif + r = tgetent(bp, name); +#ifdef USE_SETEUID + xseteuid(eff_uid); + xsetegid(eff_gid); +#endif + return r; +} + /* findcap: * cap = capability we are looking for @@ -1230,7 +1279,7 @@ char *cap; char **tepp; { - char *tep, *tgetstr(); + char *tep; if ((tep = findcap(cap, tepp, 0))) return (*tep == '@') ? 0 : tep; return tgetstr(cap, tepp); diff -Nur screen-3.7.4/terminfo/screencap screen-3.7.6/terminfo/screencap --- screen-3.7.4/terminfo/screencap Sat Jan 6 23:06:24 1996 +++ screen-3.7.6/terminfo/screencap Fri Aug 21 21:27:15 1998 @@ -12,8 +12,8 @@ :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\ :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\ - :kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:kP=\E[5~:kN=\E[6~:\ - :eA=\E(B\E)0:as=^N:ae=^O:\ + :kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:@7=\E[4~:kP=\E[5~:\ + :kN=\E[6~:eA=\E(B\E)0:as=^N:ae=^O:\ :vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\ :Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\ :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00: diff -Nur screen-3.7.4/terminfo/screeninfo.src screen-3.7.6/terminfo/screeninfo.src --- screen-3.7.4/terminfo/screeninfo.src Sat Jan 6 23:07:50 1996 +++ screen-3.7.6/terminfo/screeninfo.src Fri Aug 21 21:28:08 1998 @@ -13,7 +13,7 @@ kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kend=\E[4~, kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, sgr0=\E[m, @@ -37,7 +37,7 @@ kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kend=\E[4~, kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, sgr0=\E[m, diff -Nur screen-3.7.4/tty.c.dist screen-3.7.6/tty.c.dist --- screen-3.7.4/tty.c.dist Sat Jun 14 22:22:36 1997 +++ screen-3.7.6/tty.c.dist Sun Oct 18 21:47:10 1998 @@ -53,6 +53,7 @@ #include "screen.h" #include "extern.h" + extern struct display *display, *displays; extern int iflag; @@ -95,6 +96,13 @@ signal(SIGALRM, sigalrm); return -1; } + if (!isatty(f)) + { + Msg(0, "'%s' is not a tty", line); + alarm(0); + signal(SIGALRM, sigalrm); + return -1; + } #ifdef I_POP debug("OpenTTY I_POP\n"); while (ioctl(f, I_POP, (char *)0) >= 0) @@ -129,7 +137,7 @@ { struct mode Mode; - InitTTY(&Mode, TTY_FLAG_PLAIN); + InitTTY(&Mode, TTY_TYPE_PLAIN); #ifdef DEBUG DebugTTY(&Mode); #endif @@ -152,7 +160,7 @@ #else int intrc, origintrc = -1; /* display? */ #endif -static startc, stopc; /* display? */ +static int startc, stopc; /* display? */ void @@ -178,9 +186,7 @@ #if defined(IXON) m->tio.c_iflag |= IXON; #endif /* IXON */ -#if defined(IMAXBEL) - m->tio.c_iflag |= IMAXBEL; -#endif /* IMAXBEL */ +/* IF{IMAXBEL} m->tio.c_iflag |= IMAXBEL; */ if (!ttyflag) /* may not even be good for ptys.. */ { @@ -302,14 +308,14 @@ m->tio.c_cc[VMIN] = 1; m->tio.c_cc[VTIME] = 0; } -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK m->m_ltchars.t_suspc = Ctrl('Z'); m->m_ltchars.t_dsuspc = Ctrl('Y'); m->m_ltchars.t_rprntc = Ctrl('R'); m->m_ltchars.t_flushc = Ctrl('O'); m->m_ltchars.t_werasc = Ctrl('W'); m->m_ltchars.t_lnextc = Ctrl('V'); -# endif /* hpux */ +# endif /* HPUX_LTCHARS_HACK */ #else /* POSIX */ @@ -479,7 +485,7 @@ errno = 0; #ifdef POSIX tcsetattr(fd, TCSADRAIN, &mp->tio); -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK ioctl(fd, TIOCSLTC, (char *)&mp->m_ltchars); # endif #else @@ -518,7 +524,7 @@ errno = 0; #ifdef POSIX tcgetattr(fd, &mp->tio); -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK ioctl(fd, TIOCGLTC, (char *)&mp->m_ltchars); # endif #else @@ -569,6 +575,9 @@ #if defined(ICRNL) np->tio.c_iflag &= ~ICRNL; #endif /* ICRNL */ +#if defined(ISTRIP) + np->tio.c_iflag &= ~ISTRIP; +#endif /* ISTRIP */ #if defined(ONLCR) np->tio.c_oflag &= ~ONLCR; #endif /* ONLCR */ @@ -642,14 +651,14 @@ #if defined(VKILL) && VKILL < MAXCC np->tio.c_cc[VKILL] = VDISABLE; #endif /* VKILL */ -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK np->m_ltchars.t_suspc = VDISABLE; np->m_ltchars.t_dsuspc = VDISABLE; np->m_ltchars.t_rprntc = VDISABLE; np->m_ltchars.t_flushc = VDISABLE; np->m_ltchars.t_werasc = VDISABLE; np->m_ltchars.t_lnextc = VDISABLE; -# else /* hpux */ +# else /* HPUX_LTCHARS_HACK */ #if defined(VDSUSP) && VDSUSP < MAXCC np->tio.c_cc[VDSUSP] = VDISABLE; #endif /* VDSUSP */ @@ -659,7 +668,7 @@ #if defined(VWERASE) && VWERASE < MAXCC np->tio.c_cc[VWERASE] = VDISABLE; #endif /* VWERASE */ -# endif /* hpux */ +# endif /* HPUX_LTCHARS_HACK */ #else /* TERMIO || POSIX */ startc = op->m_tchars.t_startc; stopc = op->m_tchars.t_stopc; @@ -827,7 +836,7 @@ struct win *wp; int n, closeopen; { - if ((wp->w_t.flags & TTY_FLAG_PLAIN) == 0) + if (wp->w_type != TTY_TYPE_PLAIN) return; debug3("break(%d, %d) fd %d\n", n, closeopen, wp->w_ptyfd); @@ -908,37 +917,39 @@ char *rc_name; { #ifdef TIOCCONS - char *slave; - int sfd = -1, ret = 0; struct display *d; + int ret = 0; + int sfd = -1; - if (!on) + if (on) { - if ((fd = OpenPTY(&slave)) < 0) + if (displays == 0) { - Msg(errno, "%s: could not open detach pty master", rc_name); + Msg(0, "I need a display"); return -1; } - if ((sfd = open(slave, O_RDWR)) < 0) + for (d = displays; d; d = d->d_next) + if (strcmp(d->d_usertty, "/dev/console") == 0) + break; + if (d) { - Msg(errno, "%s: could not open detach pty slave", rc_name); - close(fd); + Msg(0, "too dangerous - screen is running on /dev/console"); return -1; } } - else + + if (!on) { - if (displays == 0) + char *slave; + if ((fd = OpenPTY(&slave)) < 0) { - Msg(0, "I need a display"); + Msg(errno, "%s: could not open detach pty master", rc_name); return -1; } - for (d = displays; d; d = d->d_next) - if (strcmp(d->d_usertty, "/dev/console") == 0) - break; - if (d) + if ((sfd = open(slave, O_RDWR)) < 0) { - Msg(0, "too dangerous - screen is running on /dev/console"); + Msg(errno, "%s: could not open detach pty slave", rc_name); + close(fd); return -1; } } @@ -953,10 +964,11 @@ close(fd); } return ret; -#else /* TIOCCONS */ - Msg(0, "%s: no TIOCCONS on this machine", rc_name); + +#else + Msg(0, "%s: don't know how to grab the console", rc_name); return -1; -#endif /* TIOCCONS */ +#endif } @@ -981,14 +993,14 @@ { debug2("c_cc[%d] = %#x\n", i, m->tio.c_cc[i]); } -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK debug1("suspc = %#02x\n", m->m_ltchars.t_suspc); debug1("dsuspc = %#02x\n", m->m_ltchars.t_dsuspc); debug1("rprntc = %#02x\n", m->m_ltchars.t_rprntc); debug1("flushc = %#02x\n", m->m_ltchars.t_flushc); debug1("werasc = %#02x\n", m->m_ltchars.t_werasc); debug1("lnextc = %#02x\n", m->m_ltchars.t_lnextc); -# endif /* hpux */ +# endif /* HPUX_LTCHARS_HACK */ #else /* POSIX */ # ifdef TERMIO debug("struct termio tio:\n"); diff -Nur screen-3.7.4/tty.sh screen-3.7.6/tty.sh --- screen-3.7.4/tty.sh Mon Apr 14 19:36:15 1997 +++ screen-3.7.6/tty.sh Sun Oct 18 21:44:20 1998 @@ -70,6 +70,7 @@ #include "screen.h" #include "extern.h" + extern struct display *display, *displays; extern int iflag; @@ -112,6 +113,13 @@ signal(SIGALRM, sigalrm); return -1; } + if (!isatty(f)) + { + Msg(0, "'%s' is not a tty", line); + alarm(0); + signal(SIGALRM, sigalrm); + return -1; + } #ifdef I_POP debug("OpenTTY I_POP\n"); while (ioctl(f, I_POP, (char *)0) >= 0) @@ -146,7 +154,7 @@ { struct mode Mode; - InitTTY(&Mode, TTY_FLAG_PLAIN); + InitTTY(&Mode, TTY_TYPE_PLAIN); #ifdef DEBUG DebugTTY(&Mode); #endif @@ -169,7 +177,7 @@ #else int intrc, origintrc = -1; /* display? */ #endif -static startc, stopc; /* display? */ +static int startc, stopc; /* display? */ void @@ -187,7 +195,7 @@ IF{IGNPAR} m->tio.c_iflag |= IGNPAR; IF{ISTRIP} m->tio.c_iflag |= ISTRIP; IF{IXON} m->tio.c_iflag |= IXON; -IF{IMAXBEL} m->tio.c_iflag |= IMAXBEL; +/* IF{IMAXBEL} m->tio.c_iflag |= IMAXBEL; */ if (!ttyflag) /* may not even be good for ptys.. */ { @@ -241,14 +249,14 @@ m->tio.c_cc[VMIN] = 1; m->tio.c_cc[VTIME] = 0; } -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK m->m_ltchars.t_suspc = Ctrl('Z'); m->m_ltchars.t_dsuspc = Ctrl('Y'); m->m_ltchars.t_rprntc = Ctrl('R'); m->m_ltchars.t_flushc = Ctrl('O'); m->m_ltchars.t_werasc = Ctrl('W'); m->m_ltchars.t_lnextc = Ctrl('V'); -# endif /* hpux */ +# endif /* HPUX_LTCHARS_HACK */ #else /* POSIX */ @@ -356,7 +364,7 @@ errno = 0; #ifdef POSIX tcsetattr(fd, TCSADRAIN, &mp->tio); -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK ioctl(fd, TIOCSLTC, (char *)&mp->m_ltchars); # endif #else @@ -395,7 +403,7 @@ errno = 0; #ifdef POSIX tcgetattr(fd, &mp->tio); -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK ioctl(fd, TIOCGLTC, (char *)&mp->m_ltchars); # endif #else @@ -444,6 +452,7 @@ np->tio.c_line = 0; # endif IF{ICRNL} np->tio.c_iflag &= ~ICRNL; +IF{ISTRIP} np->tio.c_iflag &= ~ISTRIP; IF{ONLCR} np->tio.c_oflag &= ~ONLCR; np->tio.c_lflag &= ~(ICANON | ECHO); /* @@ -493,18 +502,18 @@ XIF{VSUSP} np->tio.c_cc[VSUSP] = VDISABLE; XIF{VERASE} np->tio.c_cc[VERASE] = VDISABLE; XIF{VKILL} np->tio.c_cc[VKILL] = VDISABLE; -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK np->m_ltchars.t_suspc = VDISABLE; np->m_ltchars.t_dsuspc = VDISABLE; np->m_ltchars.t_rprntc = VDISABLE; np->m_ltchars.t_flushc = VDISABLE; np->m_ltchars.t_werasc = VDISABLE; np->m_ltchars.t_lnextc = VDISABLE; -# else /* hpux */ +# else /* HPUX_LTCHARS_HACK */ XIF{VDSUSP} np->tio.c_cc[VDSUSP] = VDISABLE; XIF{VREPRINT} np->tio.c_cc[VREPRINT] = VDISABLE; XIF{VWERASE} np->tio.c_cc[VWERASE] = VDISABLE; -# endif /* hpux */ +# endif /* HPUX_LTCHARS_HACK */ #else /* TERMIO || POSIX */ startc = op->m_tchars.t_startc; stopc = op->m_tchars.t_stopc; @@ -664,7 +673,7 @@ struct win *wp; int n, closeopen; { - if ((wp->w_t.flags & TTY_FLAG_PLAIN) == 0) + if (wp->w_type != TTY_TYPE_PLAIN) return; debug3("break(%d, %d) fd %d\n", n, closeopen, wp->w_ptyfd); @@ -745,37 +754,39 @@ char *rc_name; { #ifdef TIOCCONS - char *slave; - int sfd = -1, ret = 0; struct display *d; + int ret = 0; + int sfd = -1; - if (!on) + if (on) { - if ((fd = OpenPTY(&slave)) < 0) + if (displays == 0) { - Msg(errno, "%s: could not open detach pty master", rc_name); + Msg(0, "I need a display"); return -1; } - if ((sfd = open(slave, O_RDWR)) < 0) + for (d = displays; d; d = d->d_next) + if (strcmp(d->d_usertty, "/dev/console") == 0) + break; + if (d) { - Msg(errno, "%s: could not open detach pty slave", rc_name); - close(fd); + Msg(0, "too dangerous - screen is running on /dev/console"); return -1; } } - else + + if (!on) { - if (displays == 0) + char *slave; + if ((fd = OpenPTY(&slave)) < 0) { - Msg(0, "I need a display"); + Msg(errno, "%s: could not open detach pty master", rc_name); return -1; } - for (d = displays; d; d = d->d_next) - if (strcmp(d->d_usertty, "/dev/console") == 0) - break; - if (d) + if ((sfd = open(slave, O_RDWR)) < 0) { - Msg(0, "too dangerous - screen is running on /dev/console"); + Msg(errno, "%s: could not open detach pty slave", rc_name); + close(fd); return -1; } } @@ -790,10 +801,11 @@ close(fd); } return ret; -#else /* TIOCCONS */ - Msg(0, "%s: no TIOCCONS on this machine", rc_name); + +#else + Msg(0, "%s: don't know how to grab the console", rc_name); return -1; -#endif /* TIOCCONS */ +#endif } @@ -818,14 +830,14 @@ { debug2("c_cc[%d] = %#x\n", i, m->tio.c_cc[i]); } -# ifdef hpux +# ifdef HPUX_LTCHARS_HACK debug1("suspc = %#02x\n", m->m_ltchars.t_suspc); debug1("dsuspc = %#02x\n", m->m_ltchars.t_dsuspc); debug1("rprntc = %#02x\n", m->m_ltchars.t_rprntc); debug1("flushc = %#02x\n", m->m_ltchars.t_flushc); debug1("werasc = %#02x\n", m->m_ltchars.t_werasc); debug1("lnextc = %#02x\n", m->m_ltchars.t_lnextc); -# endif /* hpux */ +# endif /* HPUX_LTCHARS_HACK */ #else /* POSIX */ # ifdef TERMIO debug("struct termio tio:\n"); diff -Nur screen-3.7.4/utmp.c screen-3.7.6/utmp.c --- screen-3.7.4/utmp.c Mon Apr 14 19:36:18 1997 +++ screen-3.7.6/utmp.c Wed Nov 25 18:28:38 1998 @@ -51,8 +51,9 @@ extern struct display *display; extern struct win *fore; extern char *LoginName; +extern int eff_uid; #ifdef NETHACK -extern nethackflag; +extern int nethackflag; #endif @@ -175,6 +176,7 @@ InitUtmp() { debug1("InitUtmp testing '%s'...\n", UtmpName); +#if !(defined(sun) && defined(SVR4) && defined(GETUTENT)) if ((utmpfd = open(UtmpName, O_RDWR)) == -1) { if (errno != EACCES) @@ -183,10 +185,11 @@ utmpok = 0; return; } -#ifdef GETUTENT +# ifdef GETUTENT close(utmpfd); /* it was just a test */ utmpfd = -1; -#endif /* GETUTENT */ +# endif /* GETUTENT */ +#endif utmpok = 1; } @@ -281,12 +284,14 @@ u = *uu; /* * Ed Hill (ed-hill@uiowa.edu) screen-3.5.2 under AIX 3.2.5 - * when you are down to a single screen, and you log out of it (thus exiting - * screen), it leaves a stray entry in the utmp file. Seems better: - * u.ut_type = EMPTY; + * when you are down to a single screen, and you log out of it (thus + * exiting screen), it leaves a stray entry in the utmp file. + * Seems better: u.ut_type = EMPTY; */ u.ut_type = DEAD_PROCESS; - u.ut_user[0] = '\0'; /* for Digital UNIX 3.2C, kilbi@rad.rwth-aachen.de */ +# if !defined(sun) || !defined(SVR4) + u.ut_user[0] = '\0'; /* for Digital UNIX, kilbi@rad.rwth-aachen.de */ +# endif u.ut_exit.e_termination = 0; u.ut_exit.e_exit= 0; if (pututline(&u) == 0) @@ -298,7 +303,7 @@ (void) lseek(utmpfd, (off_t) (D_loginslot * sizeof(u)), 0); if (read(utmpfd, (char *) &D_utmp_logintty, sizeof(u)) != sizeof(u)) { - Msg(errno, "cannot read %s ??", UtmpName); + Msg(errno, "cannot read %s ?", UtmpName); sleep(1); } # ifdef UT_UNSORTED @@ -316,11 +321,14 @@ #endif /* GETUTENT */ { -#ifdef NETHACK +#if defined(sun) && defined(SVR4) && defined(GETUTENT) + if (eff_uid == 0) /* don't complain if not suid-root */ +#endif +# ifdef NETHACK if (nethackflag) Msg(errno, "%s is too hard to dig in", UtmpName); else -#endif /* NETHACK */ +# endif /* NETHACK */ Msg(errno, "Could not write %s", UtmpName); } #ifdef UT_CLOSE @@ -463,6 +471,7 @@ * "faui45:s.0" or * "132.199.81.4:s.0" (even this may hurt..), but not * "faui45.informati"......:s.0 + * HPUX uses host:0.0, so chop at "." and ":" (Eric Backus) */ for (p = host; *p; p++) if ((*p < '0' || *p > '9') && (*p != '.')) @@ -470,7 +479,7 @@ if (*p) { for (p = host; *p; p++) - if (*p == '.') + if (*p == '.' || (*p == ':' && p != host)) { *p = '\0'; break; @@ -616,6 +625,9 @@ # else /* _SEQUENT_ */ u = *uu; u.ut_type = DEAD_PROCESS; +# if !defined(sun) || !defined(SVR4) + u.ut_user[0] = '\0'; /* for Digital UNIX, kilbi@rad.rwth-aachen.de */ +# endif u.ut_exit.e_termination = 0; u.ut_exit.e_exit= 0; if (pututline(&u) == 0) @@ -672,13 +684,13 @@ { char *name; register slot_t slot; -#ifdef UT_UNSORTED +#ifndef GETUTENT +# ifdef UT_UNSORTED struct utmp u; -#else -# ifndef GETUTENT +# else register struct ttyent *tp; -# endif /* GETUTENT */ -#endif /* UT_UNSORTED */ +# endif +#endif debug1("TtyNameSlot(%s)\n", nam); #ifdef UT_CLOSE diff -Nur screen-3.7.4/window.c screen-3.7.6/window.c --- screen-3.7.4/window.c Sat Jun 14 19:42:32 1997 +++ screen-3.7.6/window.c Wed Nov 18 21:19:47 1998 @@ -117,9 +117,8 @@ { register struct win **pp, *p; register int n, i; - int f = -1; + int type, f = -1; struct NewWindow nwin; - int ttyflag; char *TtyName; #ifdef MULTIUSER extern struct user *users; @@ -161,16 +160,16 @@ n = pp - wtab; debug1("Makewin creating %d\n", n); - if ((f = OpenDevice(nwin.args[0], nwin.lflag, &ttyflag, &TtyName)) < 0) + if ((f = OpenDevice(nwin.args[0], nwin.lflag, &type, &TtyName)) < 0) return -1; - - if ((p = (struct win *) malloc(sizeof(struct win))) == 0) + if ((p = (struct win *)malloc(sizeof(struct win))) == 0) { close(f); Msg(0, strnomem); return -1; } - bzero((char *) p, (int) sizeof(struct win)); /* looks like a calloc above */ + bzero((char *)p, (int)sizeof(struct win)); + p->w_type = type; /* save the command line so that zombies can be resurrected */ for (i = 0; nwin.args[i] && i < MAXARGS - 1; i++) @@ -240,12 +239,7 @@ if (nwin.charset) SetCharsets(p, nwin.charset); - if (ttyflag == TTY_FLAG_PLAIN) - { - p->w_t.flags |= TTY_FLAG_PLAIN; - p->w_pid = 0; - } - else + if (p->w_type == TTY_TYPE_PTY) { debug("forking...\n"); #ifdef PSEUDOS @@ -296,21 +290,18 @@ RemakeWindow(p) struct win *p; { - int ttyflag; char *TtyName; int lflag, f; lflag = nwin_default.lflag; - if ((f = OpenDevice(p->w_cmdargs[0], lflag, &ttyflag, &TtyName)) < 0) + if ((f = OpenDevice(p->w_cmdargs[0], lflag, &p->w_type, &TtyName)) < 0) return -1; strncpy(p->w_tty, *TtyName ? TtyName : p->w_title, MAXSTR - 1); p->w_ptyfd = f; - p->w_t.flags &= ~TTY_FLAG_PLAIN; - if (ttyflag == TTY_FLAG_PLAIN) + if (p->w_type == TTY_TYPE_PLAIN) { - p->w_t.flags |= TTY_FLAG_PLAIN; /* Just in case... */ WriteString(p, p->w_cmdargs[0], strlen(p->w_cmdargs[0])); WriteString(p, ": ", 2); WriteString(p, p->w_title, strlen(p->w_title)); @@ -339,6 +330,22 @@ } void +CloseDevice(wp) +struct win *wp; +{ + if (wp->w_ptyfd < 0) + return; /* already closed */ + if (wp->w_type == TTY_TYPE_PTY) + { + (void)chmod(wp->w_tty, 0666); + (void)chown(wp->w_tty, 0, 0); + } + close(wp->w_ptyfd); + wp->w_ptyfd = -1; + wp->w_tty[0] = 0; +} + +void FreeWindow(wp) struct win *wp; { @@ -352,13 +359,7 @@ #ifdef UTMPOK RemoveUtmp(wp); #endif - if (wp->w_ptyfd >= 0) - { - (void) chmod(wp->w_tty, 0666); - (void) chown(wp->w_tty, 0, 0); - close(wp->w_ptyfd); - wp->w_ptyfd = -1; - } + CloseDevice(wp); if (wp == console_window) console_window = 0; if (wp->w_logfp != NULL) @@ -372,8 +373,7 @@ if (d->d_other == wp) d->d_other = 0; #ifdef MULTIUSER - for (i = 0; i < ACL_BITS_PER_WIN; i++) - free((char *)wp->w_userbits[i]); + FreeWindowAcl(wp); #endif free((char *)wp); } @@ -398,12 +398,13 @@ debug("OpenDevice: OpenTTY\n"); if ((f = OpenTTY(arg)) < 0) return -1; - *typep = TTY_FLAG_PLAIN; + lflag = 0; + *typep = TTY_TYPE_PLAIN; *namep = arg; } else { - *typep = 0; /* for now we hope it is a program */ + *typep = TTY_TYPE_PTY; /* for now we hope it is a program */ f = OpenPTY(namep); if (f == -1) { @@ -441,6 +442,10 @@ */ tcflush(f, TCIOFLUSH); #endif + + if (*typep != TTY_TYPE_PTY) + return f; + #ifdef PTYGROUP (void) chown(*namep, real_uid, PTYGROUP); #else @@ -617,7 +622,7 @@ if (newfd >= 0) { struct mode fakemode, *modep; -#if defined(SVR4) && !defined(sgi) +#if defined(SVR4) && !defined(sgi) && !defined(M_UNIX) if (ioctl(newfd, I_PUSH, "ptem")) { SendErrorMsg("Cannot I_PUSH ptem %s %s", ttyn, strerror(errno)); @@ -795,6 +800,7 @@ extern struct display *display; extern struct win *windows; struct pseudowin *pwin; + int type; if ((w = display ? fore : windows) == NULL) return -1; @@ -880,14 +886,14 @@ *--t = '\0'; debug1("%s\n", pwin->p_cmd); - if ((pwin->p_ptyfd = OpenDevice(av[0], 0, &l, &t)) < 0) + if ((pwin->p_ptyfd = OpenDevice(av[0], 0, &type, &t)) < 0) { free((char *)pwin); return -1; } strncpy(pwin->p_tty, t, MAXSTR - 1); w->w_pwin = pwin; - if (l == TTY_FLAG_PLAIN) + if (type == TTY_TYPE_PLAIN) { FreePseudowin(w); Msg(0, "Cannot handle a TTY as a pseudo win."); @@ -920,8 +926,9 @@ ASSERT(pwin); if (fcntl(w->w_ptyfd, F_SETFL, FNBLOCK)) Msg(errno, "Warning: FreePseudowin: NBLOCK fcntl failed"); - (void) chmod(pwin->p_tty, 0666); - (void) chown(pwin->p_tty, 0, 0); + /* should be able to use CloseDevice() here */ + (void)chmod(pwin->p_tty, 0666); + (void)chown(pwin->p_tty, 0, 0); if (pwin->p_ptyfd >= 0) close(pwin->p_ptyfd); free((char *)pwin); diff -Nur screen-3.7.4/window.h screen-3.7.6/window.h --- screen-3.7.4/window.h Mon Apr 14 19:36:20 1997 +++ screen-3.7.6/window.h Sat Aug 22 17:46:11 1998 @@ -108,6 +108,7 @@ struct win { struct win *w_next; /* next window */ + int w_type; /* type of window */ #ifdef PSEUDOS struct pseudowin *w_pwin; /* ptr to pseudo */ #endif @@ -130,7 +131,6 @@ int w_autoaka; /* autoaka hack */ char w_akabuf[MAXSTR]; /* aka buffer */ char w_tty[MAXSTR]; - struct tty_attr w_t; int w_intermediate; /* char used while parsing ESC-seq */ int w_args[MAXARGS]; int w_NumArgs; @@ -204,6 +204,11 @@ AclBits w_mon_notify; /* whom to tell monitor statis */ #endif }; + +/* definitions for w_type */ +#define TTY_TYPE_PTY 0 +#define TTY_TYPE_PLAIN 1 + /* definitions for wlocktype */ #define WLOCK_OFF 0 /* all who are in w_userbits can write */