summaryrefslogtreecommitdiff
path: root/networking/wget.c
diff options
context:
space:
mode:
authorMark Whitley <markw@lineo.com>2000-12-07 19:56:48 +0000
committerMark Whitley <markw@lineo.com>2000-12-07 19:56:48 +0000
commitf57c944e09417edcbcd69f2b01b937cadef39db2 (patch)
treea55822621d54bd82c54e272fa986e45698fea0f1 /networking/wget.c
parent7b5c16ebe5f1b057603cf1c0b0187be418725c42 (diff)
downloadbusybox-w32-f57c944e09417edcbcd69f2b01b937cadef39db2.tar.gz
busybox-w32-f57c944e09417edcbcd69f2b01b937cadef39db2.tar.bz2
busybox-w32-f57c944e09417edcbcd69f2b01b937cadef39db2.zip
Changed names of functions in utility.c and all affected files, to make
compliant with the style guide. Everybody rebuild your tags file!
Diffstat (limited to 'networking/wget.c')
-rw-r--r--networking/wget.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/networking/wget.c b/networking/wget.c
index b43bbad62..0ec4dff19 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -100,7 +100,7 @@ int wget_main(int argc, char **argv)
100 100
101 101
102 if (do_continue && !fname_out) 102 if (do_continue && !fname_out)
103 fatalError("cannot specify continue (-c) without a filename (-O)\n"); 103 error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
104 /* 104 /*
105 * Parse url into components. 105 * Parse url into components.
106 */ 106 */
@@ -117,7 +117,7 @@ int wget_main(int argc, char **argv)
117 if (fname_out != (char *)1) { 117 if (fname_out != (char *)1) {
118 if ( (output=fopen(fname_out, (do_continue ? "a" : "w"))) 118 if ( (output=fopen(fname_out, (do_continue ? "a" : "w")))
119 == NULL) 119 == NULL)
120 fatalPerror("fopen(%s)", fname_out); 120 perror_msg_and_die("fopen(%s)", fname_out);
121 } else { 121 } else {
122 output = stdout; 122 output = stdout;
123 } 123 }
@@ -128,7 +128,7 @@ int wget_main(int argc, char **argv)
128 if (do_continue) { 128 if (do_continue) {
129 struct stat sbuf; 129 struct stat sbuf;
130 if (fstat(fileno(output), &sbuf) < 0) 130 if (fstat(fileno(output), &sbuf) < 0)
131 fatalError("fstat()"); 131 error_msg_and_die("fstat()");
132 if (sbuf.st_size > 0) 132 if (sbuf.st_size > 0)
133 beg_range = sbuf.st_size; 133 beg_range = sbuf.st_size;
134 else 134 else
@@ -147,7 +147,7 @@ int wget_main(int argc, char **argv)
147 * Retrieve HTTP response line and check for "200" status code. 147 * Retrieve HTTP response line and check for "200" status code.
148 */ 148 */
149 if (fgets(buf, sizeof(buf), sfp) == NULL) 149 if (fgets(buf, sizeof(buf), sfp) == NULL)
150 fatalError("no response from server\n"); 150 error_msg_and_die("no response from server\n");
151 for (s = buf ; *s != '\0' && !isspace(*s) ; ++s) 151 for (s = buf ; *s != '\0' && !isspace(*s) ; ++s)
152 ; 152 ;
153 for ( ; isspace(*s) ; ++s) 153 for ( ; isspace(*s) ; ++s)
@@ -156,13 +156,13 @@ int wget_main(int argc, char **argv)
156 case 200: 156 case 200:
157 if (!do_continue) 157 if (!do_continue)
158 break; 158 break;
159 fatalError("server does not support ranges\n"); 159 error_msg_and_die("server does not support ranges\n");
160 case 206: 160 case 206:
161 if (do_continue) 161 if (do_continue)
162 break; 162 break;
163 /*FALLTHRU*/ 163 /*FALLTHRU*/
164 default: 164 default:
165 fatalError("server returned error: %s", buf); 165 error_msg_and_die("server returned error: %s", buf);
166 } 166 }
167 167
168 /* 168 /*
@@ -175,7 +175,7 @@ int wget_main(int argc, char **argv)
175 continue; 175 continue;
176 } 176 }
177 if (strcmp(buf, "transfer-encoding") == 0) { 177 if (strcmp(buf, "transfer-encoding") == 0) {
178 fatalError("server wants to do %s transfer encoding\n", s); 178 error_msg_and_die("server wants to do %s transfer encoding\n", s);
179 continue; 179 continue;
180 } 180 }
181 } 181 }
@@ -197,7 +197,7 @@ int wget_main(int argc, char **argv)
197 filesize -= n; 197 filesize -= n;
198 } 198 }
199 if (n == 0 && ferror(sfp)) 199 if (n == 0 && ferror(sfp))
200 fatalPerror("network read error"); 200 perror_msg_and_die("network read error");
201 201
202 exit(0); 202 exit(0);
203} 203}
@@ -211,7 +211,7 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path)
211 *uri_port = 80; 211 *uri_port = 80;
212 212
213 if (strncmp(url, "http://", 7) != 0) 213 if (strncmp(url, "http://", 7) != 0)
214 fatalError("not an http url: %s\n", url); 214 error_msg_and_die("not an http url: %s\n", url);
215 215
216 /* pull the host portion to the front of the buffer */ 216 /* pull the host portion to the front of the buffer */
217 for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) { 217 for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) {
@@ -240,7 +240,7 @@ FILE *open_socket(char *host, int port)
240 memzero(&sin, sizeof(sin)); 240 memzero(&sin, sizeof(sin));
241 sin.sin_family = AF_INET; 241 sin.sin_family = AF_INET;
242 if ((hp = (struct hostent *) gethostbyname(host)) == NULL) 242 if ((hp = (struct hostent *) gethostbyname(host)) == NULL)
243 fatalError("cannot resolve %s\n", host); 243 error_msg_and_die("cannot resolve %s\n", host);
244 memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); 244 memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length);
245 sin.sin_port = htons(port); 245 sin.sin_port = htons(port);
246 246
@@ -248,11 +248,11 @@ FILE *open_socket(char *host, int port)
248 * Get the server onto a stdio stream. 248 * Get the server onto a stdio stream.
249 */ 249 */
250 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) 250 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
251 fatalPerror("socket()"); 251 perror_msg_and_die("socket()");
252 if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) 252 if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
253 fatalPerror("connect(%s)", host); 253 perror_msg_and_die("connect(%s)", host);
254 if ((fp = fdopen(fd, "r+")) == NULL) 254 if ((fp = fdopen(fd, "r+")) == NULL)
255 fatalPerror("fdopen()"); 255 perror_msg_and_die("fdopen()");
256 256
257 return fp; 257 return fp;
258} 258}
@@ -281,7 +281,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
281 281
282 /* verify we are at the end of the header name */ 282 /* verify we are at the end of the header name */
283 if (*s != ':') 283 if (*s != ':')
284 fatalError("bad header line: %s\n", buf); 284 error_msg_and_die("bad header line: %s\n", buf);
285 285
286 /* locate the start of the header value */ 286 /* locate the start of the header value */
287 for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s) 287 for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s)
@@ -475,7 +475,7 @@ progressmeter(int flag)
475 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 475 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
476 * SUCH DAMAGE. 476 * SUCH DAMAGE.
477 * 477 *
478 * $Id: wget.c,v 1.9 2000/12/07 03:55:35 tausq Exp $ 478 * $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $
479 */ 479 */
480 480
481 481