Added cmdline args support to wget example.
This commit is contained in:
parent
fc983e2e79
commit
64ce68f004
@ -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);
|
||||
|
||||
extern int contiki_argc;
|
||||
extern char **contiki_argv;
|
||||
|
||||
static int file = -1;
|
||||
static char url[128];
|
||||
|
||||
@ -162,9 +165,19 @@ PROCESS_THREAD(wget_process, ev, data)
|
||||
}
|
||||
|
||||
fputs("Get url:", stdout);
|
||||
if(contiki_argc > 1) {
|
||||
strcpy(url, contiki_argv[1]);
|
||||
puts(url);
|
||||
} else {
|
||||
gets(url);
|
||||
}
|
||||
fputs("Save as:", stdout);
|
||||
if(contiki_argc > 2) {
|
||||
strcpy(name, contiki_argv[2]);
|
||||
puts(name);
|
||||
} else {
|
||||
gets(name);
|
||||
}
|
||||
file = cfs_open(name, CFS_WRITE);
|
||||
if(file == -1) {
|
||||
printf("Open error with '%s'\n", name);
|
||||
|
Loading…
Reference in New Issue
Block a user