Remove broken host support for examples/sendmail and examples/wget

This commit is contained in:
Gregory Nutt 2015-07-10 14:36:18 -06:00
parent 5e8928d009
commit 03f477462a
10 changed files with 7 additions and 515 deletions

View File

@ -41,7 +41,7 @@ include $(APPDIR)/Make.defs
ASRCS =
CSRCS =
MAINSRC = target.c
MAINSRC = sendmail_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
@ -117,7 +117,6 @@ depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
@$(MAKE) -f Makefile.host clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
distclean: clean
$(call DELFILE, Make.dep)

View File

@ -1,79 +0,0 @@
############################################################################
# apps/examples/sendmail/Makefile.host
#
# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
# TOPDIR must be defined on the make command line
-include $(TOPDIR)/Make.defs
OBJS = host.o1 smtp.o1
BIN = sendmail
HOSTCFLAGS += -DCONFIG_WEBCLIENT_HOST=1
HOSTCFLAGS += -I. -include hostdefs.h -Iinclude
VPATH = $(TOPDIR)/netutils/smtp:.
all: $(BIN)
.PHONY: clean context clean_context distclean
$(OBJS): %.o1: %.c
$(HOSTCC) -c $(HOSTCFLAGS) $< -o $@
include:
@mkdir include
include/net: include
@ln -s $(TOPDIR)/include/net include/net
include/nuttx:
@mkdir -p include/nuttx
include/queue.h: include
@cp -a $(TOPDIR)/include/queue.h include/.
include/nuttx/config.h: include/nuttx
@touch include/nuttx/config.h
headers: include/nuttx/config.h include/queue.h include/net
$(BIN): headers $(OBJS)
$(HOSTCC) $(HOSTLDFLAGS) $(OBJS) -o $@
clean:
$(call DELFILE, $(BIN).*)
$(call DELFILE, *.o1)
$(call CLEAN)
@rm -rf include

View File

@ -1,107 +0,0 @@
/****************************************************************************
* examples/sendmail/host.c
*
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <netinet/in.h>
#include <nuttx/net/ip.h>
#include <apps/netutils/smtp.h>
/****************************************************************************
* Private Data
****************************************************************************/
static const char g_host_name[] = "localhost";
static const char g_sender[] = "nuttx-testing@example.com";
static const char g_subject[] = "Testing SMTP from NuttX";
static const char g_msg_body[] = "Test message sent by NuttX\r\n";
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: show_usage
****************************************************************************/
static void show_usage(const char *progname, int exitcode)
{
fprintf(stderr, "USAGE: %s <recipient>\n", progname);
exit(exitcode);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: main
****************************************************************************/
int main(int argc, char **argv, char **envp)
{
struct in_addr addr;
void *handle;
if (argc != 2)
{
show_usage(argv[0], 1);
}
printf("sendmail: To: %s\n", argv[1]);
printf("sendmail: From: %s\n", g_sender);
printf("sendmail: Subject: %s\n", g_subject);
printf("sendmail: Body: %s\n", g_msg_body);
net_ipaddr(addr.s_addr, 127, 0, 0, 1);
handle = smtp_open();
if (handle)
{
smtp_configure(handle, g_host_name, &addr.s_addr);
smtp_send(handle, argv[1], NULL, g_sender, g_subject,
g_msg_body, strlen(g_msg_body));
smtp_close(handle);
}
return 0;
}

View File

@ -1,71 +0,0 @@
/****************************************************************************
* examples/wget/hostdefs.h
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __HOSTDEFS_H
#define __HOSTDEFS_H
/****************************************************************************
* Included Files
*****************************************************************************/
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <arpa/inet.h>
/****************************************************************************
* Pre-processor Definitions
*****************************************************************************/
#define HTONS(a) htons(a)
#define HTONL(a) htonl(a)
#define CONFIG_CPP_HAVE_WARNING 1
#define CONFIG_LIBC_NETDB 1
#define FAR
#define ndbg(...) printf(__VA_ARGS__)
#define nvdbg(...) printf(__VA_ARGS__)
#define ERROR (-1)
#define OK (0)
/****************************************************************************
* Type Definitions
*****************************************************************************/
typedef void *(*pthread_startroutine_t)(void *);
#endif /* __HOSTDEFS_H */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* examples/sendmail/target.c
* examples/sendmail/sendmail_maini.c
*
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -103,7 +103,7 @@ static const char g_msg_body[] = CONFIG_EXAMPLES_SENDMAIL_BODY "\r\n";
****************************************************************************/
/****************************************************************************
* sendmail_main
* Name: sendmail_main
****************************************************************************/
#ifdef CONFIG_BUILD_KERNEL
@ -161,5 +161,6 @@ int sendmail_main(int argc, char *argv[])
g_msg_body, strlen(g_msg_body));
smtp_close(handle);
}
return 0;
}

View File

@ -41,7 +41,7 @@ include $(APPDIR)/Make.defs
ASRCS =
CSRCS =
MAINSRC = target.c
MAINSRC = wget_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
@ -116,7 +116,6 @@ depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
@$(MAKE) -f Makefile.host clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
distclean: clean
$(call DELFILE, Make.dep)

View File

@ -1,79 +0,0 @@
############################################################################
# apps/examples/wget/Makefile.host
#
# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
WD = ${shell pwd}
TOPDIR = $(WD)/../..
-include $(TOPDIR)/Make.defs
OBJS = host.o1 webclient.o1 netlib_parsehttpurl.o1
BIN = wget
HOSTCFLAGS += -DCONFIG_WEBCLIENT_HOST=1
HOSTCFLAGS += -I. -include hostdefs.h
VPATH = $(TOPDIR)/netutils/webclient:$(TOPDIR)/netutils/netlib:.
all: $(BIN)
.PHONY: clean context clean_context distclean
$(OBJS): %.o1: %.c
$(HOSTCC) -c $(HOSTCFLAGS) $< -o $@
apps/netutils:
@mkdir -p apps/netutils
apps/netutils/webclient.h: apps/netutils $(TOPDIR)/include/apps/netutils/webclient.h
@cp -a $(TOPDIR)/include/apps/netutils/webclient.h apps/netutils/.
apps/netutils/netlib.h: apps/netutils $(TOPDIR)/include/apps/netutils/netlib.h
@cp -a $(TOPDIR)/include/apps/netutils/netlib.h apps/netutils/.
nuttx:
@mkdir nuttx
nuttx/config.h: nuttx
@touch nuttx/config.h
headers: apps/netutils/webclient.h apps/netutils/netlib.h nuttx/config.h
$(BIN): headers $(OBJS)
$(HOSTCC) $(HOSTLDFLAGS) $(OBJS) -o $@
clean:
$(call DELFILE, $(BIN).*)
$(call DELFILE, *.o1)
$(call CLEAN)
@rm -rf net nuttx

View File

@ -1,100 +0,0 @@
/****************************************************************************
* examples/wget/host.c
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <apps/netutils/webclient.h>
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: callback
****************************************************************************/
static void callback(FAR char **buffer, int offset, int datend,
FAR int *buflen, FAR void *arg)
{
(void)write(1, &((*buffer)[offset]), datend - offset);
}
/****************************************************************************
* Name: show_usage
****************************************************************************/
static void show_usage(const char *progname, int exitcode)
{
fprintf(stderr, "USAGE: %s <url>\n", progname);
exit(exitcode);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: main
****************************************************************************/
int main(int argc, char **argv, char **envp)
{
char buffer[1024];
int ret;
if (argc != 2)
{
show_usage(argv[0], 1);
}
printf("WGET: Getting %s\n", argv[1]);
ret = wget(argv[1], buffer, 1024, callback, NULL);
if (ret < 0)
{
fprintf(stderr, "WGET: wget failed: %s\n", strerror(errno));
}
return 0;
}

View File

@ -1,71 +0,0 @@
/****************************************************************************
* examples/wget/hostdefs.h
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __HOSTDEFS_H
#define __HOSTDEFS_H
/****************************************************************************
* Included Files
*****************************************************************************/
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <arpa/inet.h>
/****************************************************************************
* Pre-processor Definitions
*****************************************************************************/
#define HTONS(a) htons(a)
#define HTONL(a) htonl(a)
#define CONFIG_CPP_HAVE_WARNING 1
#define CONFIG_LIBC_NETDB 1
#define FAR
#define ndbg(...) printf(__VA_ARGS__)
#define nvdbg(...) printf(__VA_ARGS__)
#define ERROR (-1)
#define OK (0)
/****************************************************************************
* Type Definitions
*****************************************************************************/
typedef void *(*pthread_startroutine_t)(void *);
#endif /* __HOSTDEFS_H */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* examples/wget/target.c
* examples/wget/wget_main.c
*
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -104,7 +104,7 @@ static void callback(FAR char **buffer, int offset, int datend,
****************************************************************************/
/****************************************************************************
* wget_main
* Name: wget_main
****************************************************************************/
#ifdef CONFIG_BUILD_KERNEL