=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tftp/tftpsubs.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- src/usr.bin/tftp/tftpsubs.c 2003/06/03 02:56:18 1.6 +++ src/usr.bin/tftp/tftpsubs.c 2003/06/25 15:45:10 1.7 @@ -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 @@ 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 @@ 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 @@ * 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 @@ 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 @@ * 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 @@ */ int -synchnet(f) - int f; /* socket to flush */ +synchnet(int f) { int i, j = 0; char rbuf[PKTSIZE];