mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
Fix examples/wget build
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1649 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+35
-1
@@ -308,7 +308,7 @@ examples/usbserial
|
||||
serial messages.
|
||||
|
||||
examples/usbstorage
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This example registers a block device driver, then exports the block
|
||||
the device using the USB storage class driver. Configuration options:
|
||||
@@ -347,3 +347,37 @@ examples/usbstorage
|
||||
|
||||
Error results are always shown in the trace output
|
||||
|
||||
examples/wget
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
A simple web client example. It will obtain a file from a server using the HTTP
|
||||
protocol. Settings unique to this example include:
|
||||
|
||||
CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file
|
||||
CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/')
|
||||
CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC)
|
||||
CONFIG_EXAMPLE_WGET_IPADDR - Target IP address
|
||||
CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess
|
||||
CONFIG_EXAMPLE_WGET_NETMASK - Network mask
|
||||
|
||||
This example uses netutils/webclient. Additional configuration settings apply
|
||||
to that code as follows (but built-in defaults are probably OK):
|
||||
|
||||
CONFIG_WEBCLIENT_GETMIMETYPE, CONFIG_WEBCLIENT_MAXHTTPLINE,
|
||||
CONFIG_WEBCLIENT_MAXMIMESIZE, CONFIG_WEBCLIENT_MAXHOSTNAME,
|
||||
CONFIG_WEBCLIENT_MAXFILENAME
|
||||
|
||||
Of course, the example also requires other settings including CONFIG_NET and
|
||||
CONFIG_NET_TCP. The example also uses the uIP resolver which requires CONFIG_UDP.
|
||||
|
||||
WARNNG: As of this writing, wget is untested on the target platform. At present
|
||||
it has been tested only in the host-based configuration described in the following
|
||||
note. The primary difference is that the target version will rely on the also
|
||||
untested uIP name resolver.
|
||||
|
||||
NOTE: For test purposes, this example can be built as a host-based wget function.
|
||||
This can be built as follows:
|
||||
|
||||
cd examples/wget
|
||||
make -f Makefile.host
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ include $(TOPDIR)/Make.defs
|
||||
OBJS = host.o1 webclient.o1
|
||||
BIN = wget
|
||||
|
||||
HOSTCFLAGS += -DCONFIG_NETUTILS_WEBCLIENT_HOST=1
|
||||
HOSTCFLAGS += -DCONFIG_WEBCLIENT_HOST=1
|
||||
HOSTCFLAGS += -I. -include hostdefs.h
|
||||
VPATH = $(TOPDIR)/netutils/webclient:.
|
||||
|
||||
|
||||
+16
-1
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
@@ -86,6 +87,21 @@
|
||||
|
||||
static char g_iobuffer[512];
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
* Name: callback
|
||||
****************************************************************************/
|
||||
|
||||
static void callback(FAR char **buffer, int offset, int datend, FAR int *buflen)
|
||||
{
|
||||
(void)write(1, &((*buffer)[offset]), datend - offset);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
* user_initialize
|
||||
****************************************************************************/
|
||||
@@ -106,7 +122,6 @@ void user_initialize(void)
|
||||
int user_start(int argc, char *argv[])
|
||||
{
|
||||
struct in_addr addr;
|
||||
static uip_ipaddr_t addr;
|
||||
#if defined(CONFIG_EXAMPLE_WGET_NOMAC)
|
||||
uint8 mac[IFHWADDRLEN];
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user