diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-01 19:37:40 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-01 19:37:40 +0000 |
commit | 17b27f51ace2d8529e6bf5ac5c84d01c08d8dbf5 (patch) | |
tree | 37bcf9d31b33094d8a1d52bc59a1abb77b5fc55b /apps/netutils/ftpc/ftpc_utils.c | |
parent | c505c3eb243de07b8a59d71b5dbe5683ee9466f4 (diff) | |
download | nuttx-17b27f51ace2d8529e6bf5ac5c84d01c08d8dbf5.tar.gz nuttx-17b27f51ace2d8529e6bf5ac5c84d01c08d8dbf5.tar.bz2 nuttx-17b27f51ace2d8529e6bf5ac5c84d01c08d8dbf5.zip |
Fix some basic FTP client compilation errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3655 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/netutils/ftpc/ftpc_utils.c')
-rw-r--r-- | apps/netutils/ftpc/ftpc_utils.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/apps/netutils/ftpc/ftpc_utils.c b/apps/netutils/ftpc/ftpc_utils.c index 46944e4b2..0b5251fe1 100644 --- a/apps/netutils/ftpc/ftpc_utils.c +++ b/apps/netutils/ftpc/ftpc_utils.c @@ -40,6 +40,7 @@ #include <nuttx/config.h> #include <stdlib.h> +#include <string.h> #include "ftpc_internal.h" @@ -136,7 +137,8 @@ void ftpc_curdir(struct ftpc_session_s *session) * Name: ftpc_stripcrlf * * Description: - * Strip any trailing carriage returns or line feeds from a string. + * Strip any trailing carriage returns or line feeds from a string (by + * overwriting them with NUL characters). * ****************************************************************************/ @@ -164,30 +166,32 @@ void ftpc_stripcrlf(FAR char *str) * Name: ftpc_stripslash * * Description: - * Strip any trailing slashes from a string. + * Strip any trailing slashes from a string (by overwriting them with NUL + * characters. * ****************************************************************************/ -FAR char *ftpc_stripslash(FAR char *str) +void ftpc_stripslash(FAR char *str) { FAR char *ptr; + int len; - if (!str || !*str) - return str; - - ptr = strchr(str, 0); - if(!ptr) - return str; - ptr--; - if(*ptr == '/') { - if(ptr != str) /* root directory */ - *ptr = 0; - } - return str; + if (str) + { + len = strlen(str); + if (len > 1) + { + ptr = str + len - 1; + if (*ptr == '/'); + { + *ptr = '\0'; + } + } + } } /**************************************************************************** - * Name: ftpc_stripslash + * Name: ftpc_dequote * * Description: * Convert quoted hexadecimal constants to binary values. |