debian/0000755000000000000000000000000011771476713007204 5ustar debian/changelog0000644000000000000000000002012711771476621011056 0ustar splitvt (1.6.6-11) unstable; urgency=low * debian/control: - Update Maintainer field with Debian email. - Bump to Standards-Version 3.9.3. No changes required. * debian/copyright: switch to machine-readable format. -- Mònica Ramírez Arceda Sun, 24 Jun 2012 03:57:35 +0200 splitvt (1.6.6-10) unstable; urgency=low * Enable security hardening build flags. (Closes: #656027) - debian/contol: add hardening-wrapper as a build dependency. - debian/rules: enable hardening build flags. * debian/patches/ncurses.multiarch.patch: Update to ncurses multiarch. * Bump to Standards-Version 3.9.2. No changes required. -- Mònica Ramírez Arceda Tue, 14 Feb 2012 10:37:25 +0100 splitvt (1.6.6-9) unstable; urgency=low * Stop using utmp and migrate to wtmp (migrate.splitvt.to.wtmp.patch). Thanks to Mats Erik Andersson. (Closes: #619372) * Implement support for Termios (support.termios.splitvt.patch). Thanks to Mats Erik Andersson. * debian/source/local-options: Unapply patches after build. -- Mònica Ramírez Arceda Mon, 21 Mar 2011 12:06:11 +0100 splitvt (1.6.6-8) unstable; urgency=low * Adopt the package. (Closes: #489450) * Switch to quilt format: add old.changes.patch. * Tidy up debian/copyright: organize it in sections, add copyright notice, add GPL version and add myself as a Debian mantainer. * Manpage: - Change - by \- to use minus sign instead of hyphen in manpage (fix.man.minus.sign.patch). - Add .TB macro (fix.man.macro.not.defined.patch). * Override lintian warning (setgid-binary): splitvt needs write access to /var/run/utmp file. * Add debian/install, debian/docs, debian/examples and debian/splitvt.manpages in order to minimize debian/rules. * Update debian/rules to use overrides of dh_*. * Delete Homepage field in debian/control and debian/watch: upstream site doesn't exist any more. * Bump to Standards-Version 3.9.1. No changes required. * Add Vcs-Git, Vcs-Browser fields in debian/control. -- Mònica Ramírez Arceda Sun, 13 Feb 2011 00:21:26 +0100 splitvt (1.6.6-7) unstable; urgency=medium * QA upload. * Fix bashisms (Closes: #489663) * Bump standard version -- Julien Danjou Sun, 03 Aug 2008 14:19:50 +0200 splitvt (1.6.6-6) unstable; urgency=low * Orphaned the package. -- Joey Hess Sat, 05 Jul 2008 17:32:15 -0400 splitvt (1.6.6-5) unstable; urgency=low * debhelper v7; rules file minimisation * Looks like I had forgotten to call dh_md5sums before. -- Joey Hess Wed, 14 May 2008 19:46:03 -0400 splitvt (1.6.6-4) unstable; urgency=low * Add homepage field. * Fix security hole in safe_popen; it neglected to setgid. -- Joey Hess Tue, 08 Jan 2008 12:57:27 -0500 splitvt (1.6.6-3) unstable; urgency=low * Support nostrip builds. Closes: #438047 -- Joey Hess Wed, 15 Aug 2007 13:37:34 -0400 splitvt (1.6.6-2) unstable; urgency=low * Hack config.c to not link with libnet if it's on the system. Linux's libnet is not used by splitvt. * Ditto libnsl. -- Joey Hess Thu, 19 Jul 2007 14:09:33 -0400 splitvt (1.6.6-1) unstable; urgency=low * It's been 5 years, so right on sechedule, new upstream release. -- Joey Hess Thu, 12 Apr 2007 17:38:41 -0400 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 debian/install0000644000000000000000000000002011525752575010565 0ustar splitvt usr/bin debian/examples0000644000000000000000000000001311525752575010737 0ustar examples/* debian/source/0000755000000000000000000000000011541357313010471 5ustar debian/source/format0000644000000000000000000000001411525564140011677 0ustar 3.0 (quilt) debian/compat0000644000000000000000000000000211715056344010372 0ustar 7 debian/splitvt.manpages0000644000000000000000000000001211525752575012417 0ustar splitvt.1 debian/rules0000755000000000000000000000041111716426122010244 0ustar #!/usr/bin/make -f export DEB_BUILD_HARDENING=1 %: dh $@ override_dh_auto_configure: rm -f Makefile ./configure override_dh_auto_install: override_dh_fixperms: dh_fixperms chgrp utmp debian/splitvt/usr/bin/splitvt chmod g+s debian/splitvt/usr/bin/splitvt debian/control0000644000000000000000000000114211771473224010577 0ustar Source: splitvt Section: utils Priority: optional Build-Depends: debhelper (>= 7.0.50), libncurses5-dev, dpkg-dev (>= 1.9.0), hardening-wrapper Maintainer: Mònica Ramírez Arceda Standards-Version: 3.9.3 Vcs-Git: git://git.debian.org/collab-maint/splitvt.git Vcs-Browser: http://git.debian.org/?p=collab-maint/splitvt.git 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. debian/copyright0000644000000000000000000000553411771474753011150 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: splitvt Upstream-Contact: Sam Lantinga Source: http://www.devolution.com/~slouken/projects/splitvt/ Files: * Copyright: Copyright (C) 1993 Sam Lantinga License: GPL-2 Comment: 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-2; the text to which can be found in /usr/share/common-licenses/GPL-2 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/ -- Files: debian/* Copyright: Copyright (C) 1997 Joey Hess Copyright (C) 2011 Mònica Ramírez Arceda License: GPL-2 License: GPL-2 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. debian/patches/0000755000000000000000000000000011716435113010617 5ustar debian/patches/series0000644000000000000000000000023711716435113012036 0ustar old.changes.patch fix.man.minus.sign.patch fix.man.macro.not.defined.patch support.termios.splitvt.patch migrate.splitvt.to.wtmp.patch multiarch.ncurses.patch debian/patches/multiarch.ncurses.patch0000644000000000000000000000236011716435071015315 0ustar Description: Looks for libtermcap.a in the multiarch directory. Author: Mònica Ramírez Arceda Last-Update: 2012-02-14 --- a/config.c +++ b/config.c @@ -28,6 +28,24 @@ return(0); } +void finddeblibmultiarch(deblibmultiarch) +char *deblibmultiarch; +{ + FILE *pipe_fp; + char debhostmultiarch[BUFSIZ]; + // Get host arch (i386-linux-gnu, amd64-linux-gnu,...) + if (( pipe_fp = popen("dpkg-architecture -qDEB_HOST_MULTIARCH", "r")) == NULL){ + perror("popen error: Can't finish creating Makefile"); + printf("Configuration aborted. Exiting.\n"); + exit(2); + } + fscanf(pipe_fp,"%s",debhostmultiarch); + pclose(pipe_fp); + // Build library's path + strcat(deblibmultiarch,"/usr/lib/"); + strcat(deblibmultiarch, debhostmultiarch); + strcat(deblibmultiarch, "/"); +} main(argc, argv) int argc; @@ -111,7 +129,9 @@ #endif /* linux */ /* Check for the termcap library */ - if ( exists("/usr/lib", "libtermcap.a") ) { + char deblibmultiarch[BUFSIZ]; + finddeblibmultiarch(deblibmultiarch); + if ( exists(deblibmultiarch, "libtermcap.a") ) { strcat(cflags, " -DTERMCAP"); strcat(ldflags, " -ltermcap"); VERBOSE_PRINT("\tUsing the termcap library for terminal support.\n"); debian/patches/fix.man.macro.not.defined.patch0000644000000000000000000000105511525752663016507 0ustar Description: Add .TB macro to manpage. This macro is extracted from tmac/man.ultrix present in groff upstream source. See http://www.gnu.org/software/groff/manual/html_node/Optional-man-extensions.html#Optional-man-extensions Author: Mònica Ramírez Arceda Last-Update: 2011-02-13 --- a/splitvt.1 +++ b/splitvt.1 @@ -1,3 +1,15 @@ +.if n .ig +.de HB +.ie \\n[.$] .ft HB +.el \f[HB]\\$*\fP +.. +.if t .ig +.de HB +.ie \\n[.$] .ul 999 +.el .ul +\\$* +.. +.als TB HB .TH SPLITVT 1 "1/5/95" "SPLITVT" "NONESSENTIAL UTILITIES" .SH NAME debian/patches/support.termios.splitvt.patch0000644000000000000000000002367711542617377016573 0ustar Description: Implement support for Termios. Adding termios handling is a straight path into support for GNU/kFreeBSD. Fairly standard. . The non-standard configuration tool is convinced to recognise the presence of "", thus defining HAVE_TERMIOS_H. Conditioning on __GLIBC__ avoids falling into the ioctl-compat trap! . On 64-bit systems, using time compatibility mode, the Utmp code needs some fine tuning. Author: Mats Erik Andersson Forwarded: no Last-Update: 2011-03-21 diff -Naurp splitvt-1.6.6.debian/config.c splitvt-1.6.6/config.c --- splitvt-1.6.6.debian/config.c 2011-03-21 17:31:37.000000000 +0100 +++ splitvt-1.6.6/config.c 2011-03-21 19:04:06.000000000 +0100 @@ -93,7 +93,12 @@ char *argv[]; VERBOSE_PRINT("\tI see you are running Solaris.\n"); } else +#if defined(__GLIBC__) + VERBOSE_PRINT("\tA bold user of GNU/kFreeBSD or GNU/Hurd.\n"); + strcat(cflags, " -O2"); +#else /* !__GLIBC__ */ strcat(cflags, " -O"); +#endif /* Check for IRIX */ if ( grep("/usr/include", "unistd.h", "_getpty") ) @@ -118,8 +123,11 @@ char *argv[]; VERBOSE_PRINT("\tYour utmp file uses the host field.\n"); } - /* Check for termio.h */ - if ( exists(INCLUDE, "termio.h") ) { + /* Check for termio[s].h */ + if ( exists(INCLUDE, "termios.h") ) { + strcat(cflags, " -DHAVE_TERMIOS_H"); + VERBOSE_PRINT("\tI will use termios tty structures.\n"); + } else if ( exists(INCLUDE, "termio.h") ) { strcat(cflags, " -DHAVE_TERMIO_H"); VERBOSE_PRINT("\tI will use termio tty structures.\n"); } else @@ -136,12 +144,14 @@ char *argv[]; VERBOSE_PRINT("\tI see you have BSD tty support.\n"); } +#if !__GLIBC__ /* False positive for GNU/kFreeBSD */ /* Check for ioctl compatibility. (FreeBSD) */ if ( exists(INCLUDE, "sys/ioctl_compat.h") ) { strcat(cflags, " -DNEED_COMPAT_H"); VERBOSE_PRINT( "\tI will use your ioctl compatibility header.\n"); } +#endif /* Check for BSD socket library header (AT&T) */ if ( exists(INCLUDE, "sys/inet.h") ) { diff -Naurp splitvt-1.6.6.debian/misc.c splitvt-1.6.6/misc.c --- splitvt-1.6.6.debian/misc.c 2011-03-21 17:31:37.000000000 +0100 +++ splitvt-1.6.6/misc.c 2011-03-21 21:50:15.000000000 +0100 @@ -17,10 +17,16 @@ #ifdef HAVE_TERMIO_H -#include -#else -#include -#endif /* HAVE_TERMIO_H */ +# include +#elif defined(HAVE_TERMIOS_H) +# include +# include +# ifndef termio +# define termio termios +# endif /* !termio */ +#else /* !HAVE_TERMIO_H && !HAVE_TERMIOS_H */ +# include +#endif #ifdef HAVE_BSDTTY_H #include @@ -33,6 +39,10 @@ /*#define STTY_HACK*/ #endif +#ifndef OLCUC +# define OLCUC 0 /* Missing in FreeBSD, GNU/kFreeBSD */ +#endif /* !OLCUC */ + int tty_reset(int fd); /* @@ -454,7 +464,7 @@ void dropctty() } -#ifdef HAVE_TERMIO_H +#if defined(HAVE_TERMIO_H) || defined(HAVE_TERMIOS_H) /* Get the modes of the controlling tty and save them. Saves ttymodes in tty_mode and returns -1 if ioctl fails. */ @@ -475,7 +485,11 @@ int fd; fprintf(stderr, "Getting tty modes for tty_mode.\r\n"); #endif +#ifdef HAVE_TERMIOS_H + if (tcgetattr(fd, &tty_mode) < 0) +#else /* HAVE_TERMIO_H */ if (ioctl(fd, TCGETA, (char *) &tty_mode) < 0) +#endif { #ifdef DEBUG perror("tty_getmode(): ioctl error"); @@ -499,7 +513,11 @@ int fd; if ( ! tty_init ) { +#ifdef HAVE_TERMIOS_H + if (tcgetattr(fd, &tty_mode) < 0) +#else /* HAVE_TERMIO_H */ if (ioctl(fd, TCGETA, (char *) &tty_mode) < 0) +#endif return(-1); } @@ -518,8 +536,12 @@ int fd; temp_mode.c_cc[VINTR]=('C'^64); temp_mode.c_cc[VEOF]=('D'^64); - /* TCSETAW is important for letting tty input drain. */ + /* TCSADRAIN/TCSETAW is important for letting tty input drain. */ +#ifdef HAVE_TERMIOS_H + if ( tcsetattr(fd, TCSADRAIN, &temp_mode) < 0 ) +#else /* HAVE_TERMIO_H */ if ( ioctl(fd, TCSETAW, (char *)&temp_mode) < 0 ) +#endif { #ifdef DEBUG perror("Can't set tty modes"); @@ -544,7 +566,11 @@ int fd; /* of tty device */ if ( ! isatty(fd) ) return(0); +#ifdef HAVE_TERMIOS_H + if ( tcgetattr(fd, &temp_mode) < 0 ) +#else /* HAVE_TERMIO_H */ if ( ioctl(fd, TCGETA, (char *)&temp_mode) < 0 ) +#endif return(-1); #ifdef SEVEN_BIT @@ -558,8 +584,12 @@ int fd; /* of tty device */ temp_mode.c_cc[VMIN]=1; /* 1 or more chars satisfy read */ temp_mode.c_cc[VTIME]=0; /* 10'ths of seconds between chars */ - /* TCSETAW is important for letting tty input drain. */ + /* TCSADRAIN/TCSETAW is important for letting tty input drain. */ +#ifdef HAVE_TERMIOS_H + if (tcsetattr(fd, TCSADRAIN, &temp_mode) < 0) +#else /* HAVE_TERMIO_H */ if (ioctl(fd, TCSETAW, (char *) &temp_mode) < 0) +#endif return(-1); return(0); } @@ -577,13 +607,17 @@ int fd; if ( ! isatty(fd) ) return(0); - /* TCSETAW is important for letting tty input drain. */ + /* TCSADRAIN/TCSETAW is important for letting tty input drain. */ +#ifdef HAVE_TERMIOS_H + if (tcsetattr(fd, TCSADRAIN, &tty_mode) < 0) +#else /* HAVE_TERMIO_H */ if (ioctl(fd, TCSETAW, (char *) &tty_mode) < 0) +#endif return(-1); return(0); } -#else /* no /usr/include/termio.h */ +#else /* no /usr/include/termio{,s}.h */ #ifdef NEED_COMPAT_H /* FreeBSD needs this */ #include #endif /* NEED_COMPAT_H */ diff -Naurp splitvt-1.6.6.debian/utmp.c splitvt-1.6.6/utmp.c --- splitvt-1.6.6.debian/utmp.c 2011-03-21 17:31:37.000000000 +0100 +++ splitvt-1.6.6/utmp.c 2011-03-21 21:56:08.000000000 +0100 @@ -201,7 +201,18 @@ char *tty; /* /dev/ttyxx */ ut.ut_host[sizeof(ut.ut_host)-1]='\0'; } #endif +#if __WORDSIZE == 64 && __WORDSIZE_COMPAT32 + /* 'time_t' is 64-bit, 'ut.ut_time' is 32-bit. */ + { + time_t now; + + (void) time(&now); + ut.ut_time = now & 0xffffffff; /* Discard upper bits. */ + } +#else /* Equal size time representation. */ (void) time(&ut.ut_time); +#endif + #if !defined(SOLARIS) && !defined(IRIX) && !defined(__GLIBC__) /* Solaris and Irix and GLIBC machines do this automatically */ @@ -237,7 +248,17 @@ char *tty; /* /dev/ttyxx */ #if defined(HAVE_UTHOST) ut.ut_host[0]='\0'; #endif +#if __WORDSIZE == 64 && __WORDSIZE_COMPAT32 + /* 'time_t' is 64-bit, 'ut.ut_time' is 32-bit. */ + { + time_t now; + + (void) time(&now); + ut.ut_time = now & 0xffffffff; /* Discard bits. */ + } +#else /* Equal size time representation. */ (void) time(&ut.ut_time); +#endif retval=set_utmp(tty, &ut); } diff -Naurp splitvt-1.6.6.debian/vt100.c splitvt-1.6.6/vt100.c --- splitvt-1.6.6.debian/vt100.c 2011-03-21 17:31:37.000000000 +0100 +++ splitvt-1.6.6/vt100.c 2011-03-21 21:44:18.000000000 +0100 @@ -14,7 +14,9 @@ #include #ifdef HAVE_TERMIO_H #include /* Used only for TIOCGWINSZ */ -#else +#elif defined(HAVE_TERMIOS_H) +#include +#else /* !HAVE_TERMIO_H && !HAVE_TERMIOS_H */ #include /* Used only for TIOCGWINSZ */ #endif #include @@ -141,7 +143,7 @@ window *win; unsigned char on=NORMAL; vt_resetattr(); - (void) check_attr(0, win->textattr, (int)&on); + (void) check_attr(0, win->textattr, (int)on); } /* Process the ^[[X;Xm escape. Made into a separate routine to support diff -Naurp splitvt-1.6.6.debian/vttest.c splitvt-1.6.6/vttest.c --- splitvt-1.6.6.debian/vttest.c 2011-03-21 17:31:37.000000000 +0100 +++ splitvt-1.6.6/vttest.c 2011-03-21 21:47:43.000000000 +0100 @@ -18,7 +18,13 @@ #include #ifdef HAVE_TERMIO_H #include -#else +#elif defined HAVE_TERMIOS_H +# include +# include +# ifndef termio +# define termio termios +# endif +#else /* !HAVE_TERMIO_H && !HAVE_TERMIOS_H */ #include #include #include @@ -35,13 +41,17 @@ #include #endif /* HAVE_BSDTTY_H */ +#ifndef OLCUC +# define OLCUC 0 /* Missing inf FreeBSD and GNU/kFreeBSD. */ +#endif + #ifdef MAIN int main() { if ( vttest() ) printf("vt100\n"); } #endif /* Register that we are alarmed. (called by SIG_ALRM on BSD) */ static int alarmed; -#ifndef HAVE_TERMIO_H +#if !defined(HAVE_TERMIO_H) && !defined(HAVE_TERMIOS_H) static jmp_buf alarm_buf; static void alrm_trap() { alarmed=1; longjmp(alarm_buf, 1); } #endif /* No termio.h */ @@ -59,11 +69,17 @@ int vttest() if ( (fd=open("/dev/tty", O_RDWR, 0666)) < 0 ) return(0); +#ifdef HAVE_TERMIOS_H + if ( tcgetattr(fd, &ttold) < 0 ) + return(0); + (void) tcgetattr(fd, &ttraw); +#else /* !HAVE_TERMIOS_H */ if ( ioctl(fd, TCGETA, (char *)&ttold) < 0 ) return(0); (void) ioctl(fd, TCGETA, (char *)&ttraw); +#endif -#ifdef HAVE_TERMIO_H +#if defined(HAVE_TERMIO_H) || defined(HAVE_TERMIOS_H) #ifdef SEVEN_BIT ttraw.c_iflag=(IGNBRK | ISTRIP); /* turn off all input control */ #else @@ -74,17 +90,22 @@ int vttest() ttraw.c_lflag = 0; ttraw.c_cc[VMIN]=0; /* 1 or more chars satisfy read */ ttraw.c_cc[VTIME]=10; /* 10'ths of seconds between chars */ -#else +#else /* !HAVE_TERMIO_H && !HAVE_TERMIOS_H */ ttraw.sg_flags |= RAW; /* turn RAW mode on */ ttraw.sg_flags &= ~ECHO; /* turn ECHO off */ #endif /* HAVE_TERMIO_H */ +#ifdef HAVE_TERMIOS_H + if (tcsetattr(fd, TCSADRAIN, &ttraw) < 0) +#else /* !HAVE_TERMIOS_H */ if (ioctl(fd, TCSETAW, (char *)&ttraw) < 0) +#endif return(0); write(fd,"\033[c", 3); /* Vt100 test: ESC [ c */ -#ifndef HAVE_TERMIO_H /* We need to set an alarm */ +#if !defined(HAVE_TERMIO_H) && !defined(HAVE_TERMIOS_H) + /* We need to set an alarm */ signal(SIGALRM, alrm_trap); alarmed=0; alarm(1); @@ -98,11 +119,15 @@ int vttest() if ( buff[0] == '\033' ) /* An escape sequence? :) */ rc=1; -#ifndef HAVE_TERMIO_H +#if !defined(HAVE_TERMIO_H) && !defined(HAVE_TERMIOS_H) alarm(0); signal(SIGALRM, SIG_DFL); #endif +#if HAVE_TERMIOS_H + (void) tcsetattr(fd, TCSADRAIN, &ttold); +#else /* !HAVE_TERMIOS_H */ (void) ioctl(fd, TCSETAW, (char *)&ttold); +#endif (void) close(fd); #ifdef not_defined /* Print out the response for debugging */ debian/patches/old.changes.patch0000644000000000000000000005454311542616646014051 0ustar Description: Patch qith all changes done to upstream in version 1.6.6-7 and older versions. Author: Julien Danjou (version 1.6.6-7) Joey Hess (older versions) Last-Update: 2011-02-13 --- splitvt-1.6.6.orig/misc.c +++ splitvt-1.6.6/misc.c @@ -1,12 +1,19 @@ /* 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 +#include +#include #ifdef HAVE_TERMIO_H @@ -26,6 +33,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 @@ -46,7 +55,10 @@ int win; /* 0 for upper, 1 for lower */ 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 */ @@ -108,8 +120,16 @@ int win; /* 0 for upper, 1 for lower */ /* "touch" the tty so 'w' reports proper idle times */ (void) utime(get_ttyname(), NULL); + /* Set our gid to our real gid if necessary */ + if (setgid(getgid()) != 0) { + perror("setgid"); + exit(1); + } /* Set our uid to our real uid if necessary */ - (void) setuid(getuid()); + if (setuid(getuid()) != 0) { + perror("setuid"); + exit(1); + } /* Run the requested program, with possible leading dash. */ execvp(((*argv[0] == '-') ? argv[0]+1 : argv[0]), argv); @@ -184,14 +204,15 @@ int get_slave_pty() #else /* ! IRIX */ -#if defined(SOLARIS) || defined(linux) /* System V.4 pty routines from W. Richard Stevens */ +#if defined(SOLARIS) || defined(__GLIBC__) /* System V.4 pty routines from W. Richard Stevens */ #ifdef SOLARIS #include -#endif #define DEV_CLONE "/dev/ptmx" +#endif + extern char *ptsname(); int get_master_pty() @@ -199,9 +220,14 @@ int get_master_pty() 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); @@ -399,8 +425,10 @@ void d_zero(dst, len) void dropctty() { +#ifndef CIBAUD int fd; - +#endif + #if defined(_POSIX_SOURCE) || defined(SOLARIS) || \ defined(__386BSD__) || defined(__FreeBSD__) setsid(); /* The POSIX solution is simple. :) */ @@ -714,7 +742,6 @@ char *string; extern char **environ; /* The process environment strings */ char *newptr, **envptr; - char *tmptr, temp[BUFSIZ]; int distance, n=0; for ( distance=0; ((*(string+distance)) && @@ -765,7 +792,7 @@ int size; char *line; char *tokens; { - char *head, *ptr; + char *head; int i=0; for ( head=line; *line && i < size-2; ) { @@ -853,7 +880,7 @@ char *type; { char *argv[4]; int pipe_fds[2]; - int rw, child; + int rw; if ( strcmp(type, "r") == 0 ) rw=0; /* READ access for parent */ @@ -877,7 +904,14 @@ char *type; close(pipe_fds[0]); close(pipe_fds[1]); /* Set our uid to our real uid if necessary */ - (void) setuid(getuid()); + if (setgid(getgid()) != 0) { + perror("setgid"); + exit(1); + } + if (setuid(getuid()) != 0) { + perror("setuid"); + exit(1); + } /* Run the requested program */ argv[0]="/bin/sh"; --- splitvt-1.6.6.orig/parserc.c +++ splitvt-1.6.6/parserc.c @@ -1,6 +1,8 @@ /* Routines to parse the ~/.splitvtrc file and set default options */ +#include +#include #include #include #include @@ -223,7 +225,7 @@ void splitvtrc() 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.6.orig/vttest.c +++ splitvt-1.6.6/vttest.c @@ -12,6 +12,7 @@ -Sam Lantinga (slouken@toadflax.cs.ucdavis.edu) */ +#include #include #include #include @@ -48,9 +49,12 @@ static void alrm_trap() { alarmed=1; lon 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.6.orig/vtmouse.c +++ splitvt-1.6.6/vtmouse.c @@ -7,10 +7,13 @@ #define SPLITVT_SOURCE +#include +#include #include #include #include #include "vtmouse.h" +#include "splitvt.h" extern FILE *safe_popen(); /* From misc.c */ --- splitvt-1.6.6.orig/lock.c +++ splitvt-1.6.6/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.6.orig/splitvt.c +++ splitvt-1.6.6/splitvt.c @@ -14,6 +14,9 @@ static char *version= "@(#)Splitvt 1.6.6 3/11/2006 -Sam Lantinga (slouken@devolution.com)\n"; +#include +#include +#include #include #include #include @@ -84,6 +87,8 @@ int dologin=0; /* Do the shells run 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; { @@ -101,13 +106,14 @@ char *argv; 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[]; { @@ -117,7 +123,10 @@ char *argv[]; 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 */ @@ -157,7 +166,7 @@ char *argv[]; splitvtrc(); /* Parse command line options */ - while ( (i=getopt(argc, argv, "n:u:l:r:b:s:t:vh")) != EOF ) + while ( (i=getopt(argc, argv, "fn:u:l:r:b:s:t:vh")) != EOF ) { switch (i) { @@ -169,11 +178,19 @@ char *argv[]; 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; @@ -200,7 +217,9 @@ char *argv[]; 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; } @@ -224,7 +243,7 @@ char *argv[]; } (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); @@ -487,6 +506,7 @@ char *argv[]; } } finish(0); + exit(0); } void reset_bar(sleeptime) @@ -510,6 +530,7 @@ void print_help() " '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); @@ -714,7 +735,7 @@ int howfar; 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 ) @@ -736,7 +757,7 @@ int sig; 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.6.orig/utmp.c +++ splitvt-1.6.6/utmp.c @@ -1,22 +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 */ @@ -95,7 +100,7 @@ struct utmp *save; 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); } @@ -159,7 +164,9 @@ char *user; /* The user to add to the u 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; @@ -196,12 +203,13 @@ char *tty; /* /dev/ttyxx */ #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.6.orig/splitvt.1 +++ splitvt-1.6.6/splitvt.1 @@ -51,6 +51,11 @@ Loads 'file' as the startup file instead 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 @@ -177,7 +182,7 @@ and then releasing the button. 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.6.orig/videomem.c +++ splitvt-1.6.6/videomem.c @@ -1,6 +1,7 @@ /* This file holds the functions for manipulating video memory */ +#include #include #include #include "video.h" @@ -114,7 +115,7 @@ int maxlen; 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 "vt100.h" #include "video.h" +#include "splitvt.h" +#include "terminal.h" #define RIGHT 0x01 #define LEFT 0x02 @@ -42,7 +45,7 @@ int direction; } 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 ) @@ -87,7 +90,6 @@ char *buf; int len; position *mark1, *mark2; { - int selection=0; position startsel, endsel; if ( mark1->x == mark2->x ) @@ -201,9 +203,9 @@ static int use_xcb=0; /* Do we use xcb t 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) ) @@ -255,7 +257,7 @@ int win; char *buf; int len; { - int c, state=NORMAL; + int c; position here, cursor, mark1, mark2; window *thiswin; @@ -312,7 +314,7 @@ int len; default: break; } } - return; /* Hopefully, we never reach here */ + return NULL; /* Hopefully, we never reach here */ } --- splitvt-1.6.6.orig/splitvt.man +++ splitvt-1.6.6/splitvt.man @@ -176,7 +176,7 @@ SPLITVT(1) NONESSENTIAL UTILITIES 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.6.orig/config.c +++ splitvt-1.6.6/config.c @@ -161,6 +161,7 @@ char *argv[]; VERBOSE_PRINT("\tI will use wait4() instead of waitpid().\n"); } +#if 0 if ( exists("/usr/lib", "libnet.a") ) /* Socket routines */ strcat(ldflags, " -lnet"); if ( exists("/usr/lib", "libnsl.a") ) /* AT&T socket library */ @@ -169,9 +170,10 @@ char *argv[]; strcat(ldflags, " -lnsl_s"); if ( exists("/usr/lib", "libsun.a") ) /* IRIX yp routines */ strcat(ldflags, " -lsun"); +#endif /* 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; @@ -182,14 +184,14 @@ char *argv[]; 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( @@ -198,7 +200,7 @@ char *argv[]; 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"); } @@ -227,13 +229,13 @@ char *argv[]; } 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"); fprintf(makefile, "splitvt: $(OBJS)\n"); #if defined(linux) && !defined(DEBUG) - fprintf(makefile, "\t$(CC) -s -o $@ $(OBJS) $(LIBS)\n"); + fprintf(makefile, "\t$(CC) -o $@ $(OBJS) $(LIBS)\n"); #else fprintf(makefile, "\t$(CC) -o $@ $(OBJS) $(LIBS)\n"); #endif --- splitvt-1.6.6.orig/terminal.c +++ splitvt-1.6.6/terminal.c @@ -4,9 +4,11 @@ actually write to the terminal. */ - +#include +#include #include #include +#include "splitvt.h" #include "video.h" #include "terminal.h" @@ -126,7 +128,7 @@ char *termtype; } 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.6.orig/vt100.c +++ splitvt-1.6.6/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 */ @@ -22,6 +25,7 @@ #include "vt100.h" #include "video.h" #include "terminal.h" +#include "splitvt.h" #define SEP_CHAR ' ' /* Separator bar character */ @@ -137,7 +141,7 @@ window *win; 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 @@ -685,10 +689,9 @@ int *source; 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 */ @@ -728,11 +731,9 @@ int *source; 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 */ @@ -845,7 +846,8 @@ int *source; 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 */ { @@ -855,7 +857,7 @@ char *init_vt100() 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; @@ -871,18 +873,22 @@ char *init_vt100() 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; @@ -894,19 +900,21 @@ char *init_vt100() 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.6.orig/splitvt.h +++ splitvt-1.6.6/splitvt.h @@ -37,3 +37,25 @@ extern int stbottom; /* 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.6.orig/examples/menu +++ splitvt-1.6.6/examples/menu @@ -3,17 +3,6 @@ # An example menu utilizing the SPLITVT environment variable. # -# Portably echo a line with no trailing newline: -echo_n() { - if [ "`echo -n \"\"`" = "" ]; then - echo -n "$*" - elif [ "`echo -e \"\\c\"`" == "" ]; then - echo -e "$*\c" - else - echo "$*\c" - fi -} - if [ "$SPLITVT" = "upper" ]; then echo "This is the upper window MENU:" echo "" @@ -21,7 +10,7 @@ if [ "$SPLITVT" = "upper" ]; then echo "2) oranges" echo "3) bananas" echo "" - echo_n "Enter your fruit of choice: " + printf "Enter your fruit of choice: " read fruit case $fruit in 1) echo "You like apples!";; @@ -36,7 +25,7 @@ elif [ "$SPLITVT" = "lower" ]; then echo "2) carrots" echo "3) cabbage" echo "" - echo_n "Enter your vegetable of choice: " + printf "Enter your vegetable of choice: " read fruit case $fruit in 1) echo "You like pickles!";; debian/patches/fix.man.minus.sign.patch0000644000000000000000000000475611525752663015317 0ustar Description: Change - by \- to use minus sign instead hyphen in manpage. Author Mònica Ramírez Arceda Last-Update: 2011-02-13 --- a/splitvt.1 +++ b/splitvt.1 @@ -11,52 +11,52 @@ .LP .TP .TB -.I -upper command +.I \-upper command Runs 'command' in the upper window .TP .TB -.I -lower command +.I \-lower command Runs 'command' in the lower window .TP .TB -.I -bottom +.I \-bottom Stats with the focus in the bottom window .TP .TB -.I -s numlines +.I \-s numlines Sets 'numlines' to the number of lines in the top window. This number will be modified if the screen isn't big enough to handle the full size. .TP .TB -.I -t title +.I \-t title Sets an xterm title bar to 'title' .TP .TB -.I -login +.I \-login Runs the programs under each window as though they were login shells. This is useful to have csh source it's .login file, bash source .profile, etc. .TP .TB -.I -nologin +.I \-nologin Ovverrides any "set login on" statement in the startup file. .TP .TB -.I -rcfile file +.I \-rcfile file Loads 'file' as the startup file instead of ~/.splitvtrc. .TP .TB -.I -norc +.I \-norc Suppresses loading your ~/.splitvtrc .TP .TB -.I -f +.I \-f Allow setting the height of either the top or the bottom window to less than 3 lines. .TP .TB -.I -v +.I \-v Print out the version number of splitvt .LP .SH DESCRIPTION @@ -85,7 +85,7 @@ .LP .TP .TB -.I '-' +.I '\-' Shrink the current window .LP .TP @@ -125,7 +125,7 @@ .LP More functions may be added in the future. -If the -s command line option is used, the upper window will be bound +If the \-s command line option is used, the upper window will be bound to the user defined number of lines even if the screen is resized. Otherwise, the screen will be split into two equal parts based on the new size of the screen. @@ -156,8 +156,8 @@ set quote_char ^V set switch_char ^W set upper_lines 12 -run -upper /bin/sh -run -lower top +run \-upper /bin/sh +run \-lower top set login on # This next line would override the above run statements #run /bin/tcsh @@ -198,7 +198,7 @@ weaknesses splitvt might posess. .SH BUGS When used with a certain public domain version of ksh, you have to -manually kill -9 on the shell processes after you quit splitvt. This +manually kill \-9 on the shell processes after you quit splitvt. This has to do with a bug in that version of ksh (Version 06/03/86a and possibly others). debian/patches/migrate.splitvt.to.wtmp.patch0000644000000000000000000000773111542620311016404 0ustar Description: Stop using utmp, migrate to wtmp. The old utmp-implementation is buggy since it corrupts /var/run/wtmp. A standardized use of logwtmp() is much securer and more common. . Built successfully against 1.6.6-9. Author: Mats Erik Andersson Last-Update: 2011-03-23 Forwarded: no --- a/config.c +++ b/config.c @@ -120,6 +120,7 @@ /* Check for the ut_host field in the utmp file */ if ( grep(INCLUDE, "utmp.h", "ut_host") ) { strcat(cflags, " -DHAVE_UTHOST"); + strcat(ldflags, " -lutil"); VERBOSE_PRINT("\tYour utmp file uses the host field.\n"); } --- a/splitvt.c +++ b/splitvt.c @@ -298,7 +298,6 @@ signal(SIGCLD, SIG_IGN); #endif - (void) remove_me(); if ( (topfd=pty_open(upper_args, &toppid, UPPER)) < 0 ) { end_vt100(); @@ -638,8 +637,11 @@ if ( topok ) if ( kill(toppid, 0) < 0 ) { - if ( pw ) + if ( pw && upper_tty[0]) + { (void) delutmp(pw->pw_name, upper_tty); + upper_tty[0] = '\0'; + } if ( thisfd == topfd ) thisfd=bottomfd; (void) close(topfd); @@ -650,8 +652,11 @@ if ( bottomok ) if ( kill(bottompid, 0) < 0 ) { - if ( pw ) + if ( pw && lower_tty[0]) + { (void) delutmp(pw->pw_name, lower_tty); + lower_tty[0] = '\0'; + } if ( thisfd == bottomfd ) thisfd=topfd; (void) close(bottomfd); @@ -667,8 +672,11 @@ if ( topok ) if ( waitpid(toppid, &status, WNOHANG) != 0 ) { - if ( pw ) + if ( pw && upper_tty[0]) + { (void) delutmp(pw->pw_name, upper_tty); + upper_tty[0] = '\0'; + } if ( thisfd == topfd ) thisfd=bottomfd; (void) close(topfd); @@ -679,8 +687,11 @@ if ( bottomok ) if ( waitpid(bottompid, &status, WNOHANG) != 0 ) { - if ( pw ) + if ( pw && lower_tty[0]) + { (void) delutmp(pw->pw_name, lower_tty); + lower_tty[0] = '\0'; + } if ( thisfd == bottomfd ) thisfd=topfd; (void) close(bottomfd); @@ -712,7 +723,6 @@ (void) delutmp(pw->pw_name, upper_tty); if ( pw && bottomok && lower_tty[0] ) (void) delutmp(pw->pw_name, lower_tty); - (void) replace_me(); if ( sig ) printf("Exiting due to signal: %d\n", sig); --- a/utmp.c +++ b/utmp.c @@ -172,7 +172,9 @@ /* Retrieve any existing utmp entry */ d_zero((char *)&ut, sizeof(ut)); +#if 0 /* Outdated */ (void) get_utmp(tty, &ut); +#endif /* Outdated */ /* Get the ttyxy form of the tty pathname if possible. */ if ( *tty == '/' ) { @@ -195,11 +197,15 @@ ut.ut_pid=getpid(); #endif #if defined(HAVE_UTHOST) +# if 0 /* Outdated */ /* remove_me() should be called before this function */ if ( utmp_saved ) { strncpy(ut.ut_host, saved_utmp.ut_host, sizeof(ut.ut_host)-1); ut.ut_host[sizeof(ut.ut_host)-1]='\0'; } +# else /* Portable and fun. */ + strncpy(ut.ut_host, "splitvt", 8); +# endif #endif #if __WORDSIZE == 64 && __WORDSIZE_COMPAT32 /* 'time_t' is 64-bit, 'ut.ut_time' is 32-bit. */ @@ -223,7 +229,12 @@ } #endif +#if 0 /* Outdated */ return(set_utmp(tty, &ut)); +#else /* Only the safe use of /var/log/wtmp. */ + logwtmp(ttyptr, user, "splitvt"); + return 0; +#endif } @@ -237,6 +248,7 @@ struct utmp ut; int retval=0; +#if 0 /* Outdated manual manipulations. */ /* Retrieve any existing utmp entry */ d_zero((char *)&ut, sizeof(ut)); if ( get_utmp(tty, &ut) == 0 ) { @@ -261,6 +273,22 @@ #endif retval=set_utmp(tty, &ut); } +#else /* Portable, half-way contemporary approach. */ + char *ttyptr; + + /* Get the ttyxy form of the tty pathname if possible. */ + if ( *tty == '/' ) { + for ( ttyptr=(tty+1); *ttyptr; ++ttyptr ) { + if ( *ttyptr == '/' ) + break; + } + if ( *ttyptr == '/' ) + ++ttyptr; + } else + ttyptr=tty; + + logwtmp(ttyptr, "", ""); +#endif #if !defined(SOLARIS) && !defined(IRIX) /* Solaris and Irix machines do this automatically */ --- a/vttest.c +++ b/vttest.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #ifdef HAVE_TERMIO_H #include debian/docs0000644000000000000000000000003311525752575010053 0ustar README TODO ANNOUNCE BLURB debian/splitvt.lintian-overrides0000644000000000000000000000030311525752557014265 0ustar # splitvt needs to have write access to the /var/run/utmp file # in order to show which applications and users are running # in each shell of the splitted window. splitvt binary: setgid-binary