fix cups depends
[openwrt.git] / openwrt / package / atftp / patches / 120-retry_setting.patch
1 diff -urN atftp.old/tftp.c atftp.dev/tftp.c
2 --- atftp.old/tftp.c 2006-03-25 16:41:49.000000000 +0100
3 +++ atftp.dev/tftp.c 2006-03-25 18:10:04.000000000 +0100
4 @@ -967,6 +967,7 @@
5 { "tftp-timeout", 1, NULL, 'T'},
6 { "mode", 1, NULL, 'M'},
7 { "option", 1, NULL, 'O'},
8 + { "retry", 1, NULL, 'R'},
9 #if 1
10 { "timeout", 1, NULL, 't'},
11 { "blksize", 1, NULL, 'b'},
12 @@ -986,11 +987,16 @@
13 };
14
15 /* Support old argument until 0.8 */
16 - while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm",
17 + while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smR:",
18 options, &option_index)) != EOF)
19 {
20 switch (c)
21 {
22 + case 'R':
23 + snprintf(string, sizeof(string), "option retry %s", optarg);
24 + make_arg(string, &ac, &av);
25 + process_cmd(ac, av);
26 + break;
27 case 'g':
28 interactive = 0;
29 if ((action == PUT) || (action == MGET))
30 diff -urN atftp.old/tftp_def.c atftp.dev/tftp_def.c
31 --- atftp.old/tftp_def.c 2004-02-13 04:16:09.000000000 +0100
32 +++ atftp.dev/tftp_def.c 2006-03-25 18:10:04.000000000 +0100
33 @@ -37,6 +37,7 @@
34 { "timeout", "5", 0, 1 }, /* 2348, 2349, 2090. */
35 { "blksize", "512", 0, 1 }, /* This is the default option */
36 { "multicast", "", 0, 1 }, /* structure */
37 + { "retry", "5", 0, 1 },
38 { "", "", 0, 0}
39 };
40
41 diff -urN atftp.old/tftp_def.h atftp.dev/tftp_def.h
42 --- atftp.old/tftp_def.h 2004-02-13 04:16:09.000000000 +0100
43 +++ atftp.dev/tftp_def.h 2006-03-25 17:19:15.000000000 +0100
44 @@ -40,7 +40,8 @@
45 #define OPT_TIMEOUT 3
46 #define OPT_BLKSIZE 4
47 #define OPT_MULTICAST 5
48 -#define OPT_NUMBER 7
49 +#define OPT_RETRY 6
50 +#define OPT_NUMBER 8
51
52 #define OPT_SIZE 12
53 #define VAL_SIZE MAXLEN
54 diff -urN atftp.old/tftp_file.c atftp.dev/tftp_file.c
55 --- atftp.old/tftp_file.c 2004-02-13 04:16:09.000000000 +0100
56 +++ atftp.dev/tftp_file.c 2006-03-25 18:10:04.000000000 +0100
57 @@ -123,6 +123,7 @@
58 struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
59 FILE *fp = NULL; /* the local file pointer */
60 int number_of_timeout = 0;
61 + int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
62 int convert = 0; /* if true, do netascii convertion */
63
64 int oacks = 0; /* count OACK for improved error checking */
65 @@ -141,7 +142,7 @@
66
67 int prev_block_number = 0; /* needed to support netascii convertion */
68 int temp = 0;
69 -
70 +
71 data->file_size = 0;
72 tftp_cancel = 0;
73 from.sin_addr.s_addr = 0;
74 @@ -288,7 +289,7 @@
75 case GET_TIMEOUT:
76 number_of_timeout++;
77 fprintf(stderr, "timeout: retrying...\n");
78 - if (number_of_timeout > NB_OF_RETRY)
79 + if ((num_retry > 0) && (number_of_timeout > num_retry))
80 state = S_ABORT;
81 else
82 state = timeout_state;
83 @@ -325,7 +326,7 @@
84 number_of_timeout++;
85 fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
86 inet_ntoa(from.sin_addr), ntohs(from.sin_port));
87 - if (number_of_timeout > NB_OF_RETRY)
88 + if ((num_retry > 0) && (number_of_timeout > num_retry))
89 state = S_ABORT;
90 break;
91 case ERR:
92 @@ -614,6 +615,7 @@
93 struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
94 FILE *fp; /* the local file pointer */
95 int number_of_timeout = 0;
96 + int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
97 struct stat file_stat;
98 int convert = 0; /* if true, do netascii convertion */
99 char string[MAXLEN];
100 @@ -751,7 +753,7 @@
101 case GET_TIMEOUT:
102 number_of_timeout++;
103 fprintf(stderr, "timeout: retrying...\n");
104 - if (number_of_timeout > NB_OF_RETRY)
105 + if ((num_retry > 0) && (number_of_timeout > num_retry))
106 state = S_ABORT;
107 else
108 state = timeout_state;
109 @@ -797,7 +799,7 @@
110 number_of_timeout++;
111 fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
112 inet_ntoa(from.sin_addr), ntohs(from.sin_port));
113 - if (number_of_timeout > NB_OF_RETRY)
114 + if ((num_retry > 0) && (number_of_timeout > num_retry))
115 state = S_ABORT;
116 break;
117 case ERR:
This page took 0.066977 seconds and 5 git commands to generate.