43 #include "webclient.h"
48 #define MAX_URLLEN 128
49 static char url[MAX_URLLEN];
51 static uint8_t running;
54 PROCESS(shell_wget_process,
"wget");
57 "wget [URL]: download a file with HTTP",
66 register char *urlptr;
67 static uip_ipaddr_t addr;
70 urlptr = url + strlen(url) - 1;
71 while(*urlptr ==
' ' && urlptr > url) {
82 if(strncmp(url, http_http, 7) != 0) {
83 while(urlptr >= url) {
84 *(urlptr + 7) = *urlptr;
87 strncpy(url, http_http, 7);
99 for(i = 0; i <
sizeof(host); ++i) {
120 while(*urlptr !=
'/' && *urlptr != 0) {
133 uip_ipaddr_t *addrptr;
151 if(webclient_get(host, 80, file) == 0) {
162 strncpy(url, data,
sizeof(url));
171 webclient_appcall(data);
175 if((
char *)data !=
NULL &&
189 shell_wget_init(
void)
195 webclient_datahandler(
char *data, uint16_t len)
205 webclient_connected(
void)
211 webclient_timedout(
void)
218 webclient_aborted(
void)
225 webclient_closed(
void)
Hostname was not found in the cache.
Hostname is fresh and usable.
void shell_output_str(struct shell_command *c, char *text1, const char *text2)
Output strings from a shell command.
#define PROCESS_BEGIN()
Define the beginning of a process.
Main header file for the Contiki shell
#define NULL
The null pointer.
#define uiplib_ipaddrconv
Convert a textual representation of an IP address to a numerical representation.
void shell_output(struct shell_command *c, void *data1, int len1, const void *data2, int len2)
Output data from a shell command.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
CCIF process_event_t resolv_event_found
Event that is broadcasted when a DNS name has been resolved.
#define uip_ipaddr_copy(dest, src)
Copy an IP address from one place to another.
void shell_register_command(struct shell_command *c)
Register a command with the shell.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
#define PROCESS(name, strname)
Declare a process.
process_event_t tcpip_event
The uIP event.
#define SHELL_COMMAND(name, command, description, process)
Define a shell command.