Merge pull request #537 from oliverschmidt/master
Added cmdline args support to wget example.
This commit is contained in:
commit
33304c0f5f
|
@ -1 +1 @@
|
||||||
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS
|
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_ARGS
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS
|
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_ARGS
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS
|
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_ARGS
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_PFS
|
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_PFS,WITH_ARGS
|
||||||
|
|
|
@ -44,6 +44,9 @@ PROCESS(wget_process, "Wget");
|
||||||
|
|
||||||
AUTOSTART_PROCESSES(&wget_process);
|
AUTOSTART_PROCESSES(&wget_process);
|
||||||
|
|
||||||
|
extern int contiki_argc;
|
||||||
|
extern char **contiki_argv;
|
||||||
|
|
||||||
static int file = -1;
|
static int file = -1;
|
||||||
static char url[128];
|
static char url[128];
|
||||||
|
|
||||||
|
@ -162,9 +165,19 @@ PROCESS_THREAD(wget_process, ev, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs("Get url:", stdout);
|
fputs("Get url:", stdout);
|
||||||
|
if(contiki_argc > 1) {
|
||||||
|
strcpy(url, contiki_argv[1]);
|
||||||
|
puts(url);
|
||||||
|
} else {
|
||||||
gets(url);
|
gets(url);
|
||||||
|
}
|
||||||
fputs("Save as:", stdout);
|
fputs("Save as:", stdout);
|
||||||
|
if(contiki_argc > 2) {
|
||||||
|
strcpy(name, contiki_argv[2]);
|
||||||
|
puts(name);
|
||||||
|
} else {
|
||||||
gets(name);
|
gets(name);
|
||||||
|
}
|
||||||
file = cfs_open(name, CFS_WRITE);
|
file = cfs_open(name, CFS_WRITE);
|
||||||
if(file == -1) {
|
if(file == -1) {
|
||||||
printf("Open error with '%s'\n", name);
|
printf("Open error with '%s'\n", name);
|
||||||
|
|
Loading…
Reference in a new issue