summaryrefslogtreecommitdiff
path: root/editors/uemacs/patches/patch-ag
blob: 6d8b1428bb29d49eca8362180fc1e8abca2eca7e (plain)
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
$NetBSD: patch-ag,v 1.3 2012/05/10 20:53:30 dholland Exp $

- needs term.h for termcap
- get terminal size from termcap only if LINES and COLUMNS aren't set
  in the environment
- return values from non-void functions
  (arguably these should be made void but it causes complications)
- don't use implicit int
- add missing conditionals around conditionally-used declaration
- remove unused variables
- use correct type signature for signal handler

--- src/unix.c.orig	1995-11-18 21:36:58.000000000 +0000
+++ src/unix.c
@@ -123,6 +123,7 @@ int scnothing()
 #include <curses.h>			/* Curses screen output		*/
 #undef WINDOW				/* Oh no!			*/
 #endif /* CURSES */
+#include <term.h>
 
 /** Completion include files **/
 /** Directory accessing: Try and figure this out... if you can! **/
@@ -816,9 +817,19 @@ int scopen()
 		exit(1);
 	}
 
-	/* Get size from termcap */
-	term.t_nrow = tgetnum("li") - 1;
-	term.t_ncol = tgetnum("co");
+	/*
+	 * If LINES and/or COLUMNS are set in the environment then use those
+	 * values, otherwise get them from termcap.
+	 */
+	if ((cp = getenv("LINES")) == NULL || sscanf(cp, "%hd",
+	    &term.t_nrow) != 1)
+		term.t_nrow = tgetnum("li");
+	term.t_nrow -= 1;
+
+	if ((cp = getenv("COLUMNS")) == NULL || sscanf(cp, "%hd",
+	    &term.t_ncol) != 1)
+		term.t_ncol = tgetnum("co");
+
 	if (term.t_nrow < 3 || term.t_ncol < 3) {
 		puts("Screen size is too small!");
 		exit(1);
@@ -956,6 +967,7 @@ int sckopen()
 	dis_ufk();
 #endif
 #endif
+	return 0;
 }
 
 /* close keyboard -hm */
@@ -968,6 +980,7 @@ int sckclose()
 	dis_sfk();
 #endif
 #endif
+	return 0;
 }
 
 /** Move cursor **/
@@ -1063,7 +1076,7 @@ int state;				/* New state			*/
 }
 
 /** Beep **/
-scbeep()
+int scbeep()
 {
 #if TERMCAP || TERMIOS
 #if !NOISY
@@ -1085,7 +1098,9 @@ scbeep()
 }
 
 #if COLOR
+#if USG || AUX
 static char cmap[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
+#endif
 
 /** Set foreground color **/
 int scfcol(color)
@@ -1553,7 +1568,6 @@ char *fspec;				/* Filename specificatio
 /** Get next filename from pattern **/
 char *getnfile()
 {
-	int index;
 	struct DIRENTRY * dp;
 	struct stat fstat;
 
@@ -1706,15 +1720,15 @@ char *name;	/* name of directory to dele
 /*
  * Window size changes handled via signals.
  */
-void winch_changed()
+void winch_changed(int sig)
 {
+	(void)sig;
 	signal(SIGWINCH,winch_changed);
 	winch_flag = 1;
 }
 
 void winch_new_size()
 {
-	EWINDOW *wp;
 	struct winsize win;
   
 	winch_flag=0;