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
|
$NetBSD: patch-ao,v 1.2 2005/12/09 15:26:52 joerg Exp $
--- echo.c.orig 1988-07-03 17:50:08.000000000 +0000
+++ echo.c
@@ -6,23 +6,15 @@
* of the display screen. Used by the entire
* known universe.
*/
-/*
- * The varargs lint directive comments are 0 an attempt to get lint to shup
- * up about CORRECT usage of varargs.h. It won't.
- */
#include "def.h"
#include "key.h"
-#ifdef LOCAL_VARARGS
-#include "varargs.h"
-#else
-#include <varargs.h>
-#endif
+#include <stdarg.h>
#ifndef NO_MACRO
# include "macro.h"
#endif
static int veread();
-VOID ewprintf();
+VOID ewprintf(char *, ...);
static VOID eformat();
static VOID eputi();
static VOID eputl();
@@ -30,6 +22,9 @@ static VOID eputs();
static VOID eputc();
static int complt();
+int ereply(char *, char *, int, ...);
+
+
int epresf = FALSE; /* Stuff in echo line flag. */
/*
* Erase the echo line.
@@ -111,20 +106,13 @@ eyesno(sp) char *sp; {
* place. This is always a new message, there is no auto
* completion, and the return is echoed as such.
*/
-/*VARARGS 0*/
-ereply(va_alist)
-va_dcl
+ereply(char *fp, char *buf, int nbuf, ...)
{
va_list pvar;
- register char *fp, *buf;
- register int nbuf;
register int i;
- va_start(pvar);
- fp = va_arg(pvar, char *);
- buf = va_arg(pvar, char *);
- nbuf = va_arg(pvar, int);
- i = veread(fp, buf, nbuf, EFNEW|EFCR, &pvar);
+ va_start(pvar, nbuf);
+ i = veread(fp, buf, nbuf, EFNEW|EFCR, pvar);
va_end(pvar);
return i;
}
@@ -138,24 +126,18 @@ va_dcl
* new prompt), an EFFUNC (autocomplete), or EFCR (echo
* the carriage return as CR).
*/
-/* VARARGS 0 */
-eread(va_alist)
-va_dcl
+eread(char *fp, char *buf, int nbuf, int flag, ...)
{
va_list pvar;
- char *fp, *buf;
- int nbuf, flag, i;
- va_start(pvar);
- fp = va_arg(pvar, char *);
- buf = va_arg(pvar, char *);
- nbuf = va_arg(pvar, int);
- flag = va_arg(pvar, int);
- i = veread(fp, buf, nbuf, flag, &pvar);
+ int i;
+
+ va_start(pvar, flag);
+ i = veread(fp, buf, nbuf, flag, pvar);
va_end(pvar);
return i;
}
-static veread(fp, buf, nbuf, flag, ap) char *fp; char *buf; va_list *ap; {
+static veread(fp, buf, nbuf, flag, ap) char *fp; char *buf; va_list ap; {
register int cpos;
register int i;
register int c;
@@ -425,22 +407,18 @@ getxtra(lp1, lp2, cpos, wflag) register
* echo line. The formatting is done by a call
* to the standard formatting routine.
*/
-/*VARARGS 0 */
VOID
-ewprintf(va_alist)
-va_dcl
+ewprintf(char *fp, ...)
{
va_list pvar;
- register char *fp;
#ifndef NO_MACRO
if(inmacro) return;
#endif
- va_start(pvar);
- fp = va_arg(pvar, char *);
+ va_start(pvar, fp);
ttcolor(CTEXT);
ttmove(nrow-1, 0);
- eformat(fp, &pvar);
+ eformat(fp, pvar);
va_end(pvar);
tteeol();
ttflush();
@@ -459,7 +437,7 @@ va_dcl
static VOID
eformat(fp, ap)
register char *fp;
-register va_list *ap;
+va_list ap;
{
register int c;
char kname[NKNAME];
@@ -473,7 +451,7 @@ register va_list *ap;
c = *fp++;
switch (c) {
case 'c':
- (VOID) keyname(kname, va_arg(*ap, int));
+ (VOID) keyname(kname, va_arg(ap, int));
eputs(kname);
break;
@@ -488,22 +466,22 @@ register va_list *ap;
break;
case 'd':
- eputi(va_arg(*ap, int), 10);
+ eputi(va_arg(ap, int), 10);
break;
case 'o':
- eputi(va_arg(*ap, int), 8);
+ eputi(va_arg(ap, int), 8);
break;
case 's':
- eputs(va_arg(*ap, char *));
+ eputs(va_arg(ap, char *));
break;
case 'l':/* explicit longword */
c = *fp++;
switch(c) {
case 'd':
- eputl((long)va_arg(*ap, long), 10);
+ eputl((long)va_arg(ap, long), 10);
break;
default:
eputc(c);
|