summaryrefslogtreecommitdiffstats
path: root/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch
diff options
context:
space:
mode:
Diffstat (limited to 'network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch')
-rw-r--r--network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch111
1 files changed, 111 insertions, 0 deletions
diff --git a/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch b/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch
new file mode 100644
index 0000000000..96149667a4
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch
@@ -0,0 +1,111 @@
+--- linksys-tftp-1.2.1/tftpsubs.c 2024-04-16 08:27:50.310449884 -0700
++++ linksys-tftp-1.2.1/tftpsubs.c 2024-04-16 08:53:26.084521570 -0700
+@@ -38,6 +38,7 @@ static char sccsid[] = "@(#)tftpsubs.c 5
+ // modified tftp header to include pass
+ #include <tftp.h>
+ #include <stdio.h>
++#include <unistd.h>
+
+ #define PKTSIZE (1432+4) /* SEGSIZE+4 */ /* should be moved to tftp.h */
+
+@@ -60,14 +61,22 @@ static int current; /* index of buff
+ int newline = 0; /* fillbuf: in middle of newline expansion */
+ int prevchar = -1; /* putbuf: previous char (cr check) */
+
+-struct tftphdr *rw_init();
++/* functions declared in this program */
++struct tftphdr *w_init();
++struct tftphdr *r_init();
++struct tftphdr *rw_init(int x);
++int readit(FILE *file, struct tftphdr **dpp, int convert);
++int read_ahead(FILE *file, int convert);
++int writeit(FILE *file, struct tftphdr **dpp, int ct, int convert);
++int write_behind( FILE *file, int convert);
++int synchnet(int f);
+
+ struct tftphdr *w_init() { return rw_init(0); } /* write-behind */
+ struct tftphdr *r_init() { return rw_init(1); } /* read-ahead */
+
+-struct tftphdr *
+-rw_init(x) /* init for either read-ahead or write-behind */
+-int x; /* zero for write-behind, one for read-head */
++/* init for either read-ahead or write-behind */
++struct tftphdr *rw_init(int x)
++ /* zero for write-behind, one for read-head */
+ {
+ newline = 0; /* init crlf flag */
+ prevchar = -1;
+@@ -82,10 +91,8 @@ int x; /* zero for writ
+ /* Have emptied current buffer by sending to net and getting ack.
+ Free it and return next buffer filled with data.
+ */
+-readit(file, dpp, convert)
+- FILE *file; /* file opened for read */
+- struct tftphdr **dpp;
+- int convert; /* if true, convert to ascii */
++int readit(FILE *file, struct tftphdr **dpp, int convert)
++ /* file opened for read if true, convert to ascii */
+ {
+ struct bf *b;
+
+@@ -104,9 +111,9 @@ readit(file, dpp, convert)
+ * fill the input buffer, doing ascii conversions if requested
+ * conversions are lf -> cr,lf and cr -> cr, nul
+ */
+-read_ahead(file, convert)
+- FILE *file; /* file opened for read */
+- int convert; /* if true, convert to ascii */
++int read_ahead(FILE *file, int convert)
++ /* file opened for read */
++ /* if true, convert to ascii */
+ {
+ register int i;
+ register char *p;
+@@ -154,16 +161,14 @@ read_ahead(file, convert)
+ *p++ = c;
+ }
+ b->counter = (int)(p - dp->th_data);
++ return 0;
+ }
+
+ /* Update count associated with the buffer, get new buffer
+ from the queue. Calls write_behind only if next buffer not
+ available.
+ */
+-writeit(file, dpp, ct, convert)
+- FILE *file;
+- struct tftphdr **dpp;
+- int convert;
++int 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 */
+@@ -180,9 +185,7 @@ writeit(file, dpp, ct, convert)
+ * Note spec is undefined if we get CR as last byte of file or a
+ * CR followed by anything else. In this case we leave it alone.
+ */
+-write_behind(file, convert)
+- FILE *file;
+- int convert;
++int write_behind( FILE *file, int convert)
+ {
+ char *buf;
+ int count;
+@@ -238,9 +241,8 @@ skipit:
+ * when trace is active).
+ */
+
+-int
+-synchnet(f)
+-int f; /* socket to flush */
++int synchnet(int f)
++ /* socket to flush */
+ {
+ int i, j = 0;
+ char rbuf[PKTSIZE];
+@@ -258,4 +260,5 @@ int f; /* socket to flush */
+ return(j);
+ }
+ }
++ return 0; /* should never get here */
+ }