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
This commit is contained in:
parent
7ea870d443
commit
d6c53df4f6
@ -207,7 +207,7 @@ extern "C" {
|
||||
/* Low-level string management */
|
||||
|
||||
EXTERN void ftpc_stripcrlf(FAR char *str);
|
||||
EXTERN void ftpc_stripslash(FAR const char *str);
|
||||
EXTERN void ftpc_stripslash(FAR char *str);
|
||||
EXTERN FAR char *ftpc_dequote(FAR const char *hostname);
|
||||
|
||||
/* FTP helpers */
|
||||
|
@ -81,7 +81,7 @@ typedef void (*callback_t)(FAR const char *name, FAR void *arg);
|
||||
****************************************************************************/
|
||||
|
||||
static FAR char *ftpc_abspath(FAR struct ftpc_session_s *session,
|
||||
FAR const char *relpath);
|
||||
FAR const char *relpath)
|
||||
{
|
||||
FAR char *ptr = NULL;
|
||||
int ret = OK;
|
||||
@ -101,7 +101,7 @@ static FAR char *ftpc_abspath(FAR struct ftpc_session_s *session,
|
||||
|
||||
if (relpath[1] == '\0')
|
||||
{
|
||||
return strdup(session->home);
|
||||
return strdup(session->homedir);
|
||||
}
|
||||
|
||||
/* No... then a '/' better follow the tilde */
|
||||
@ -155,7 +155,7 @@ static FAR char *ftpc_abspath(FAR struct ftpc_session_s *session,
|
||||
|
||||
static void ftpc_dircount(FAR const char *name, FAR void *arg)
|
||||
{
|
||||
unsigned int *dircount = (unsigned int *)arg;
|
||||
FAR unsigned int *dircount = (FAR unsigned int *)arg;
|
||||
(*dircount)++;
|
||||
}
|
||||
|
||||
|
@ -105,9 +105,9 @@ int ftpc_login(SESSION handle, FAR struct ftpc_login_s *login)
|
||||
|
||||
/* Save the login parameter */
|
||||
|
||||
session->uname = decode_rfc1738(login->uname);
|
||||
session->pwd = decode_rfc1738(login->pwd);
|
||||
session->initdir = decode_rfc1738(login->rdir);
|
||||
session->uname = ftpc_dequote(login->uname);
|
||||
session->pwd = ftpc_dequote(login->pwd);
|
||||
session->initdir = ftpc_dequote(login->rdir);
|
||||
|
||||
/* Is passive mode requested? */
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user