summaryrefslogtreecommitdiff
path: root/usr.bin/tftp
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-06-25 15:45:11 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-06-25 15:45:11 +0000
commitbc36cb29bdacf6a7d1cd10f521af8f3d341556ff (patch)
tree2f87dc37331bffd03f277b06d8735ae3ff2c2ff9 /usr.bin/tftp
parent09f12ad21b1198ffeeab35b8b11bbe5299be3dd7 (diff)
ansi
Diffstat (limited to 'usr.bin/tftp')
-rw-r--r--usr.bin/tftp/main.c7
-rw-r--r--usr.bin/tftp/tftp.c36
-rw-r--r--usr.bin/tftp/tftpsubs.c43
3 files changed, 34 insertions, 52 deletions
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
index ce787e63e25..db8c273732a 100644
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.14 2003/06/10 22:20:53 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.15 2003/06/25 15:45:10 deraadt Exp $ */
/* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: main.c,v 1.14 2003/06/10 22:20:53 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: main.c,v 1.15 2003/06/25 15:45:10 deraadt Exp $";
#endif /* not lint */
/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
@@ -465,8 +465,7 @@ get(int argc, char *argv[])
}
static void
-getusage(s)
- char *s;
+getusage(char *s)
{
printf("usage: %s host:file host:file ... file, or\n", s);
printf(" %s file file ... file if connected\n", s);
diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c
index 10d1dc7e4d4..b8859c0ccf9 100644
--- a/usr.bin/tftp/tftp.c
+++ b/usr.bin/tftp/tftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftp.c,v 1.13 2003/06/10 22:20:53 deraadt Exp $ */
+/* $OpenBSD: tftp.c,v 1.14 2003/06/25 15:45:10 deraadt Exp $ */
/* $NetBSD: tftp.c,v 1.5 1995/04/29 05:55:25 cgd Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: tftp.c,v 1.13 2003/06/10 22:20:53 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: tftp.c,v 1.14 2003/06/25 15:45:10 deraadt Exp $";
#endif /* not lint */
/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
@@ -88,10 +88,7 @@ static void tpacket(const char *, struct tftphdr *, int);
* Send the requested file.
*/
void
-sendfile(fd, name, mode)
- int fd;
- char *name;
- char *mode;
+sendfile(int fd, char *name, char *mode)
{
struct tftphdr *dp, *ap; /* data and ack packets */
volatile int block, size, convert;
@@ -191,10 +188,7 @@ abort:
* Receive a file.
*/
void
-recvfile(fd, name, mode)
- int fd;
- char *name;
- char *mode;
+recvfile(int fd, char *name, char *mode)
{
struct tftphdr *dp, *ap;
volatile int block, size, firsttrip;
@@ -298,11 +292,8 @@ abort: /* ok to ack, since user */
}
static int
-makerequest(request, name, tp, mode)
- int request;
- const char *name;
- struct tftphdr *tp;
- const char *mode;
+makerequest(int request, const char *name, struct tftphdr *tp,
+ const char *mode)
{
char *cp;
int len, pktlen;
@@ -339,8 +330,7 @@ struct errmsg {
* offset by 100.
*/
static void
-nak(error)
- int error;
+nak(int error)
{
struct errmsg *pe;
struct tftphdr *tp;
@@ -367,10 +357,7 @@ nak(error)
}
static void
-tpacket(s, tp, n)
- const char *s;
- struct tftphdr *tp;
- int n;
+tpacket(const char *s, struct tftphdr *tp, int n)
{
static char *opcodes[] =
{ "#0", "RRQ", "WRQ", "DATA", "ACK", "ERROR" };
@@ -423,9 +410,7 @@ stopclock(void)
}
static void
-printstats(direction, amount)
- const char *direction;
- unsigned long amount;
+printstats(const char *direction, unsigned long amount)
{
double delta;
/* compute delta in 1/10's second units */
@@ -439,8 +424,7 @@ printstats(direction, amount)
}
static void
-timer(sig)
- int sig;
+timer(int sig)
{
int save_errno = errno;
diff --git a/usr.bin/tftp/tftpsubs.c b/usr.bin/tftp/tftpsubs.c
index 869adb425f3..11589b2f3fa 100644
--- a/usr.bin/tftp/tftpsubs.c
+++ b/usr.bin/tftp/tftpsubs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftpsubs.c,v 1.6 2003/06/03 02:56:18 millert Exp $ */
+/* $OpenBSD: tftpsubs.c,v 1.7 2003/06/25 15:45:10 deraadt Exp $ */
/* $NetBSD: tftpsubs.c,v 1.3 1994/12/08 09:51:31 jtc Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)tftpsubs.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: tftpsubs.c,v 1.6 2003/06/03 02:56:18 millert Exp $";
+static const char rcsid[] = "$OpenBSD: tftpsubs.c,v 1.7 2003/06/25 15:45:10 deraadt Exp $";
#endif /* not lint */
/* Simple minded read-ahead/write-behind subroutines for tftp user and
@@ -80,12 +80,22 @@ int prevchar = -1; /* putbuf: previous char (cr check) */
static struct tftphdr *rw_init();
-struct tftphdr *w_init() { return rw_init(0); } /* write-behind */
-struct tftphdr *r_init() { return rw_init(1); } /* read-ahead */
+struct tftphdr *
+w_init(void)
+{
+ return rw_init(0); /* write-behind */
+}
+
+struct tftphdr *
+r_init(void)
+{
+ return rw_init(1); /* read-ahead */
+}
+/* init for either read-ahead or write-behind */
+/* zero for write-behind, one for read-head */
static struct tftphdr *
-rw_init(x) /* init for either read-ahead or write-behind */
- int x; /* zero for write-behind, one for read-head */
+rw_init(int x)
{
newline = 0; /* init crlf flag */
prevchar = -1;
@@ -101,10 +111,7 @@ rw_init(x) /* init for either read-ahead or write-behind */
Free it and return next buffer filled with data.
*/
int
-readit(file, dpp, convert)
- FILE *file; /* file opened for read */
- struct tftphdr **dpp;
- int convert; /* if true, convert to ascii */
+readit(FILE *file, struct tftphdr **dpp, int convert)
{
struct bf *b;
@@ -124,9 +131,7 @@ readit(file, dpp, convert)
* conversions are lf -> cr,lf and cr -> cr, nul
*/
void
-read_ahead(file, convert)
- FILE *file; /* file opened for read */
- int convert; /* if true, convert to ascii */
+read_ahead(FILE *file, int convert)
{
int i;
char *p;
@@ -173,10 +178,7 @@ read_ahead(file, convert)
available.
*/
int
-writeit(file, dpp, ct, convert)
- FILE *file;
- struct tftphdr **dpp;
- int ct, convert;
+writeit(FILE *file, struct tftphdr **dpp, int ct, int convert)
{
bfs[current].counter = ct; /* set size of data to write */
current = !current; /* switch to other buffer */
@@ -194,9 +196,7 @@ writeit(file, dpp, ct, convert)
* CR followed by anything else. In this case we leave it alone.
*/
int
-write_behind(file, convert)
- FILE *file;
- int convert;
+write_behind(FILE *file, int convert)
{
char *buf;
int count;
@@ -253,8 +253,7 @@ skipit:
*/
int
-synchnet(f)
- int f; /* socket to flush */
+synchnet(int f)
{
int i, j = 0;
char rbuf[PKTSIZE];