Consolidate buffer dumping; fix all occurrences of 'the the'

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1951 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2009-06-25 17:44:35 +00:00
parent 72f8421e97
commit e72dce9e1b
96 changed files with 286 additions and 368 deletions
+1 -1
View File
@@ -512,7 +512,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
state = STATE_HAVE_LEASE;
}
/* NAK means the the server has refused our request. Break out of
/* NAK means the server has refused our request. Break out of
* this loop with state == STATE_HAVE_OFFER and send DISCOVER again
*/
+6 -35
View File
@@ -127,42 +127,13 @@ struct telnetd_s
****************************************************************************/
#ifdef CONFIG_NETUTILS_TELNETD_DUMPBUFFER
static void telnetd_dumpbuffer(const char *msg, const char *buffer, ssize_t nbytes)
static inline void telnetd_dumpbuffer(FAR const char *msg, FAR const char *buffer, unsigned int nbytes)
{
#ifdef CONFIG_DEBUG
char line[128];
int ch;
int i;
int j;
dbg("%s:\n", msg);
for (i = 0; i < nbytes; i += 16)
{
sprintf(line, "%04x: ", i);
for ( j = 0; j < 16; j++)
{
if (i + j < nbytes)
{
sprintf(&line[strlen(line)], "%02x ", buffer[i+j] );
}
else
{
strcpy(&line[strlen(line)], " ");
}
}
for ( j = 0; j < 16; j++)
{
if (i + j < nbytes)
{
ch = buffer[i+j];
sprintf(&line[strlen(line)], "%c", ch >= 0x20 && ch <= 0x7e ? ch : '.');
}
}
dbg("%s\n", line);
}
#endif
/* CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and CONFIG_DEBUG_NET have to be
* defined or the following does nothing.
*/
nvdbgdumpbuffer(msg, (FAR const ubyte*)buffer, nbytes);
}
#else
# define telnetd_dumpbuffer(msg,buffer,nbytes)
+1 -1
View File
@@ -161,7 +161,7 @@ extern ssize_t tftp_recvfrom(int sd, void *buf, size_t len, struct sockaddr_in *
extern ssize_t tftp_sendto(int sd, const void *buf, size_t len, struct sockaddr_in *to);
#ifdef CONFIG_NETUTILS_TFTP_DUMPBUFFERS
extern void tftp_dumpbuffer(const char *msg, ubyte *buffer, int nbytes);
# define tftp_dumpbuffer(msg, buffer, nbytes) nvdbgdumpbuffer(msg, buffer, nbytes)
#else
# define tftp_dumpbuffer(msg, buffer, nbytes)
#endif
+1 -49
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* netuils/tftp/tftpc_packets.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -326,52 +326,4 @@ ssize_t tftp_sendto(int sd, const void *buf, size_t len, struct sockaddr_in *to)
}
}
/****************************************************************************
* Name: tftp_sendto
*
* Description:
* Dump a buffer of data
*
****************************************************************************/
#ifdef CONFIG_NETUTILS_TFTP_DUMPBUFFERS
void tftp_dumpbuffer(const char *msg, ubyte *buffer, int nbytes)
{
#ifdef CONFIG_DEBUG
char line[128];
int ch;
int i;
int j;
dbg("%s:\n", msg);
for (i = 0; i < nbytes; i += 16)
{
sprintf(line, "%04x: ", i);
for ( j = 0; j < 16; j++)
{
if (i + j < nbytes)
{
sprintf(&line[strlen(line)], "%02x ", buffer[i+j] );
}
else
{
strcpy(&line[strlen(line)], " ");
}
}
for ( j = 0; j < 16; j++)
{
if (i + j < nbytes)
{
ch = buffer[i+j];
sprintf(&line[strlen(line)], "%c", ch >= 0x20 && ch <= 0x7e ? ch : '.');
}
}
dbg("%s\n", line);
}
#endif
}
#endif
#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS */
+10 -36
View File
@@ -115,42 +115,16 @@ static const char g_httpheader404[] =
****************************************************************************/
#ifdef CONFIG_NETUTILS_HTTPD_DUMPBUFFER
static void httpd_dumpbuffer(const char *buffer, ssize_t nbytes)
static void httpd_dumpbuffer(FAR const char *msg, FAR const char *buffer, unsigned int nbytes)
{
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) && defined(CONFIG_DEBUG_NET)
char line[128];
int ch;
int i;
int j;
for (i = 0; i < nbytes; i += 16)
{
sprintf(line, "%04x: ", i);
for ( j = 0; j < 16; j++)
{
if (i + j < nbytes)
{
sprintf(&line[strlen(line)], "%02x ", buffer[i+j] );
}
else
{
strcpy(&line[strlen(line)], " ");
}
}
for ( j = 0; j < 16; j++)
{
if (i + j < nbytes)
{
ch = buffer[i+j];
sprintf(&line[strlen(line)], "%c", ch >= 0x20 && ch <= 0x7e ? ch : '.');
}
}
nvdbg("%s\n", line);
}
#endif
/* CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and CONFIG_DEBUG_NET have to be
* defined or the following does nothing.
*/
nvdbgdumpbuffer(msg, (FAR const ubyte*)buffer, nbytes);
}
#else
# define httpd_dumpbuffer(buffer,nbytes)
# define httpd_dumpbuffer(msg,buffer,nbytes)
#endif
#ifdef CONFIG_NETUTILS_HTTPD_DUMPPSTATE
@@ -280,7 +254,7 @@ static int httpd_addchunk(struct httpd_state *pstate, const char *buffer, int le
{
/* The buffer is full.. Send what we have and reset to send again */
httpd_dumpbuffer(pstate->ht_buffer, newlen);
httpd_dumpbuffer("Outgoing buffer", pstate->ht_buffer, newlen);
ret = send(pstate->ht_sockfd, pstate->ht_buffer, newlen, 0);
if (ret < 0)
{
@@ -382,7 +356,7 @@ static int httpd_sendfile(struct httpd_state *pstate)
if (ret == OK && pstate->ht_sndlen > 0)
{
httpd_dumpbuffer(pstate->ht_buffer, pstate->ht_sndlen);
httpd_dumpbuffer("Outgoing buffer", pstate->ht_buffer, pstate->ht_sndlen);
if (send(pstate->ht_sockfd, pstate->ht_buffer, pstate->ht_sndlen, 0) < 0)
{
ret = ERROR;
@@ -405,7 +379,7 @@ static inline int httpd_cmd(struct httpd_state *pstate)
ndbg("[%d] recv failed: %d\n", pstate->ht_sockfd, errno);
return ERROR;
}
httpd_dumpbuffer(pstate->ht_buffer, recvlen);
httpd_dumpbuffer("Incoming buffer", pstate->ht_buffer, recvlen);
/* We will handle only GET */