diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-03-28 16:30:10 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-03-28 16:30:10 +0000 |
commit | e0fdc9c8c430448845bcccc3dcbb34048dbe5cf1 (patch) | |
tree | 4b8583c054f429daf15ab3cc300e15132d1f8143 /nuttx/examples/wget/host.c | |
parent | de94351602c0eeac526dc587a52a3907976bee1d (diff) | |
download | px4-nuttx-e0fdc9c8c430448845bcccc3dcbb34048dbe5cf1.tar.gz px4-nuttx-e0fdc9c8c430448845bcccc3dcbb34048dbe5cf1.tar.bz2 px4-nuttx-e0fdc9c8c430448845bcccc3dcbb34048dbe5cf1.zip |
wget now takes only a URL as a argument; not host + file name
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1654 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/wget/host.c')
-rw-r--r-- | nuttx/examples/wget/host.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/nuttx/examples/wget/host.c b/nuttx/examples/wget/host.c index 1ada4cea4..6d59e0eb1 100644 --- a/nuttx/examples/wget/host.c +++ b/nuttx/examples/wget/host.c @@ -42,6 +42,7 @@ #include <stdlib.h> #include <unistd.h> #include <string.h> +#include <errno.h> /**************************************************************************** * Private Data @@ -66,7 +67,7 @@ static void callback(FAR char **buffer, int offset, int datend, FAR int *buflen) static void show_usage(const char *progname, int exitcode) { - fprintf(stderr, "USAGE: %s <host> <filename>\n", progname); + fprintf(stderr, "USAGE: %s <url>\n", progname); exit(exitcode); } @@ -80,13 +81,18 @@ static void show_usage(const char *progname, int exitcode) int main(int argc, char **argv, char **envp) { char buffer[1024]; + int ret; - if (argc != 3) + if (argc != 2) { show_usage(argv[0], 1); } - printf("WGET: Getting %s from %s\n", argv[2], argv[1]); - wget(80, argv[1], argv[2], buffer, 1024, callback); + printf("WGET: Getting %s\n", argv[1]); + ret = wget(argv[1], buffer, 1024, callback); + if (ret < 0) + { + fprintf(stderr, "WGET: wget failed: %s\n", strerror(errno)); + } return 0; } |