summaryrefslogtreecommitdiffstats
path: root/source/a/splitvt/splitvt_1.6.5-9.diff
blob: 47d560377f57d017871f100829886e5a8c0f4310 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
--- 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 <joeyh@debian.org>  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 <joeyh@debian.org>  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 <joeyh@debian.org>  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 <joeyh@debian.org>  Sat,  8 Feb 2003 12:32:25 -0500
+
+splitvt (1.6.5-5) unstable; urgency=low
+
+  * Updated to debhelper v4.
+
+ -- Joey Hess <joeyh@debian.org>  Thu, 13 Jun 2002 16:30:04 -0400
+
+splitvt (1.6.5-4) unstable; urgency=low
+
+  * Updated patch to not break resizing.
+
+ -- Joey Hess <joeyh@debian.org>  Fri,  5 Oct 2001 20:09:25 -0400
+
+splitvt (1.6.5-3) unstable; urgency=low
+
+  * Patch from Robert de Bath <robert$@mayday.cix.co.uk> 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 <joeyh@debian.org>  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 <joeyh@debian.org>  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 <joeyh@debian.org>  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 <joeyh@debian.org>  Wed, 14 Jun 2000 14:13:30 -0700
+
+splitvt (1.6.4-2) unstable; urgency=low
+
+  * Corrected build-depends, Closes: #65584
+
+ -- Joey Hess <joeyh@debian.org>  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 <joeyh@debian.org>  Sun, 11 Jun 2000 21:42:41 -0700
+
+splitvt (1.6.3-7.0slink1) stable; urgency=high
+
+  *  Security fix.
+
+ -- Daniel Jacobowitz <dan@debian.org>  Sat,  3 Jun 2000 17:56:33 -0400
+
+splitvt (1.6.3-7) unstable; urgency=low
+
+  * Build dep.
+
+ -- Joey Hess <joeyh@debian.org>  Sat,  4 Dec 1999 16:21:35 -0800
+
+splitvt (1.6.3-6) unstable; urgency=low
+
+  * FHS
+
+ -- Joey Hess <joeyh@debian.org>  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 <joeyh@debian.org>  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 <joeyh@debian.org>  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 <joeyh@debian.org>  Mon,  7 Sep 1998 19:56:53 -0700
+
+splitvt (1.6.3-2) unstable; urgency=low
+
+  * Fixed package description spelling (#18990).
+
+ -- Joey Hess <joeyh@debian.org>  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 <joeyh@debian.org>  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 <joeyh@debian.org>
+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 <joeyh@debian.org>, 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 <slouken@domo.ccnet.com>                                     
+ To: Joey Hess <joey@kite.ml.org>                                                
+ Cc: slouken@mongoloid.devolution.com                                            
+ Subject: Re: splitvt copyright                                                  
+ X-Mailer: My Mailer 1.5  <slouken@devolution.com>                               
+  
+ > 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 <unistd.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string.h>
@@ -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	<string.h>
+#include	<unistd.h>
+#include	<stdlib.h>
 #include	<sys/types.h>
 #include	<sys/time.h>
 #include	<sys/wait.h>
@@ -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	<stdio.h>
+#include	<string.h>
+#include	<unistd.h>
 #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	<unistd.h>
+#include	<string.h>
+#include	<stdlib.h>
 #include	<sys/types.h>
 #ifdef HAVE_TERMIO_H
 #include	<termio.h>		/* 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	<unistd.h>
 #include	<sys/types.h>
 #include	<sys/stat.h>
 #include	<fcntl.h>
 #include	<utmp.h>
 #include	<stdio.h>
+#include	<string.h>
+#include	<time.h>
+#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	<unistd.h>
+#include	<sys/types.h>
+#include	<string.h>
 #include	<stdio.h>
 #include	<pwd.h>
 #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	<unistd.h>
 #include	<sys/types.h>
 #include	<stdio.h>
 #include	<fcntl.h>
@@ -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 <string.h>
+#include <stdlib.h>
 #include <stdio.h>
 #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	<stdlib.h>
 #include	<stdio.h>
 #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<x2 && l<maxlen); ++i ) {
@@ -319,7 +320,7 @@
 void paint_video(win)
 window *win;
 {
-	unsigned char change, on=NORMAL;
+	unsigned char on=NORMAL;
 	int i, j, oldattr=0;
 
 	vt_setscroll(0,0);
--- splitvt-1.6.5.orig/vtmouse.h
+++ splitvt-1.6.5/vtmouse.h
@@ -39,5 +39,7 @@
 extern int  event_getc();
 extern void event_quit();
 
+#if 0
+/* this is broken for gcc 4.0, so comment it out */
 extern FILE *xt_input, *xt_output;	/* Usually untouched */
-
+#endif
--- splitvt-1.6.5.orig/terminal.c
+++ splitvt-1.6.5/terminal.c
@@ -4,8 +4,11 @@
    actually write to the terminal.
 */
 
-
+#include	<curses.h>
+#include	<term.h>
 #include	<stdio.h>
+#include	<string.h>
+#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	<sys/types.h>
+#include	<sys/wait.h>
+#include	<unistd.h>
+#include	<stdlib.h>
 #include	<sys/stat.h>
 #include	<fcntl.h>
 #include	<stdio.h>
 #include	<signal.h>
+#include	<utime.h>
+#include	<string.h>
 
 
 #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 <stropts.h>
 
 #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 */