summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tip/acu.c16
-rw-r--r--usr.bin/tip/cmds.c119
-rw-r--r--usr.bin/tip/cmdtab.c10
-rw-r--r--usr.bin/tip/cu.c14
-rw-r--r--usr.bin/tip/hunt.c13
-rw-r--r--usr.bin/tip/log.c9
-rw-r--r--usr.bin/tip/remote.c20
-rw-r--r--usr.bin/tip/tip.c68
-rw-r--r--usr.bin/tip/tip.h16
-rw-r--r--usr.bin/tip/tipout.c14
-rw-r--r--usr.bin/tip/uucplock.c16
-rw-r--r--usr.bin/tip/value.c74
12 files changed, 163 insertions, 226 deletions
diff --git a/usr.bin/tip/acu.c b/usr.bin/tip/acu.c
index df0ae79b774..f300689b390 100644
--- a/usr.bin/tip/acu.c
+++ b/usr.bin/tip/acu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acu.c,v 1.10 2004/05/26 18:17:58 deraadt Exp $ */
+/* $OpenBSD: acu.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: acu.c,v 1.4 1996/12/29 10:34:03 cgd Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: acu.c,v 1.10 2004/05/26 18:17:58 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: acu.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
@@ -61,7 +61,7 @@ static jmp_buf jmpbuf;
* found in the file).
*/
char *
-connect()
+con(void)
{
char *cp = PN;
char *phnum, string[256];
@@ -136,7 +136,7 @@ connect()
conflag = (*acu->acu_dialer)(phnum, CU);
if (conflag)
break;
-
+
logent(value(HOST), phnum, acu->acu_name, "call failed");
tried++;
}
@@ -157,8 +157,7 @@ connect()
}
void
-disconnect(reason)
- char *reason;
+disconnect(char *reason)
{
if (!conflag) {
logent(value(HOST), "", DV, "call terminated");
@@ -168,7 +167,7 @@ disconnect(reason)
logent(value(HOST), "", acu->acu_name, "call terminated");
if (boolean(value(VERBOSE)))
printf("\r\ndisconnecting...");
- } else
+ } else
logent(value(HOST), "", acu->acu_name, reason);
(*acu->acu_disconnect)();
}
@@ -181,8 +180,7 @@ acuabort(int s)
}
static acu_t *
-acutype(s)
- char *s;
+acutype(char *s)
{
acu_t *p;
extern acu_t acutable[];
diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c
index a68ced58a5f..48f8aad7fd1 100644
--- a/usr.bin/tip/cmds.c
+++ b/usr.bin/tip/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.21 2005/03/11 22:16:16 otto Exp $ */
+/* $OpenBSD: cmds.c,v 1.22 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: cmds.c,v 1.7 1997/02/11 09:24:03 mrg Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: cmds.c,v 1.21 2005/03/11 22:16:16 otto Exp $";
+static const char rcsid[] = "$OpenBSD: cmds.c,v 1.22 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
@@ -65,8 +65,8 @@ void intcopy(); /* interrupt routine for file transfers */
void
getfl(char c)
{
- char buf[256], *cp, *expand();
-
+ char buf[256], *cp, *expand(char *);
+
putchar(c);
/*
* get the UNIX receiving file's name
@@ -78,7 +78,7 @@ getfl(char c)
printf("\r\n%s: cannot creat\r\n", copyname);
return;
}
-
+
/*
* collect parameters
*/
@@ -96,7 +96,7 @@ void
cu_take(char cc)
{
int fd, argc;
- char line[BUFSIZ], *expand(), *cp;
+ char line[BUFSIZ], *expand(char *), *cp;
if (prompt("[take] ", copyname, sizeof(copyname)))
return;
@@ -123,9 +123,7 @@ static jmp_buf intbuf;
* used by getfl(), cu_take(), and pipefile()
*/
void
-transfer(buf, fd, eofchars)
- char *buf, *eofchars;
- int fd;
+transfer(char *buf, int fd, char *eofchars)
{
int ct;
char c, buffer[BUFSIZ];
@@ -145,17 +143,17 @@ transfer(buf, fd, eofchars)
quit = 0;
kill(tipout_pid, SIGIOT);
read(repdes[0], (char *)&ccc, 1); /* Wait until read process stops */
-
+
/*
* finish command
*/
r = '\r';
parwrite(FD, &r, 1);
do
- read(FD, &c, 1);
+ read(FD, &c, 1);
while ((c&STRIP_PAR) != '\n');
tcsetattr(0, TCSAFLUSH, &defchars);
-
+
(void) setjmp(intbuf);
f = signal(SIGINT, intcopy);
start = time(0);
@@ -199,7 +197,7 @@ transfer(buf, fd, eofchars)
* send remote input to local process via pipe
*/
void
-pipefile()
+pipefile(void)
{
int pdes[2];
char buf[256];
@@ -245,8 +243,9 @@ pipefile()
/*
* Interrupt service routine for FTP
*/
+/*ARGSUSED*/
void
-stopsnd()
+stopsnd(int signo)
{
stop = 1;
@@ -259,12 +258,11 @@ stopsnd()
* terminate transmission with pseudo EOF sequence
*/
void
-sendfile(cc)
- char cc;
+sendfile(char cc)
{
- FILE *fd;
+ FILE *fp;
char *fnamex;
- char *expand();
+ char *expand(char *);
putchar(cc);
/*
@@ -277,11 +275,11 @@ sendfile(cc)
* look up file
*/
fnamex = expand(fname);
- if ((fd = fopen(fnamex, "r")) == NULL) {
+ if ((fp = fopen(fnamex, "r")) == NULL) {
printf("%s: cannot open\r\n", fname);
return;
}
- transmit(fd, value(EOFWRITE), NULL);
+ transmit(fp, value(EOFWRITE), NULL);
if (!boolean(value(ECHOCHECK)))
tcdrain(FD);
}
@@ -291,9 +289,7 @@ sendfile(cc)
* used by sendfile() and cu_put()
*/
void
-transmit(fd, eofchars, command)
- FILE *fd;
- char *eofchars, *command;
+transmit(FILE *fp, char *eofchars, char *command)
{
char *pc, lastc;
int c, ccount, lcount;
@@ -321,7 +317,7 @@ transmit(fd, eofchars, command)
while (1) {
ccount = 0;
do {
- c = getc(fd);
+ c = getc(fp);
if (stop)
goto out;
if (c == EOF)
@@ -333,8 +329,7 @@ transmit(fd, eofchars, command)
if (c == '\n') {
if (!boolean(value(RAWFTP)))
c = '\r';
- }
- else if (c == '\t') {
+ } else if (c == '\t') {
if (!boolean(value(RAWFTP))) {
if (boolean(value(TABEXPAND))) {
send(' ');
@@ -353,7 +348,7 @@ transmit(fd, eofchars, command)
printf("\r%d", ++lcount);
if (boolean(value(ECHOCHECK))) {
timedout = 0;
- alarm((long)value(ETIMEOUT));
+ alarm((unsigned int)value(ETIMEOUT));
do { /* wait for prompt */
read(FD, (char *)&c, 1);
if (timedout || stop) {
@@ -374,7 +369,7 @@ out:
send(*pc);
}
stop_t = time(0);
- fclose(fd);
+ fclose(fp);
signal(SIGINT, f);
if (boolean(value(VERBOSE))) {
if (boolean(value(RAWFTP)))
@@ -390,13 +385,12 @@ out:
* Cu-like put command
*/
void
-cu_put(cc)
- char cc;
+cu_put(char cc)
{
- FILE *fd;
+ FILE *fp;
char line[BUFSIZ];
int argc;
- char *expand();
+ char *expand(char *);
char *copynamex;
if (prompt("[put] ", copyname, sizeof(copyname)))
@@ -409,7 +403,7 @@ cu_put(cc)
if (argc == 1)
argv[1] = argv[0];
copynamex = expand(argv[0]);
- if ((fd = fopen(copynamex, "r")) == NULL) {
+ if ((fp = fopen(copynamex, "r")) == NULL) {
printf("%s: cannot open\r\n", copynamex);
return;
}
@@ -418,7 +412,7 @@ cu_put(cc)
else
(void)snprintf(line, sizeof(line),
"stty -echo;cat>%s;stty echo\r", argv[1]);
- transmit(fd, "\04", line);
+ transmit(fp, "\04", line);
}
/*
@@ -455,7 +449,7 @@ tryagain:
}
void
-timeout()
+timeout(int signo)
{
signal(SIGALRM, timeout);
timedout = 1;
@@ -466,7 +460,7 @@ timeout()
* Identical to consh() except for where stdout goes.
*/
void
-pipeout(c)
+pipeout(int c)
{
char buf[256];
int status, p;
@@ -605,7 +599,7 @@ shell(void)
* initiate the conversation with TIPOUT
*/
void
-setscript()
+setscript(void)
{
char c;
/*
@@ -628,7 +622,7 @@ setscript()
* local portion of tip
*/
void
-chdirectory()
+chdirectory(void)
{
char dirname[PATH_MAX];
char *cp = dirname;
@@ -644,8 +638,7 @@ chdirectory()
}
void
-tipabort(msg)
- char *msg;
+tipabort(char *msg)
{
signal(SIGTERM, SIG_IGN);
@@ -661,7 +654,7 @@ tipabort(msg)
}
void
-finish()
+finish(void)
{
char *dismsg;
@@ -673,7 +666,7 @@ finish()
}
void
-intcopy()
+intcopy(int signo)
{
raw();
quit = 1;
@@ -681,8 +674,7 @@ intcopy()
}
void
-execute(s)
- char *s;
+execute(char *s)
{
char *cp;
@@ -695,9 +687,7 @@ execute(s)
}
int
-args(buf, a, num)
- char *buf, *a[];
- int num;
+args(char *buf, char *a[], int num)
{
char *p = buf, *start;
char **parg = a;
@@ -721,9 +711,7 @@ args(buf, a, num)
}
void
-prtime(s, a)
- char *s;
- time_t a;
+prtime(char *s, time_t a)
{
int i;
int nums[3];
@@ -741,7 +729,7 @@ prtime(s, a)
}
void
-variable()
+variable(void)
{
char buf[256];
@@ -774,10 +762,10 @@ variable()
else
tandem("off");
}
- if (vtable[LECHO].v_access&CHANGED) {
- vtable[LECHO].v_access &= ~CHANGED;
- HD = boolean(value(LECHO));
- }
+ if (vtable[LECHO].v_access&CHANGED) {
+ vtable[LECHO].v_access &= ~CHANGED;
+ HD = boolean(value(LECHO));
+ }
if (vtable[PARITY].v_access&CHANGED) {
vtable[PARITY].v_access &= ~CHANGED;
setparity(NOSTR);
@@ -792,7 +780,7 @@ variable()
}
void
-listvariables()
+listvariables(void)
{
value_t *p;
char buf[BUFSIZ];
@@ -822,15 +810,14 @@ listvariables()
printf(" %s\r\n", buf);
break;
}
- }
+ }
}
/*
* Turn tandem mode on or off for remote tty.
*/
void
-tandem(option)
- char *option;
+tandem(char *option)
{
struct termios rmtty;
@@ -850,8 +837,7 @@ tandem(option)
* Turn hardware flow control on or off for remote tty.
*/
void
-hardwareflow(option)
- char *option;
+hardwareflow(char *option)
{
struct termios rmtty;
@@ -867,7 +853,7 @@ hardwareflow(option)
* Send a break.
*/
void
-genbrk()
+genbrk(void)
{
ioctl(FD, TIOCSBRK, NULL);
@@ -879,8 +865,7 @@ genbrk()
* Suspend tip
*/
void
-suspend(c)
- char c;
+suspend(char c)
{
unraw();
@@ -893,8 +878,7 @@ suspend(c)
*/
char *
-expand(name)
- char name[];
+expand(char name[])
{
static char xname[BUFSIZ];
char cmdbuf[BUFSIZ];
@@ -964,8 +948,7 @@ expand(name)
* Are any of the characters in the two strings the same?
*/
int
-anyof(s1, s2)
- char *s1, *s2;
+anyof(char *s1, char *s2)
{
int c;
diff --git a/usr.bin/tip/cmdtab.c b/usr.bin/tip/cmdtab.c
index c6044955e7d..b0e7e00863a 100644
--- a/usr.bin/tip/cmdtab.c
+++ b/usr.bin/tip/cmdtab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmdtab.c,v 1.5 2003/06/03 02:56:18 millert Exp $ */
+/* $OpenBSD: cmdtab.c,v 1.6 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: cmdtab.c,v 1.3 1994/12/08 09:30:46 jtc Exp $ */
/*
@@ -34,14 +34,14 @@
#if 0
static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: cmdtab.c,v 1.5 2003/06/03 02:56:18 millert Exp $";
+static const char rcsid[] = "$OpenBSD: cmdtab.c,v 1.6 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
-extern int shell(), getfl(), sendfile(), chdirectory();
-extern int finish(), help(), pipefile(), pipeout(), consh(), variable();
-extern int cu_take(), cu_put(), dollar(), genbrk(), suspend(), listvariables();
+extern int shell(int), getfl(int), sendfile(int), chdirectory(int);
+extern int finish(int), help(int), pipefile(int), pipeout(int), consh(int), variable(int);
+extern int cu_take(int), cu_put(int), dollar(int), genbrk(int), suspend(int), listvariables(int);
esctable_t etable[] = {
{ '!', NORM, "shell", shell },
diff --git a/usr.bin/tip/cu.c b/usr.bin/tip/cu.c
index aa8bd8f314e..15ef76b3b39 100644
--- a/usr.bin/tip/cu.c
+++ b/usr.bin/tip/cu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cu.c,v 1.16 2004/11/07 09:48:08 otto Exp $ */
+/* $OpenBSD: cu.c,v 1.17 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: cu.c,v 1.5 1997/02/11 09:24:05 mrg Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cu.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: cu.c,v 1.16 2004/11/07 09:48:08 otto Exp $";
+static const char rcsid[] = "$OpenBSD: cu.c,v 1.17 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
@@ -46,9 +46,7 @@ void cuusage();
* Botch the interface to look like cu's
*/
void
-cumain(argc, argv)
- int argc;
- char *argv[];
+cumain(int argc, char *argv[])
{
int ch, i, parity;
long l;
@@ -61,7 +59,7 @@ cumain(argc, argv)
BR = DEFBR;
parity = 0; /* none */
while ((ch = getopt(argc, argv, "a:l:s:htoe0123456789")) != -1) {
- switch(ch) {
+ switch (ch) {
case 'a':
CU = optarg;
break;
@@ -174,7 +172,7 @@ cumain(argc, argv)
(void)uu_unlock(uucplock);
exit(3);
}
- if (connect()) {
+ if (con()) {
printf("Connect failed\n");
daemon_uid();
(void)uu_unlock(uucplock);
@@ -190,7 +188,7 @@ cumain(argc, argv)
}
void
-cuusage()
+cuusage(void)
{
fprintf(stderr, "usage: cu [-ehot] [-a acu] [-l line] [-s speed] [-#] "
"[phone-number]\n");
diff --git a/usr.bin/tip/hunt.c b/usr.bin/tip/hunt.c
index fa513d352be..4d102e3370a 100644
--- a/usr.bin/tip/hunt.c
+++ b/usr.bin/tip/hunt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hunt.c,v 1.10 2003/06/03 02:56:18 millert Exp $ */
+/* $OpenBSD: hunt.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: hunt.c,v 1.6 1997/04/20 00:02:10 mellon Exp $ */
/*
@@ -34,26 +34,25 @@
#if 0
static char sccsid[] = "@(#)hunt.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: hunt.c,v 1.10 2003/06/03 02:56:18 millert Exp $";
+static const char rcsid[] = "$OpenBSD: hunt.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
-extern char *getremote();
+extern char *getremote(char *);
static jmp_buf deadline;
static int deadfl;
void
-dead()
+dead(int signo)
{
deadfl = 1;
longjmp(deadline, 1);
}
long
-hunt(name)
- char *name;
+hunt(char *name)
{
char *cp;
sig_t f;
@@ -81,7 +80,7 @@ hunt(name)
if (setjmp(deadline) == 0) {
alarm(10);
FD = open(cp, (O_RDWR |
- (boolean(value(DC)) ? O_NONBLOCK : 0)));
+ (boolean(value(DC)) ? O_NONBLOCK : 0)));
}
alarm(0);
if (FD < 0) {
diff --git a/usr.bin/tip/log.c b/usr.bin/tip/log.c
index 8a7ceab1f5c..bb899d896a4 100644
--- a/usr.bin/tip/log.c
+++ b/usr.bin/tip/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.7 2003/06/03 02:56:18 millert Exp $ */
+/* $OpenBSD: log.c,v 1.8 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: log.c,v 1.4 1994/12/24 17:56:28 cgd Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: log.c,v 1.7 2003/06/03 02:56:18 millert Exp $";
+static const char rcsid[] = "$OpenBSD: log.c,v 1.8 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
@@ -46,8 +46,7 @@ static FILE *flog = NULL;
* Log file maintenance routines
*/
void
-logent(group, num, acu, message)
- char *group, *num, *acu, *message;
+logent(char *group, char *num, char *acu, char *message)
{
char *user, *timestamp;
struct passwd *pwd;
@@ -81,7 +80,7 @@ logent(group, num, acu, message)
}
void
-loginit()
+loginit(void)
{
flog = fopen(value(LOG), "a");
if (flog == NULL)
diff --git a/usr.bin/tip/remote.c b/usr.bin/tip/remote.c
index e02e0feeaad..1dd89425647 100644
--- a/usr.bin/tip/remote.c
+++ b/usr.bin/tip/remote.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.c,v 1.13 2003/09/20 18:15:32 millert Exp $ */
+/* $OpenBSD: remote.c,v 1.14 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: remote.c,v 1.5 1997/04/20 00:02:45 mellon Exp $ */
/*
@@ -41,7 +41,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: remote.c,v 1.13 2003/09/20 18:15:32 millert Exp $";
+static const char rcsid[] = "$OpenBSD: remote.c,v 1.14 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -69,12 +69,9 @@ static char *db_array[3] = { _PATH_REMOTE, 0, 0 };
#define cgetflag(f) (cgetcap(bp, f, ':') != NULL)
static void
-getremcap(host)
- char *host;
+getremcap(char *host)
{
- char **p, ***q;
- char *bp;
- char *rempath;
+ char **p, ***q, *bp, *rempath;
int stat;
rempath = getenv("REMOTE");
@@ -100,18 +97,18 @@ getremcap(host)
FS = DEFFS;
return;
}
- switch(stat) {
+ switch (stat) {
case -1:
fprintf(stderr, "%s: unknown host %s\n", __progname,
host);
break;
case -2:
- fprintf(stderr,
+ fprintf(stderr,
"%s: can't open host description file\n",
__progname);
break;
case -3:
- fprintf(stderr,
+ fprintf(stderr,
"%s: possible reference loop in host description file\n", __progname);
break;
}
@@ -205,8 +202,7 @@ getremcap(host)
}
char *
-getremote(host)
- char *host;
+getremote(char *host)
{
char *cp;
static char *next;
diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c
index a12c5882fcd..a2d90259374 100644
--- a/usr.bin/tip/tip.c
+++ b/usr.bin/tip/tip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tip.c,v 1.24 2004/11/07 09:48:08 otto Exp $ */
+/* $OpenBSD: tip.c,v 1.25 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: tip.c,v 1.13 1997/04/20 00:03:05 mellon Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: tip.c,v 1.24 2004/11/07 09:48:08 otto Exp $";
+static const char rcsid[] = "$OpenBSD: tip.c,v 1.25 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
/*
@@ -59,14 +59,10 @@ void cleanup(int);
char PNbuf[256]; /* This limits the size of a number */
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
- char *system = NOSTR;
+ char *system = NOSTR, sbuf[12], *p;
int i;
- char *p;
- char sbuf[12];
gid = getgid();
egid = getegid();
@@ -182,7 +178,7 @@ notnumber:
(void)uu_unlock(uucplock);
exit(3);
}
- if ((p = connect())) {
+ if ((p = con())) {
printf("\07%s\n[EOT]\n", p);
daemon_uid();
(void)uu_unlock(uucplock);
@@ -222,8 +218,8 @@ cucommon:
term.c_cc[VTIME] = 0;
defchars = term;
term.c_cc[VINTR] = term.c_cc[VQUIT] = term.c_cc[VSUSP] =
- term.c_cc[VDSUSP] = term.c_cc[VDISCARD] =
- term.c_cc[VLNEXT] = _POSIX_VDISABLE;
+ term.c_cc[VDSUSP] = term.c_cc[VDISCARD] =
+ term.c_cc[VLNEXT] = _POSIX_VDISABLE;
raw();
pipe(fildes); pipe(repdes);
@@ -273,7 +269,7 @@ cleanup(int signo)
static int uidswapped;
void
-user_uid()
+user_uid(void)
{
if (uidswapped == 0) {
seteuid(uid);
@@ -282,7 +278,7 @@ user_uid()
}
void
-daemon_uid()
+daemon_uid(void)
{
if (uidswapped) {
@@ -292,7 +288,7 @@ daemon_uid()
}
void
-shell_uid()
+shell_uid(void)
{
setegid(gid);
seteuid(uid);
@@ -302,7 +298,7 @@ shell_uid()
* put the controlling keyboard into raw mode
*/
void
-raw()
+raw(void)
{
tcsetattr(0, TCSADRAIN, &term);
}
@@ -312,7 +308,7 @@ raw()
* return keyboard to normal mode
*/
void
-unraw()
+unraw(void)
{
if (gotdefterm)
tcsetattr(0, TCSADRAIN, &defterm);
@@ -326,10 +322,7 @@ static jmp_buf promptbuf;
* normal erase and kill characters.
*/
int
-prompt(s, p, sz)
- char *s;
- char *p;
- size_t sz;
+prompt(char *s, char *p, size_t sz)
{
int c;
char *b = p;
@@ -355,7 +348,7 @@ prompt(s, p, sz)
* Interrupt service routine during prompting
*/
void
-intprompt()
+intprompt(void)
{
(void)signal(SIGINT, SIG_IGN);
@@ -368,7 +361,7 @@ intprompt()
* ****TIPIN TIPIN****
*/
void
-tipin()
+tipin(void)
{
char bol = 1;
int gch;
@@ -423,7 +416,7 @@ extern esctable_t etable[];
* called on recognition of ``escapec'' at the beginning of a line
*/
int
-escape()
+escape(void)
{
int gch;
esctable_t *p;
@@ -446,9 +439,7 @@ escape()
}
int
-any(cc, p)
- int cc;
- char *p;
+any(int cc, char *p)
{
char c = cc;
while (p && *p)
@@ -458,8 +449,7 @@ any(cc, p)
}
int
-size(s)
- char *s;
+size(char *s)
{
int i = 0;
@@ -469,8 +459,7 @@ size(s)
}
char *
-interp(s)
- char *s;
+interp(char *s)
{
static char buf[256];
char *p = buf, c, *q;
@@ -495,8 +484,7 @@ interp(s)
}
char *
-ctrl(c)
- char c;
+ctrl(char c)
{
static char s[3];
@@ -515,8 +503,7 @@ ctrl(c)
* Help command
*/
void
-help(c)
- char c;
+help(char c)
{
esctable_t *p;
@@ -534,8 +521,7 @@ help(c)
* Set up the "remote" tty's state
*/
int
-ttysetup(speed)
- int speed;
+ttysetup(int speed)
{
struct termios cntrl;
@@ -547,7 +533,7 @@ ttysetup(speed)
if (boolean(value(DC)))
cntrl.c_cflag |= CLOCAL;
if (boolean(value(HARDWAREFLOW)))
- cntrl.c_cflag |= CRTSCTS;
+ cntrl.c_cflag |= CRTSCTS;
cntrl.c_iflag &= ~(ISTRIP|ICRNL);
cntrl.c_oflag &= ~OPOST;
cntrl.c_lflag &= ~(ICANON|ISIG|IEXTEN|ECHO);
@@ -566,10 +552,7 @@ static char partab[0200];
* with the right parity and output it.
*/
void
-parwrite(fd, buf, n)
- int fd;
- char *buf;
- int n;
+parwrite(int fd, char *buf, int n)
{
int i;
char *bp;
@@ -592,8 +575,7 @@ parwrite(fd, buf, n)
* Build a parity table with appropriate high-order bit.
*/
void
-setparity(defparity)
- char *defparity;
+setparity(char *defparity)
{
int i, flip, clr, set;
char *parity;
diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h
index 88429c5cad1..9347383a468 100644
--- a/usr.bin/tip/tip.h
+++ b/usr.bin/tip/tip.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tip.h,v 1.18 2004/05/26 18:17:59 deraadt Exp $ */
+/* $OpenBSD: tip.h,v 1.19 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */
/*
@@ -165,10 +165,10 @@ typedef
typedef
struct {
- char e_char; /* char to match on */
- char e_flags; /* experimental, privileged */
- char *e_help; /* help string */
- int (*e_func)(); /* command */
+ char e_char; /* char to match on */
+ char e_flags; /* experimental, privileged */
+ char *e_help; /* help string */
+ int (*e_func)(int); /* command */
}
esctable_t;
@@ -269,9 +269,9 @@ extern int disc; /* current tty discpline */
extern char *__progname; /* program name */
-extern char *ctrl();
-extern char *vinterp();
-extern char *connect();
+extern char *ctrl(char c);
+extern char *vinterp(char *, int);
+extern char *con(void);
char *sname(char *s);
int any(int cc, char *p);
diff --git a/usr.bin/tip/tipout.c b/usr.bin/tip/tipout.c
index 8d48fa6cac1..29494f33d4d 100644
--- a/usr.bin/tip/tipout.c
+++ b/usr.bin/tip/tipout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tipout.c,v 1.12 2005/04/11 19:59:07 deraadt Exp $ */
+/* $OpenBSD: tipout.c,v 1.13 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: tipout.c,v 1.5 1996/12/29 10:34:12 cgd Exp $ */
/*
@@ -34,10 +34,11 @@
#if 0
static char sccsid[] = "@(#)tipout.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: tipout.c,v 1.12 2005/04/11 19:59:07 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: tipout.c,v 1.13 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
+
/*
* tip
*
@@ -52,7 +53,7 @@ static jmp_buf sigbuf;
* sent by TIPIN when it wants to posses the remote host
*/
void
-intIOT()
+intIOT(int signo)
{
write(repdes[1],&ccc,1);
@@ -65,7 +66,7 @@ intIOT()
* accepts script file name over the pipe and acts accordingly
*/
void
-intEMT()
+intEMT(int signo)
{
char c, line[256];
char *pline = line;
@@ -97,7 +98,6 @@ intEMT()
void
intTERM(int signo)
{
-
if (boolean(value(SCRIPT)) && fscript != NULL)
fclose(fscript);
if (signo && tipin_pid)
@@ -106,7 +106,7 @@ intTERM(int signo)
}
void
-intSYS()
+intSYS(int signo)
{
setboolean(value(BEAUTIFY), !boolean(value(BEAUTIFY)));
@@ -117,7 +117,7 @@ intSYS()
* ****TIPOUT TIPOUT****
*/
void
-tipout()
+tipout(void)
{
char buf[BUFSIZ];
char *cp;
diff --git a/usr.bin/tip/uucplock.c b/usr.bin/tip/uucplock.c
index 7f4728d00a8..d1581b9c545 100644
--- a/usr.bin/tip/uucplock.c
+++ b/usr.bin/tip/uucplock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uucplock.c,v 1.10 2003/06/03 02:56:18 millert Exp $ */
+/* $OpenBSD: uucplock.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: uucplock.c,v 1.7 1997/02/11 09:24:08 mrg Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)uucplock.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: uucplock.c,v 1.10 2003/06/03 02:56:18 millert Exp $";
+static const char rcsid[] = "$OpenBSD: uucplock.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -48,15 +48,14 @@ static const char rcsid[] = "$OpenBSD: uucplock.c,v 1.10 2003/06/03 02:56:18 mil
#include <errno.h>
#include "pathnames.h"
-/*
+/*
* uucp style locking routines
* return: 0 - success
- * -1 - failure
+ * -1 - failure
*/
int
-uu_lock(ttyname)
- char *ttyname;
+uu_lock(char *ttyname)
{
int fd, len;
char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
@@ -77,7 +76,7 @@ uu_lock(ttyname)
return(-1);
}
len = read(fd, text_pid, sizeof(text_pid)-1);
- if(len<=0) {
+ if (len<=0) {
perror(tbuf);
(void)close(fd);
fprintf(stderr, "Can't read lock file.\n");
@@ -118,8 +117,7 @@ uu_lock(ttyname)
}
int
-uu_unlock(ttyname)
- char *ttyname;
+uu_unlock(char *ttyname)
{
char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
diff --git a/usr.bin/tip/value.c b/usr.bin/tip/value.c
index ac11e8b0bba..9829200ccb2 100644
--- a/usr.bin/tip/value.c
+++ b/usr.bin/tip/value.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: value.c,v 1.10 2003/06/03 02:56:18 millert Exp $ */
+/* $OpenBSD: value.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $ */
/* $NetBSD: value.c,v 1.6 1997/02/11 09:24:09 mrg Exp $ */
/*
@@ -34,26 +34,26 @@
#if 0
static char sccsid[] = "@(#)value.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: value.c,v 1.10 2003/06/03 02:56:18 millert Exp $";
+static const char rcsid[] = "$OpenBSD: value.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
#define MIDDLE 35
-static value_t *vlookup();
+static value_t *vlookup(char *);
+static int vaccess(unsigned int mode, unsigned int rw);
static int col = 0;
/*
* Variable manipulation
*/
void
-vinit()
+vinit(void)
{
+ char file[FILENAME_MAX], *cp;
value_t *p;
- char *cp;
- FILE *f;
- char file[FILENAME_MAX];
+ FILE *fp;
for (p = vtable; p->v_name != NULL; p++) {
if (p->v_type&ENVIRON)
@@ -68,20 +68,20 @@ vinit()
*/
if (strlen(value(HOME)) + sizeof("/.tiprc") > sizeof(file)) {
(void)fprintf(stderr, "Home directory path too long: %s\n",
- value(HOME));
+ value(HOME));
} else {
snprintf(file, sizeof file, "%s/.tiprc", value(HOME));
- if ((f = fopen(file, "r")) != NULL) {
+ if ((fp = fopen(file, "r")) != NULL) {
char *tp;
- while (fgets(file, sizeof(file)-1, f) != NULL) {
+ while (fgets(file, sizeof(file)-1, fp) != NULL) {
if (vflag)
printf("set %s", file);
if ((tp = strrchr(file, '\n')))
*tp = '\0';
vlex(file);
}
- fclose(f);
+ fclose(fp);
}
}
/*
@@ -90,21 +90,17 @@ vinit()
vtable[EXCEPTIONS].v_access &= ~(WRITE<<PUBLIC);
}
-static int vaccess();
-
/*VARARGS1*/
void
-vassign(p, v)
- value_t *p;
- char *v;
+vassign(value_t *p, char *v)
{
if (!vaccess(p->v_access, WRITE)) {
printf("access denied\r\n");
return;
}
- switch (p->v_type&TMASK) {
+ switch (p->v_type&TMASK) {
case STRING:
if (p->v_value && equal(p->v_value, v))
return;
@@ -116,19 +112,16 @@ vassign(p, v)
}
p->v_type &= ~(ENVIRON|INIT);
break;
-
case NUMBER:
if (number(p->v_value) == number(v))
return;
setnumber(p->v_value, number(v));
break;
-
case BOOL:
if (boolean(p->v_value) == (*v != '!'))
return;
setboolean(p->v_value, (*v != '!'));
break;
-
case CHAR:
if (character(p->v_value) == *v)
return;
@@ -141,18 +134,16 @@ static void vprint();
static void vtoken();
void
-vlex(s)
- char *s;
+vlex(char *s)
{
value_t *p;
+ char *cp;
if (equal(s, "all")) {
for (p = vtable; p->v_name; p++)
if (vaccess(p->v_access, READ))
vprint(p);
} else {
- char *cp;
-
do {
if ((cp = vinterp(s, ' ')))
cp++;
@@ -167,19 +158,18 @@ vlex(s)
}
static void
-vtoken(s)
- char *s;
+vtoken(char *s)
{
value_t *p;
char *cp;
- char *expand();
+ char *expand(char *);
if ((cp = strchr(s, '='))) {
*cp = '\0';
if ((p = vlookup(s))) {
cp++;
if (p->v_type&NUMBER)
- vassign(p, atoi(cp));
+ vassign(p, (char *)atoi(cp));
else {
if (strcmp(s, "record") == 0)
cp = expand(cp);
@@ -207,11 +197,10 @@ vtoken(s)
}
static void
-vprint(p)
- value_t *p;
+vprint(value_t *p)
{
+ extern char *interp();
char *cp;
- extern char *interp(), *ctrl();
if (col > 0 && col < MIDDLE)
while (col++ < MIDDLE)
@@ -261,8 +250,7 @@ vprint(p)
static int
-vaccess(mode, rw)
- unsigned int mode, rw;
+vaccess(unsigned int mode, unsigned int rw)
{
if (mode & (rw<<PUBLIC))
return (1);
@@ -272,8 +260,7 @@ vaccess(mode, rw)
}
static value_t *
-vlookup(s)
- char *s;
+vlookup(char *s)
{
value_t *p;
@@ -284,14 +271,12 @@ vlookup(s)
}
char *
-vinterp(s, stop)
- char *s;
- char stop;
+vinterp(char *s, int stop)
{
char *p = s, c;
int num;
- while ((c = *s++) && c != stop)
+ while ((c = *s++) && c != stop) {
switch (c) {
case '^':
@@ -332,6 +317,7 @@ vinterp(s, stop)
default:
*p++ = c;
}
+ }
*p = '\0';
return (c == stop ? s-1 : NULL);
}
@@ -340,18 +326,16 @@ vinterp(s, stop)
* assign variable s with value v (for NUMBER or STRING or CHAR types)
*/
int
-vstring(s,v)
- char *s;
- char *v;
+vstring(char *s, char *v)
{
value_t *p;
- char *expand();
+ char *expand(char *);
- p = vlookup(s);
+ p = vlookup(s);
if (p == 0)
return (1);
if (p->v_type&NUMBER)
- vassign(p, atoi(v));
+ vassign(p, (char *)atoi(v));
else {
if (strcmp(s, "record") == 0)
v = expand(v);