From d8a039ee18825d1f29e0c020ae6569453fb7bb4f Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 5 Feb 2012 17:36:13 +0000 Subject: FTPD daemon and example now build without errors git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4371 42af7a65-404d-4744-a932-0658087f49c3 --- apps/netutils/ftpd/ftpd.c | 479 ++++++++++++++++------------------------------ apps/netutils/ftpd/ftpd.h | 111 ++++++----- 2 files changed, 216 insertions(+), 374 deletions(-) (limited to 'apps/netutils/ftpd') diff --git a/apps/netutils/ftpd/ftpd.c b/apps/netutils/ftpd/ftpd.c index fa15afeec..3dead6cb1 100755 --- a/apps/netutils/ftpd/ftpd.c +++ b/apps/netutils/ftpd/ftpd.c @@ -7,8 +7,8 @@ * Includes original code as well as logic adapted from hwport_ftpd, written * by Jaehyuk Cho which is released under a BSD license. * - * Copyright (C) HWPORT.COM. All rights reserved. - * Author: JAEHYUK CHO + * Copyright (C) hwport.com. All rights reserved. + * Author: Jaehyuk Cho * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -46,19 +46,32 @@ #include #include +#include #include +#include +#include +#include #include +#include +#include +#include +#include #include +#include #include +#include + #include "ftpd.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +#define __NUTTX__ 1 /* Flags some unusual NuttX dependencies */ + /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -86,11 +99,9 @@ static FAR char *ftpd_strtok(bool skipspace, FAR const char *delimiters, FAR char **str); static FAR char *ftpd_strtok_alloc(bool skipspace, FAR const char *delimiters, FAR const char **str); -static int ftpd_patternmatch(FAR const char *pattern, FAR const char *str); /* Socket helpers */ -static int ftpd_getprotocol(FAR const char *protocol) static int ftpd_rxpoll(int sd, int timeout); static int ftpd_txpoll(int sd, int timeout); static int ftpd_accept(int sd, FAR void *addr, FAR socklen_t *addrlen, @@ -115,13 +126,13 @@ static FAR struct ftpd_pathnode_s * ftpd_nodeappend(FAR struct ftpd_pathnode_s *head, FAR struct ftpd_pathnode_s *node, bool override); static int ftpd_getpath(FAR struct ftpd_session_s *session, - FAR const char *chdirectory, FAR char **abspath, + FAR const char *path, FAR char **abspath, FAR char **workpath); /* Commmand helpers */ static int ftpd_changedir(FAR struct ftpd_session_s *session, - FAR char *rempath); + FAR const char *rempath); static off_t ftpd_offsatoi(FAR const char *filename, off_t offset); static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype); static uint8_t ftpd_listoption(FAR char **param); @@ -224,7 +235,7 @@ static const struct ftpd_cmd_s g_ftpdcmdtab[] = {"OPTS", ftpd_command_opts, FTPD_CMDFLAG_LOGIN}, /* OPTS