aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-04-27 20:16:41 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-04-28 14:32:00 +1000
commitc3a5ad18b81f9794f4d1ecc7a4772c9ef4a2b1bf (patch)
tree4ece9e98d0e9386f6a14372e8ea8436c9e7fdd63
parent087b73d87ebab807ba38e2d543756ac2bc17becc (diff)
downloadbusybox-w32-c3a5ad18b81f9794f4d1ecc7a4772c9ef4a2b1bf.tar.gz
busybox-w32-c3a5ad18b81f9794f4d1ecc7a4772c9ef4a2b1bf.tar.bz2
busybox-w32-c3a5ad18b81f9794f4d1ecc7a4772c9ef4a2b1bf.zip
networking/wget: unmask, with very basic functionality
-rw-r--r--networking/Config.in1
-rw-r--r--networking/wget.c40
2 files changed, 40 insertions, 1 deletions
diff --git a/networking/Config.in b/networking/Config.in
index b4841c2cf..5ccc4836a 100644
--- a/networking/Config.in
+++ b/networking/Config.in
@@ -4,7 +4,6 @@
4# 4#
5 5
6menu "Networking Utilities" 6menu "Networking Utilities"
7 depends on !MINGW32
8 7
9config FEATURE_IPV6 8config FEATURE_IPV6
10 bool "Enable IPv6 support" 9 bool "Enable IPv6 support"
diff --git a/networking/wget.c b/networking/wget.c
index c06a09d72..8752a6bd2 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -23,6 +23,10 @@ struct host_info {
23 char *user; 23 char *user;
24}; 24};
25 25
26#ifdef __MINGW32__
27#define REPLACE_STDIO
28#include "strbuf_file.h"
29#endif
26static void parse_url(char *url, struct host_info *h); 30static void parse_url(char *url, struct host_info *h);
27static FILE *open_socket(len_and_sockaddr *lsa); 31static FILE *open_socket(len_and_sockaddr *lsa);
28static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc); 32static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
@@ -233,8 +237,14 @@ int wget_main(int argc, char **argv)
233 * and we want to connect to only one IP... */ 237 * and we want to connect to only one IP... */
234 lsa = xhost2sockaddr(server.host, server.port); 238 lsa = xhost2sockaddr(server.host, server.port);
235 if (!(opt & WGET_OPT_QUIET)) { 239 if (!(opt & WGET_OPT_QUIET)) {
240#ifdef __MINGW32__
241 /* we have macro conflict here */
242 winansi_fprintf(stderr, "Connecting to %s (%s)\n", server.host,
243 xmalloc_sockaddr2dotted(&lsa->sa, lsa->len));
244#else
236 fprintf(stderr, "Connecting to %s (%s)\n", server.host, 245 fprintf(stderr, "Connecting to %s (%s)\n", server.host,
237 xmalloc_sockaddr2dotted(&lsa->sa, lsa->len)); 246 xmalloc_sockaddr2dotted(&lsa->sa, lsa->len));
247#endif
238 /* We leak result of xmalloc_sockaddr2dotted */ 248 /* We leak result of xmalloc_sockaddr2dotted */
239 } 249 }
240 250
@@ -656,6 +666,36 @@ static int ftpcmd(const char *s1, const char *s2, FILE *fp, char *buf)
656/* Stuff below is from BSD rcp util.c, as added to openshh. 666/* Stuff below is from BSD rcp util.c, as added to openshh.
657 * Original copyright notice is retained at the end of this file. 667 * Original copyright notice is retained at the end of this file.
658 */ 668 */
669
670#ifdef __MINGW32__
671
672/* from include/mingw.h */
673#define fprintf(...) winansi_fprintf(__VA_ARGS__)
674
675/* Source: uclibc */
676# define timeradd(a, b, result) \
677 do { \
678 (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
679 (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
680 if ((result)->tv_usec >= 1000000) \
681 { \
682 ++(result)->tv_sec; \
683 (result)->tv_usec -= 1000000; \
684 } \
685 } while (0)
686# define timersub(a, b, result) \
687 do { \
688 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
689 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
690 if ((result)->tv_usec < 0) { \
691 --(result)->tv_sec; \
692 (result)->tv_usec += 1000000; \
693 } \
694 } while (0)
695
696
697#endif
698
659static int 699static int
660getttywidth(void) 700getttywidth(void)
661{ 701{