--- splitvt-1.6.5.orig/debian/changelog +++ splitvt-1.6.5/debian/changelog @@ -0,0 +1,147 @@ +splitvt (1.6.5-9) unstable; urgency=low + + * Ensure that -upper and -lower have arguemnts. Closes: #319091 + + -- Joey Hess Tue, 19 Jul 2005 17:50:32 -0400 + +splitvt (1.6.5-8) unstable; urgency=low + + * Patch from Andreas Jochens to fix building with gcc 4.0. Closes: #294620 + + -- Joey Hess Fri, 15 Jul 2005 17:38:09 +0300 + +splitvt (1.6.5-7) unstable; urgency=low + + * Many changes to make it build cleanly with -Wall. This included some + missing headers that probably caused it to crash on amd64. + * Disabled vttest, since its read from the console to try to detect a vt100 + terminal was responsible for startup hang on sparc. Closes: #273330 + + -- Joey Hess Wed, 26 Jan 2005 20:32:34 -0500 + +splitvt (1.6.5-6) unstable; urgency=low + + * Rebuilt to update to current policy on /usr/doc links &etc. + + -- Joey Hess Sat, 8 Feb 2003 12:32:25 -0500 + +splitvt (1.6.5-5) unstable; urgency=low + + * Updated to debhelper v4. + + -- Joey Hess Thu, 13 Jun 2002 16:30:04 -0400 + +splitvt (1.6.5-4) unstable; urgency=low + + * Updated patch to not break resizing. + + -- Joey Hess Fri, 5 Oct 2001 20:09:25 -0400 + +splitvt (1.6.5-3) unstable; urgency=low + + * Patch from Robert de Bath that has a doc fix + and also fixes a splitvt segfault when one uses the CSI ? 3 h to got o + 132 column mode. Closes: #113868 (also sent upstream) + + -- Joey Hess Sat, 29 Sep 2001 16:44:25 -0400 + +splitvt (1.6.5-2) unstable; urgency=HIGH + + * New upstream version, with a format string hole fixed, and several + possible buffer overfllows fixed. + - Of those, only (I think) the format string attack and two of the + buffer overflows can affect the debian package. + - Luckily, my last release of the package back in June 2000 made + it only need to be sgid tty. + - Total possible impact: attacker could possibly crack the tty group. + * Goofed up version number because this source is already in the + archives. + + -- Joey Hess Wed, 17 Jan 2001 23:39:09 -0800 + +splitvt (1.6.4-4) unstable; urgency=low + + * Drop setgid first. Very doubtful this effects anything, but it's the + right way to do things. + + -- Joey Hess Thu, 15 Jun 2000 11:37:48 -0700 + +splitvt (1.6.4-3) unstable; urgency=low + + * Modified to use glibc's sys4-ish pty routines; devpts, grantpt, etc. + * Modified to drop sgid bit properly. + * Now I can make it just sgid utmp, rather than suid root, and it + continues to work just as before. Beaujolais! Closes: #65227 + * Removed no-longer-needed glibc stdion/stdout fix patch. + + -- Joey Hess Wed, 14 Jun 2000 14:13:30 -0700 + +splitvt (1.6.4-2) unstable; urgency=low + + * Corrected build-depends, Closes: #65584 + + -- Joey Hess Tue, 13 Jun 2000 11:42:02 -0700 + +splitvt (1.6.4-1) unstable; urgency=high + + * New upstream release with security fix (already applied in the previous + version, I'm just syncing up with upstream). + * Added homepage to copyright file. + * Added some more files to docs. + * Now under the GPL explicitly, some updates to the copyright file. + + -- Joey Hess Sun, 11 Jun 2000 21:42:41 -0700 + +splitvt (1.6.3-7.0slink1) stable; urgency=high + + * Security fix. + + -- Daniel Jacobowitz Sat, 3 Jun 2000 17:56:33 -0400 + +splitvt (1.6.3-7) unstable; urgency=low + + * Build dep. + + -- Joey Hess Sat, 4 Dec 1999 16:21:35 -0800 + +splitvt (1.6.3-6) unstable; urgency=low + + * FHS + + -- Joey Hess Sat, 11 Sep 1999 01:27:49 -0700 + +splitvt (1.6.3-5) unstable; urgency=low + + * vtmouse.c: Don't use stdin/stdout as initializers. Instead, in + event_getc(), set xt_input and xt_output to stdin and stdout if + they are not yet set. This is for the ports to other architectures. + (#29597) + + -- Joey Hess Tue, 17 Nov 1998 15:50:53 -0800 + +splitvt (1.6.3-4) unstable; urgency=low + + * Built with newest debhelper to change how the suid binary is registered. + + -- Joey Hess Tue, 27 Oct 1998 21:59:05 -0800 + +splitvt (1.6.3-3) unstable; urgency=low + + * Hacked in a -f flag, that allows you to resize one of the splitvt + windows down to 1 line tall. This is particularly useful for ticker. + + -- Joey Hess Mon, 7 Sep 1998 19:56:53 -0700 + +splitvt (1.6.3-2) unstable; urgency=low + + * Fixed package description spelling (#18990). + + -- Joey Hess Thu, 5 Mar 1998 17:00:19 -0800 + +splitvt (1.6.3-1) unstable; urgency=low + + * First release. + * Write to author and clarified copyright. + * Change /etc/utmp to /var/run/utmp + + -- Joey Hess Wed, 1 Oct 1997 16:19:01 -0400 --- splitvt-1.6.5.orig/debian/control +++ splitvt-1.6.5/debian/control @@ -0,0 +1,14 @@ +Source: splitvt +Section: utils +Priority: optional +Build-Depends: debhelper (>= 4), libncurses5-dev, dpkg-dev (>= 1.9.0) +Maintainer: Joey Hess +Standards-Version: 3.5.8.0 + +Package: splitvt +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: run two programs in a split screen + A utility to split a vt100 compatible screen into two halves, + upper and lower, and run a different program simultaneously + in each half. --- splitvt-1.6.5.orig/debian/compat +++ splitvt-1.6.5/debian/compat @@ -0,0 +1 @@ +4 --- splitvt-1.6.5.orig/debian/watch +++ splitvt-1.6.5/debian/watch @@ -0,0 +1,2 @@ +version=2 +http://www.devolution.com/~slouken/projects/splitvt/ splitvt-(.*).tar.gz --- splitvt-1.6.5.orig/debian/copyright +++ splitvt-1.6.5/debian/copyright @@ -0,0 +1,45 @@ +This is a Debian prepackaged version of the splitvt utility. + +This package was put together by Joey Hess , using +sources from: + http://www.devolution.com/~slouken/projects/splitvt/ + +The following copyright notices can still be found in the source code: + + /* utmp.c Shareware Copyright by Sam Lantinga 10/6/93 */ + +That is a historical relic, though. The current copyright of splitvt is the +GPL; the text to which can be found in /usr/share/common-licenses/GPL on a +Debian system. + +Before the copyright was expressly changed to the GPL, I wrote and asked the +author about copyright. He replied: + + Date: Wed, 1 Oct 1997 13:39:18 -0700 + From: Sam Lantinga + To: Joey Hess + Cc: slouken@mongoloid.devolution.com + Subject: Re: splitvt copyright + X-Mailer: My Mailer 1.5 + + > I've never heard of no fee shareware before. What restrictions does that + > place on the software? Can it be put on a cd with other software (such as a + > linux distribution) and sold for profit? Can it be used by anyone, for any + > purpose? If so, why don't you just place it under the GPL? + + Consider it GPL'd. I wrote it before I was aware of the GPL, and haven't + done much work on it in quite a while. + + > At this point, I'm not sure if splitvt's copyright will let it go in our + > main distribution, that is sold on cd, or not. Awaiting your clarification.. + + You are more than welcome to put splitvt in the Debian distribution. + It is already in Slackware and S.u.S.E. + + See ya! + -Sam Lantinga (slouken@devolution.com) + + -- + Author of Linux Maelstrom - + http://www.devolution.com/~slouken/Maelstrom/ + -- --- splitvt-1.6.5.orig/debian/rules +++ splitvt-1.6.5/debian/rules @@ -0,0 +1,43 @@ +#!/usr/bin/make -f + +build: build-stamp +build-stamp: + dh_testdir + rm -f Makefile + ./configure + $(MAKE) + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + dh_clean + if [ ! -f Makefile ]; then ./configure ; fi + -$(MAKE) distclean + +binary-indep: build + +binary-arch: build + dh_testdir + dh_testroot + dh_clean + dh_install splitvt usr/bin + dh_installdocs README TODO ANNOUNCE BLURB + dh_installexamples examples/* + dh_installmenu + dh_installcron + dh_installman splitvt.1 + dh_installchangelogs CHANGES + dh_strip + dh_compress + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_fixperms + chgrp utmp debian/splitvt/usr/bin/splitvt + chmod g+s debian/splitvt/usr/bin/splitvt + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary --- splitvt-1.6.5.orig/splitvt.man +++ splitvt-1.6.5/splitvt.man @@ -176,7 +176,7 @@ replace it with entries for the two windows. This allows you to use programs such as 'talk' within the splitvt win- dows. If you do not have write permission to the - /etc/utmp file, you will not be able to modify the utmp + /etc/utmp file, you will not be able to modify the utmp entries. splitvt can be made set-uid root. splitvt will reset its --- splitvt-1.6.5.orig/parserc.c +++ splitvt-1.6.5/parserc.c @@ -1,6 +1,8 @@ /* Routines to parse the ~/.splitvtrc file and set default options */ +#include +#include #include #include #include @@ -213,7 +215,7 @@ char line[BUFSIZ], newline[BUFSIZ*2], *parsed[256]; char *head, *tail, *ptr, *subptr; char *envptr, envbuf[128]; - int i, n, quoted=0; + int i, n; int ignoring=0, ifs=0; /* Get our home directory */ --- splitvt-1.6.5.orig/splitvt.c +++ splitvt-1.6.5/splitvt.c @@ -13,6 +13,9 @@ static char *version= "@(#)Splitvt 1.6.5 1/12/2001 -Sam Lantinga (slouken@devolution.com)\n"; +#include +#include +#include #include #include #include @@ -79,6 +82,8 @@ char *upper_args[MAX_ARGS+1]={NULL}, *lower_args[MAX_ARGS+1]={NULL}; int upper_empty=1, lower_empty=1; +int force_height=0; + void print_usage(argv) char *argv; { @@ -95,13 +100,14 @@ fprintf(stderr, "\t-nologin\t\tOverrides \"set login on\" in startup file\n"); fprintf(stderr, "\t-rcfile file\t\tLoads 'file' at startup instead of ~/.splitvtrc\n"); fprintf(stderr, "\t-norc\t\t\tSuppresses loading your startup file\n"); + fprintf(stderr, "\t-f\t\t\tAllow setting screen size of less than 3 lines\n"); fprintf(stderr, "\t-v\t\t\tPrint out the version number\n"); fprintf(stderr, "\n"); exit(1); } -main(argc, argv) +int main(argc, argv) int argc; char *argv[]; { @@ -111,7 +117,10 @@ int i, len, maxfds, numready; char buffer[BUFSIZ], *ptr; char *xterm_title=NULL; - struct timeval tv, *tvptr; +#ifdef NEED_INET_H + struct timeval tv; +#endif + struct timeval *tvptr; fd_set read_mask; static struct passwd pwdata; /* Our passwd entry */ @@ -151,7 +160,7 @@ splitvtrc(); /* Parse command line options */ - while ( (i=getopt(argc, argv, "n:u:l:r:s:t:vh")) != EOF ) + while ( (i=getopt(argc, argv, "fn:u:l:r:s:t:vh")) != EOF ) { switch (i) { @@ -163,11 +172,19 @@ break; case 'u': if ( strcmp(optarg, "pper") != 0 ) print_usage(argv[0]); + if (optind >= argc) { + fprintf(stderr, "-upper requires an argument\n"); + print_usage(argv[0]); + } tokenize(upper_args, MAX_ARGS+1, argv[optind++], " "); upper_empty=0; break; case 'l': if ( strcmp(optarg, "ower") == 0 ) { + if (optind >= argc) { + fprintf(stderr, "-lower requires an argument\n"); + print_usage(argv[0]); + } tokenize(lower_args, MAX_ARGS+1, argv[optind++], " "); lower_empty=0; @@ -188,7 +205,9 @@ case 'v': printf("%s", version+4); exit(0); break; - case 'h': + case 'f': force_height=1; + break; + case 'h': default: print_usage(argv[0]); break; } @@ -212,7 +231,7 @@ } (void) tty_raw(0); /* Set the tty raw here to prevent lost input */ - if ( (ptr=init_vt100()) != NULL ) + if ( (ptr=init_vt100(1)) != NULL ) { if ( tty_reset(0) < 0 ) (void) tty_sane(0); @@ -473,6 +492,7 @@ } } finish(0); + exit(0); } void reset_bar(sleeptime) @@ -496,6 +516,7 @@ " 'x' Lock the screen", " 'h' Show this help screen", " 'q' Quickly quit splitvt", +" '0-9' Line count for + or -", NULL }; vt_showscreen("Splitvt HELP screen:", help); @@ -700,7 +721,7 @@ tmp_uulines=UU_lines; UU_lines=WU_lines; UU_lines += howfar; /* Positive to go down, negative to go up */ - init_vt100(); /* Reset the windows to the new size */ + init_vt100(0); /* Reset the windows to the new size */ /* Tell the running processes about the size change */ if ( topok ) @@ -722,7 +743,7 @@ signal(sig, winch); - if ( (ptr=init_vt100()) != NULL ) { + if ( (ptr=init_vt100(1)) != NULL ) { fprintf(stderr, "Can't resize window: %s. (exiting)\n", ptr); finish(0); } else --- splitvt-1.6.5.orig/config.c +++ splitvt-1.6.5/config.c @@ -169,7 +169,7 @@ strcat(ldflags, " -lsun"); /* Tell the user what kind of configuration to do */ - if ( (access("/etc/utmp", (R_OK|W_OK)) == 0) && getuid() ) + if ( (access("/var/run/utmp", (R_OK|W_OK)) == 0) && getuid() ) write_utmp=1; else write_utmp=0; @@ -180,14 +180,14 @@ VERBOSE_PRINT( "This program doesn't need to be installed set-uid root.\n"); VERBOSE_PRINT( - "\nThis program will put entries for its windows in /etc/utmp.\n"); + "\nThis program will put entries for its windows in /var/run/utmp.\n"); } else { VERBOSE_PRINT( - "If installed set-uid root, this program will put entries for its windows\nin /etc/utmp.\n"); + "If installed set-uid root, this program will put entries for its windows\nin /var/run/utmp.\n"); } } else if ( write_utmp ) { VERBOSE_PRINT( - "This program will put entries for its windows in /etc/utmp.\n"); + "This program will put entries for its windows in /var/run/utmp.\n"); VERBOSE_PRINT( "\nIf installed set-uid root, this program will change ownership of the\n"); VERBOSE_PRINT( @@ -196,7 +196,7 @@ VERBOSE_PRINT( "If installed set-uid root, this program will put entries for its windows\n"); VERBOSE_PRINT( - "in /etc/utmp, and will also change ownership of the ttys it acquires to the\n"); + "in /var/run/utmp, and will also change ownership of the ttys it acquires to the\n"); VERBOSE_PRINT( "user running this program.\n"); } @@ -225,7 +225,7 @@ } fprintf(makefile, "PTYOPTS = -DPTYCHAR=$(PTYCHAR) -DHEXDIGIT=$(HEXDIGIT)\n"); - sprintf(line, "\nCFLAGS = %s $(PTYOPTS)\nLIBS = %s\n", cflags, ldflags); + sprintf(line, "\nCFLAGS = -Wall %s $(PTYOPTS)\nLIBS = %s\n", cflags, ldflags); fprintf(makefile, "%s", line); fprintf(makefile, "OBJS = splitvt.o misc.o utmp.o vt100.o videomem.o terminal.o vttest.o vtmouse.o \\\n"); fprintf(makefile, " parserc.o lock.o cut-paste.o\n\n"); --- splitvt-1.6.5.orig/cut-paste.c +++ splitvt-1.6.5/cut-paste.c @@ -2,8 +2,12 @@ /* The cut-paste module for splitvt */ #include +#include +#include #include "vt100.h" #include "video.h" +#include "splitvt.h" +#include "terminal.h" #define RIGHT 0x01 #define LEFT 0x02 @@ -41,7 +45,7 @@ } else c ^= (SELECTED<<8); - (*oldattr)=check_attr(c, *oldattr, on); + (*oldattr)=check_attr(c, *oldattr, (int)on); put_video(c, win, x, y); if ( c&0xFF ) @@ -86,7 +90,6 @@ int len; position *mark1, *mark2; { - int selection=0; position startsel, endsel; if ( mark1->x == mark2->x ) @@ -200,9 +203,9 @@ void vt_initsel() { extern char *pathsearch(); /* From misc.c */ - char *display; #ifdef USE_XCB + char *display; /* Use xcb if we have both an X display and the command. */ /* xcb needs to support my hacked '-R' option. */ if ( (display=(char *)getenv("DISPLAY")) && pathsearch("xcb", 1) ) @@ -254,7 +257,7 @@ char *buf; int len; { - int c, state=NORMAL; + int c; position here, cursor, mark1, mark2; window *thiswin; @@ -311,7 +314,7 @@ default: break; } } - return; /* Hopefully, we never reach here */ + return NULL; /* Hopefully, we never reach here */ } --- splitvt-1.6.5.orig/vt100.c +++ splitvt-1.6.5/vt100.c @@ -8,6 +8,9 @@ Many thanks to Matt Ostanik who wrote the ANSI Handbook. */ +#include +#include +#include #include #ifdef HAVE_TERMIO_H #include /* Used only for TIOCGWINSZ */ @@ -20,6 +23,7 @@ #include "vt100.h" #include "video.h" #include "terminal.h" +#include "splitvt.h" #define SEP_CHAR ' ' /* Separator bar character */ @@ -135,7 +139,7 @@ unsigned char on=NORMAL; vt_resetattr(); - (void) check_attr(0, win->textattr, &on); + (void) check_attr(0, win->textattr, (int)&on); } /* Process the ^[[X;Xm escape. Made into a separate routine to support @@ -683,10 +687,9 @@ break; case 3: /* 132 char/row */ if ( physical.cols != 132 ) { - upper.cols=132; - lower.cols=132; physical.cols=132; vt_widemode(1); + init_vt100(0); } break; case 4: /* Set jump scroll */ @@ -726,11 +729,9 @@ break; case 3: /* 80 char/row */ if ( physical.cols == 132 ) { - vt_rows_cols(terminal_type, - NULL, &physical.cols); - upper.cols=physical.cols; - lower.cols=physical.cols; + physical.cols = 80; vt_widemode(0); + init_vt100(0); } break; case 4: /* Set smooth scroll */ @@ -843,7 +844,8 @@ static int setup_vt100 = 0; /* Have we initialized the vt100 system? */ -char *init_vt100() +char *init_vt100(reread_tsize) +int reread_tsize; { #ifdef TIOCGWINSZ struct /* winsize */ { @@ -853,7 +855,7 @@ unsigned short ws_ypixel; /* vertical size - not used */ } mywinz; #endif - int i, **videomem, oldrows, newrows, newcols; + int i, **videomem, oldrows = 0, newrows, newcols; position newpos; char *ptr, *errmesg; @@ -869,18 +871,22 @@ vt_initsel(); } + if (reread_tsize) + { #ifdef TIOCGWINSZ - if ( ioctl(0, TIOCGWINSZ, &mywinz) == 0 ) { - if ( mywinz.ws_row ) - physical.rows=mywinz.ws_row; - if ( mywinz.ws_col ) - physical.cols=mywinz.ws_col; - } + if ( ioctl(0, TIOCGWINSZ, &mywinz) == 0 ) { + if ( mywinz.ws_row ) + physical.rows=mywinz.ws_row; + if ( mywinz.ws_col ) + physical.cols=mywinz.ws_col; + } #endif - if ( (ptr=(char *)getenv("LINES")) != NULL ) - physical.rows=atoi(ptr); - if ( (ptr=(char *)getenv("COLUMNS")) != NULL ) - physical.cols=atoi(ptr); + + if ( (ptr=(char *)getenv("LINES")) != NULL ) + physical.rows=atoi(ptr); + if ( (ptr=(char *)getenv("COLUMNS")) != NULL ) + physical.cols=atoi(ptr); + } /* Now set defaults if we can't find the window size */ if ( ! physical.rows ) physical.rows=24; @@ -892,19 +898,21 @@ if ( physical.rows < 7 ) return("Screen is not tall enough to split."); - /* If physical.cols has been set to 132, assume we are on a - vt100 wide terminal, and set 132 column mode. Note that - setting COLUMNS in the environment will override termcap */ - if ( physical.cols == 132 ) - vt_widemode(1); + if ( ! setup_vt100 ) { + /* If physical.cols has been set to 132, assume we are on a + vt100 wide terminal, and set 132 column mode. Note that + setting COLUMNS in the environment will override termcap */ + if ( physical.cols == 132 ) + vt_widemode(1); + } /* Set the exportable variables */ if ( UU_lines ) { /* Check the user set # of lines */ - if ( UU_lines > (physical.rows-1-3) ) - LU_lines=(physical.rows-1-3); - else if ( UU_lines < 3 ) - LU_lines=3; + if ( UU_lines > (physical.rows-1-3+(2*force_height)) ) + LU_lines=(physical.rows-1-3+(2*force_height)); + else if ( UU_lines < 3 - (2*force_height)) + LU_lines=3 - (2*force_height); else LU_lines=UU_lines; --- splitvt-1.6.5.orig/splitvt.h +++ splitvt-1.6.5/splitvt.h @@ -34,3 +34,25 @@ /* Functions exported from splitvt.c */ extern void reset_bar(); + +/* If set, allow resizing to less than 3 lines */ +extern int force_height; + +void tokenize(char *array[], int size, char *line, char *tokens); +void d_copy(register char *src, register char *dst, register int len); +int tty_getmode(int fd); +int tty_raw(int fd); +int tty_reset(int fd); +int tty_sane(int fd); +int remove_me(void); +int pty_open(char *argv[], int *childpid, int win); +int addutmp(char *user, int uid, char *tty); +char *vt_setsel(char *buf, int len, int startx, int endx, int starty, int endy); +int delutmp(char *user, char *tty); +int replace_me(void); +void pty_setwin(int fd, int win); +int check_attr(int pixel, int lastattr, int currattr); +void d_zero(register char *dst, register int len); +void vt_initsel(void); +int vttest(void); +int safe_pclose(FILE *pipefp); --- splitvt-1.6.5.orig/splitvt.1 +++ splitvt-1.6.5/splitvt.1 @@ -47,6 +47,11 @@ Suppresses loading your ~/.splitvtrc .TP .TB +.I -f +Allow setting the height of either the top or the bottom window to less than +3 lines. +.TP +.TB .I -v Print out the version number of splitvt .LP @@ -173,7 +178,7 @@ splitvt will attempt to erase the current utmp entry, and replace it with entries for the two windows. This allows you to use programs such as 'talk' within the splitvt windows. If you do not have write -permission to the /etc/utmp file, you will not be able to modify the +permission to the /var/run/utmp file, you will not be able to modify the utmp entries. splitvt can be made set-uid root. splitvt will reset its user id to --- splitvt-1.6.5.orig/splitvt-1.6.4.lsm +++ splitvt-1.6.5/splitvt-1.6.4.lsm @@ -0,0 +1,15 @@ +Begin3 +Title: Splitvt - a split windows utility +Version: 1.6.4 +Entered-date: 03JUN2000 +Description: A utility to split a vt100 compatible screen into two halfs, + upper and lower, and run a different program simultaneously + in each half. +Keywords: screen vt100 emulator +Author: slouken@devolution.com (Sam Lantinga) +Maintained-by: slouken@devolution.com (Sam Lantinga) +Primary-site: http://www.devolution.com/~slouken/projects/splitvt/ +Alternate-site: sunsite.unc.edu /pub/Linux/utils/terminal +Platform: UNIX +Copying-policy: GPL +End --- splitvt-1.6.5.orig/utmp.c +++ splitvt-1.6.5/utmp.c @@ -1,21 +1,27 @@ /* utmp.c Shareware Copyright by Sam Lantinga 10/6/93 */ +#include #include #include #include #include #include +#include +#include +#include "splitvt.h" #ifdef DEBUG_UTMP #undef UTMP_FILE #define UTMP_FILE "/tmp/utmp" #else #ifndef UTMP_FILE -#define UTMP_FILE "/etc/utmp" +#define UTMP_FILE "/var/run/utmp" #endif /* UTMP_FILE */ #endif /* DEBUG_UTMP */ +int get_utmp(char *tty, struct utmp *save); +int set_utmp(char *tty, struct utmp *save); /* Remove us from the utmp file, saving our entry to replace later */ @@ -94,7 +100,7 @@ if (strncmp(ttyptr, ut.ut_line, sizeof(ut.ut_line)) == 0) { /* Break out; we've found our entry! */ if ( save ) - d_copy((char *)&ut, save, sizeof(ut)); + d_copy((char *)&ut, (char *)&save, sizeof(ut)); close(fd); return(0); } @@ -158,7 +164,9 @@ int uid; /* The uid corresponding to user */ char *tty; /* /dev/ttyxx */ { +#if !defined(SOLARIS) && !defined(IRIX) && !defined(__GLIBC__) struct stat sb; +#endif struct utmp ut; char *ttyptr; @@ -195,12 +203,13 @@ #endif (void) time(&ut.ut_time); -#if !defined(SOLARIS) && !defined(IRIX) - /* Solaris and Irix machines do this automatically */ +#if !defined(SOLARIS) && !defined(IRIX) && !defined(__GLIBC__) + /* Solaris and Irix and GLIBC machines do this automatically */ /* Change the ownership and mode of the tty */ if ( stat(tty, &sb) == 0 ) { (void) chmod(tty, 0620); /* crw--w---- */ (void) chown(tty, uid, sb.st_gid); + } #endif return(set_utmp(tty, &ut)); --- splitvt-1.6.5.orig/lock.c +++ splitvt-1.6.5/lock.c @@ -1,9 +1,13 @@ /* The screen locking module for splitvt */ +#include +#include +#include #include #include #include "vt100.h" +#include "splitvt.h" #define UNLOCKED 0 #define ENTERED1 1 --- splitvt-1.6.5.orig/vttest.c +++ splitvt-1.6.5/vttest.c @@ -12,6 +12,7 @@ -Sam Lantinga (slouken@toadflax.cs.ucdavis.edu) */ +#include #include #include #include @@ -48,9 +49,12 @@ int vttest() { char buff[512]; - int x=0, w, rc=0, fd; + int x=0, rc=0, fd; struct termio ttold, ttraw; + /* Disabled since at least on sparc it causes a hang. */ + return 1; + /* Set the terminal in a raw mode */ if ( (fd=open("/dev/tty", O_RDWR, 0666)) < 0 ) return(0); --- splitvt-1.6.5.orig/vtmouse.c +++ splitvt-1.6.5/vtmouse.c @@ -7,8 +7,11 @@ #define SPLITVT_SOURCE +#include +#include #include #include "vtmouse.h" +#include "splitvt.h" extern FILE *safe_popen(); /* From misc.c */ --- splitvt-1.6.5.orig/videomem.c +++ splitvt-1.6.5/videomem.c @@ -1,6 +1,7 @@ /* This file holds the functions for manipulating video memory */ +#include #include #include "video.h" #include "terminal.h" @@ -113,7 +114,7 @@ int x1, x2; int y1, y2; { - int l=0, i, j, eol, eos; + int l=0, i, j, eol, eos=0; --maxlen; /* Account for trailing null */ for ( i=(x1-1); (i +#include #include +#include +#include "splitvt.h" #include "video.h" #include "terminal.h" @@ -125,7 +128,7 @@ } return(NULL); } -void outc(c) int c; { putchar(c); } +int outc(c) int c; { return putchar(c); } void vt_rows_cols(termtype, rows, cols) char *termtype; --- splitvt-1.6.5.orig/misc.c +++ splitvt-1.6.5/misc.c @@ -1,10 +1,17 @@ /* Miscellaneous system dependent routines for splitsh */ +#define _GNU_SOURCE /* for getpt and other gnu extensions to libc */ + #include +#include +#include +#include #include #include #include #include +#include +#include #ifdef HAVE_TERMIO_H @@ -24,6 +31,8 @@ /*#define STTY_HACK*/ #endif +int tty_reset(int fd); + /* * Initialize a pty, fork a command running under it, and then * return the master file descriptor @@ -44,7 +53,10 @@ int get_master_pty(), get_slave_pty(); char *get_ttyname(), *myputenv(); - char LINES[12], COLUMNS[12], SPLITVT[24]; +#ifndef TIOCGWINSZ + char LINES[12], COLUMNS[12]; +#endif + char SPLITVT[24]; int returnfd, slave_fd; /* Get the master pty file descriptor */ @@ -106,6 +118,8 @@ /* "touch" the tty so 'w' reports proper idle times */ (void) utime(get_ttyname(), NULL); + /* Set our gid to our real gid if necessary */ + (void) setgid(getgid()); /* Set our uid to our real uid if necessary */ (void) setuid(getuid()); @@ -182,12 +196,18 @@ #else /* ! IRIX */ -#ifdef SOLARIS /* System V.4 pty routines from W. Richard Stevens */ +#if defined(SOLARIS) || defined(__GLIBC__) +/* System V.4 pty routines from W. Richard Stevens */ +/* GLIBC is very similar, so this will handle it too. */ + +#ifdef SOLARIS #include #define DEV_CLONE "/dev/ptmx" +#endif + extern char *ptsname(); int get_master_pty() @@ -195,9 +215,14 @@ char *ttyptr; +#ifdef SOLARIS if ( (master_fd=open(DEV_CLONE, O_RDWR)) < 0 ) return(-1); - +#else /* GLIBC */ + if ( (master_fd=getpt()) == -1 ) + return (-1); +#endif + if ( grantpt(master_fd) < 0 ) /* grant access to slave */ { close(master_fd); @@ -242,6 +267,7 @@ return(-1); } +#ifdef SOLARIS if ( ioctl(slave_fd, I_PUSH, "ptem") < 0 ) { close(master_fd); @@ -262,7 +288,8 @@ close(slave_fd); return(-1); } - +#endif + return(slave_fd); } @@ -393,8 +420,10 @@ void dropctty() { +#ifndef CIBAUD int fd; - +#endif + #if defined(_POSIX_SOURCE) || defined(SOLARIS) || \ defined(__386BSD__) || defined(__FreeBSD__) setsid(); /* The POSIX solution is simple. :) */ @@ -708,7 +737,6 @@ extern char **environ; /* The process environment strings */ char *newptr, **envptr; - char *tmptr, temp[BUFSIZ]; int distance, n=0; for ( distance=0; ((*(string+distance)) && @@ -759,7 +787,7 @@ char *line; char *tokens; { - char *head, *ptr; + char *head; int i=0; for ( head=line; *line && i < size-2; ) { @@ -847,7 +875,7 @@ { char *argv[4]; int pipe_fds[2]; - int rw, child; + int rw; if ( strcmp(type, "r") == 0 ) rw=0; /* READ access for parent */