#include "netlib.h" /* wget URL : send the URL to the host gateway over SLIP, print the reply body. The gateway does the real DNS/TCP/HTTP and streams the body back as frames: each reply frame is 'D', ending with a single 'E' frame. */ void main(void) { char *argv[4]; unsigned char argc = argv_parse(argv, 4); char buf[220]; unsigned char len, i; if (argc < 1) { puts("usage: wget URL"); nl(); return; } slip_send(argv[0], strlen(argv[0])); for (;;) { len = slip_recv(buf, 219); if (len >= 1 && buf[0] == 'E') break; /* end of stream */ for (i = 1; i < len; i++) putc(buf[i]); /* skip the 'D' type byte */ } nl(); }