mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
Changes for clean compilation with ZDS
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1603 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/nsh/nsh_telnetd.c
|
* examples/nsh/nsh_telnetd.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* This is a leverage of similar logic from uIP:
|
* This is a leverage of similar logic from uIP:
|
||||||
@@ -284,7 +284,7 @@ static void nsh_putchar(struct telnetd_s *pstate, uint8 ch)
|
|||||||
{
|
{
|
||||||
pstate->tn_cmd[tio->tio_bufndx] = '\0';
|
pstate->tn_cmd[tio->tio_bufndx] = '\0';
|
||||||
nsh_telnetdump(&pstate->tn_vtbl, "TELNET CMD",
|
nsh_telnetdump(&pstate->tn_vtbl, "TELNET CMD",
|
||||||
pstate->tn_cmd, strlen(pstate->tn_cmd));
|
(ubyte*)pstate->tn_cmd, strlen(pstate->tn_cmd));
|
||||||
nsh_parse(&pstate->tn_vtbl, pstate->tn_cmd);
|
nsh_parse(&pstate->tn_vtbl, pstate->tn_cmd);
|
||||||
tio->tio_bufndx = 0;
|
tio->tio_bufndx = 0;
|
||||||
}
|
}
|
||||||
@@ -335,7 +335,7 @@ static void nsh_flush(FAR struct telnetd_s *pstate)
|
|||||||
if (pstate->tn_sndlen > 0)
|
if (pstate->tn_sndlen > 0)
|
||||||
{
|
{
|
||||||
nsh_telnetdump(&pstate->tn_vtbl, "Shell output",
|
nsh_telnetdump(&pstate->tn_vtbl, "Shell output",
|
||||||
pstate->tn_outbuffer, pstate->tn_sndlen);
|
(ubyte*)pstate->tn_outbuffer, pstate->tn_sndlen);
|
||||||
tio_semtake(tio); /* Only one call to send at a time */
|
tio_semtake(tio); /* Only one call to send at a time */
|
||||||
if (send(tio->tio_sockfd, pstate->tn_outbuffer, pstate->tn_sndlen, 0) < 0)
|
if (send(tio->tio_sockfd, pstate->tn_outbuffer, pstate->tn_sndlen, 0) < 0)
|
||||||
{
|
{
|
||||||
@@ -458,6 +458,7 @@ static void *nsh_connection(void *arg)
|
|||||||
{
|
{
|
||||||
struct telnetd_s *pstate = nsh_allocstruct();
|
struct telnetd_s *pstate = nsh_allocstruct();
|
||||||
struct telnetio_s *tio = (struct telnetio_s *)zalloc(sizeof(struct telnetio_s));
|
struct telnetio_s *tio = (struct telnetio_s *)zalloc(sizeof(struct telnetio_s));
|
||||||
|
struct nsh_vtbl_s *vtbl = &pstate->tn_vtbl;
|
||||||
int sockfd = (int)arg;
|
int sockfd = (int)arg;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
@@ -476,12 +477,12 @@ static void *nsh_connection(void *arg)
|
|||||||
|
|
||||||
/* Output a greeting */
|
/* Output a greeting */
|
||||||
|
|
||||||
nsh_output(&pstate->tn_vtbl, g_nshgreeting);
|
nsh_output(vtbl, g_nshgreeting);
|
||||||
|
|
||||||
/* Execute the startup script */
|
/* Execute the startup script */
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_NSH_ROMFSETC) && !defined(CONFIG_EXAMPLES_NSH_CONSOLE)
|
#if defined(CONFIG_EXAMPLES_NSH_ROMFSETC) && !defined(CONFIG_EXAMPLES_NSH_CONSOLE)
|
||||||
(void)nsh_script(&pstate->tn_vtbl, "init", NSH_INITPATH);
|
(void)nsh_script(vtbl, "init", NSH_INITPATH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Loop processing each TELNET command */
|
/* Loop processing each TELNET command */
|
||||||
@@ -490,7 +491,7 @@ static void *nsh_connection(void *arg)
|
|||||||
{
|
{
|
||||||
/* Display the prompt string */
|
/* Display the prompt string */
|
||||||
|
|
||||||
nsh_output(&pstate->tn_vtbl, g_nshprompt);
|
nsh_output(vtbl, g_nshprompt);
|
||||||
nsh_flush(pstate);
|
nsh_flush(pstate);
|
||||||
|
|
||||||
/* Read a buffer of data from the TELNET client */
|
/* Read a buffer of data from the TELNET client */
|
||||||
@@ -502,8 +503,8 @@ static void *nsh_connection(void *arg)
|
|||||||
|
|
||||||
/* Process the received TELNET data */
|
/* Process the received TELNET data */
|
||||||
|
|
||||||
nsh_telnetdump(&pstate->tn_vtbl, "Received buffer",
|
nsh_telnetdump(vtbl, "Received buffer",
|
||||||
tio->tio_inbuffer, ret);
|
(ubyte*)tio->tio_inbuffer, ret);
|
||||||
ret = nsh_receive(pstate, ret);
|
ret = nsh_receive(pstate, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -528,7 +529,7 @@ static void *nsh_connection(void *arg)
|
|||||||
|
|
||||||
dbg("[%d] Exitting\n", sockfd);
|
dbg("[%d] Exitting\n", sockfd);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
pthread_exit(NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ int tftpget(const char *remote, const char *local, in_addr_t addr, boolean binar
|
|||||||
int sd; /* Socket descriptor for socket I/O */
|
int sd; /* Socket descriptor for socket I/O */
|
||||||
int fd; /* File descriptor for file I/O */
|
int fd; /* File descriptor for file I/O */
|
||||||
int retry; /* Retry counter */
|
int retry; /* Retry counter */
|
||||||
int nbytesrecvd; /* The number of bytes received in the packet */
|
int nbytesrecvd = 0; /* The number of bytes received in the packet */
|
||||||
int ndatabytes; /* The number of data bytes received */
|
int ndatabytes; /* The number of data bytes received */
|
||||||
int result = ERROR; /* Assume failure */
|
int result = ERROR; /* Assume failure */
|
||||||
int ret; /* Generic return status */
|
int ret; /* Generic return status */
|
||||||
|
|||||||
Reference in New Issue
Block a user