summaryrefslogtreecommitdiff
path: root/nuttx/examples/nsh
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-12-15 19:00:40 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-12-15 19:00:40 +0000
commit08b2e5a5495fb08277274eaaf91c21069e0fbadf (patch)
tree8fd7037b0159064a937714529251eb34ec4f4e73 /nuttx/examples/nsh
parentefcfa33c1fa5728dc7c8dd9fd9f20ed7d8a0b27a (diff)
downloadpx4-nuttx-08b2e5a5495fb08277274eaaf91c21069e0fbadf.tar.gz
px4-nuttx-08b2e5a5495fb08277274eaaf91c21069e0fbadf.tar.bz2
px4-nuttx-08b2e5a5495fb08277274eaaf91c21069e0fbadf.zip
Changing NuttX fixed size type names to C99 standard names -- things will be broken for awhile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2351 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nsh')
-rw-r--r--nuttx/examples/nsh/nsh.h33
-rw-r--r--nuttx/examples/nsh/nsh_dbgcmds.c36
-rw-r--r--nuttx/examples/nsh/nsh_ddcmd.c37
-rw-r--r--nuttx/examples/nsh/nsh_envcmds.c3
-rw-r--r--nuttx/examples/nsh/nsh_fscmds.c31
-rw-r--r--nuttx/examples/nsh/nsh_main.c47
-rw-r--r--nuttx/examples/nsh/nsh_netcmds.c31
-rw-r--r--nuttx/examples/nsh/nsh_proccmds.c3
-rw-r--r--nuttx/examples/nsh/nsh_romfsetc.c3
-rw-r--r--nuttx/examples/nsh/nsh_serial.c14
-rw-r--r--nuttx/examples/nsh/nsh_telnetd.c47
11 files changed, 148 insertions, 137 deletions
diff --git a/nuttx/examples/nsh/nsh.h b/nuttx/examples/nsh/nsh.h
index 4a986a996..c7821406f 100644
--- a/nuttx/examples/nsh/nsh.h
+++ b/nuttx/examples/nsh/nsh.h
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh.h
*
- * 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>
*
* Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,11 @@
****************************************************************************/
#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
#ifdef CONFIG_EXAMPLES_NSH_CONSOLE
# include <stdio.h>
#endif
@@ -179,7 +184,7 @@
/* Size of info to be saved in call to nsh_redirect */
-#define SAVE_SIZE (sizeof(int) + sizeof(FILE*) + sizeof(boolean))
+#define SAVE_SIZE (sizeof(int) + sizeof(FILE*) + sizeof(bool))
/* Stubs used when working directory is not supported */
@@ -202,24 +207,24 @@ enum nsh_parser_e
struct nsh_state_s
{
- ubyte ns_ifcond : 1; /* Value of command in 'if' statement */
- ubyte ns_disabled : 1; /* TRUE: Unconditionally disabled */
- ubyte ns_unused : 4;
- ubyte ns_state : 2; /* Parser state (see enum nsh_parser_e) */
+ uint8_t ns_ifcond : 1; /* Value of command in 'if' statement */
+ uint8_t ns_disabled : 1; /* TRUE: Unconditionally disabled */
+ uint8_t ns_unused : 4;
+ uint8_t ns_state : 2; /* Parser state (see enum nsh_parser_e) */
};
struct nsh_parser_s
{
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
- boolean np_bg; /* TRUE: The last command executed in background */
+ bool np_bg; /* true: The last command executed in background */
#endif
- boolean np_redirect; /* TRUE: Output from the last command was re-directed */
- boolean np_fail; /* TRUE: The last command failed */
+ bool np_redirect; /* true: Output from the last command was re-directed */
+ bool np_fail; /* true: The last command failed */
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
- ubyte np_ndx; /* Current index into np_st[] */
+ uint8_t np_ndx; /* Current index into np_st[] */
#endif
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
- int np_nice; /* "nice" value applied to last background cmd */
+ int np_nice; /* "nice" value applied to last background cmd */
#endif
/* This is a stack of parser state information. It supports nested
@@ -246,8 +251,8 @@ struct nsh_vtbl_s
#endif
int (*output)(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...);
FAR char *(*linebuffer)(FAR struct nsh_vtbl_s *vtbl);
- void (*redirect)(FAR struct nsh_vtbl_s *vtbl, int fd, FAR ubyte *save);
- void (*undirect)(FAR struct nsh_vtbl_s *vtbl, FAR ubyte *save);
+ void (*redirect)(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save);
+ void (*undirect)(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save);
void (*exit)(FAR struct nsh_vtbl_s *vtbl);
/* Parser state data */
@@ -325,7 +330,7 @@ extern void nsh_freefullpath(char *relpath);
/* Debug */
extern void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
- const ubyte *buffer, ssize_t nbytes);
+ const uint8_t *buffer, ssize_t nbytes);
/* Shell command handlers */
diff --git a/nuttx/examples/nsh/nsh_dbgcmds.c b/nuttx/examples/nsh/nsh_dbgcmds.c
index 05f31e0e0..5b4b89675 100644
--- a/nuttx/examples/nsh/nsh_dbgcmds.c
+++ b/nuttx/examples/nsh/nsh_dbgcmds.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/dbg_proccmds.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
@@ -38,8 +38,10 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -57,9 +59,9 @@
struct dbgmem_s
{
- boolean dm_write; /* TRUE: perfrom write operation */
+ bool dm_write; /* true: perfrom write operation */
void *dm_addr; /* Address to access */
- uint32 dm_value; /* Value to write */
+ uint32_t dm_value; /* Value to write */
unsigned int dm_count; /* The number of bytes to access */
};
@@ -102,12 +104,12 @@ int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
return -EINVAL;
}
- mem->dm_write = TRUE;
- mem->dm_value = (uint32)lvalue;
+ mem->dm_write = true;
+ mem->dm_value = (uint32_t)lvalue;
}
else
{
- mem->dm_write = FALSE;
+ mem->dm_write = false;
mem->dm_value = 0;
}
@@ -140,7 +142,7 @@ int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
struct dbgmem_s mem;
- volatile ubyte *ptr;
+ volatile uint8_t *ptr;
int ret;
int i;
@@ -149,7 +151,7 @@ int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
/* Loop for the number of requested bytes */
- for (i = 0, ptr = (volatile ubyte*)mem.dm_addr; i < mem.dm_count; i++, ptr++)
+ for (i = 0, ptr = (volatile uint8_t*)mem.dm_addr; i < mem.dm_count; i++, ptr++)
{
/* Print the value at the address */
@@ -172,7 +174,7 @@ int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* value read might not necessarily be the value written).
*/
- *ptr = (ubyte)mem.dm_value;
+ *ptr = (uint8_t)mem.dm_value;
nsh_output(vtbl, " -> 0x%02x", *ptr);
}
@@ -193,7 +195,7 @@ int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
int cmd_mh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
struct dbgmem_s mem;
- volatile uint16 *ptr;
+ volatile uint16_t *ptr;
int ret;
int i;
@@ -202,7 +204,7 @@ int cmd_mh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
/* Loop for the number of requested bytes */
- for (i = 0, ptr = (volatile uint16*)mem.dm_addr; i < mem.dm_count; i += 2, ptr++)
+ for (i = 0, ptr = (volatile uint16_t*)mem.dm_addr; i < mem.dm_count; i += 2, ptr++)
{
/* Print the value at the address */
@@ -225,7 +227,7 @@ int cmd_mh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* value read might not necessarily be the value written).
*/
- *ptr = (uint16)mem.dm_value;
+ *ptr = (uint16_t)mem.dm_value;
nsh_output(vtbl, " -> 0x%04x", *ptr);
}
@@ -246,7 +248,7 @@ int cmd_mh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
int cmd_mw(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
struct dbgmem_s mem;
- volatile uint32 *ptr;
+ volatile uint32_t *ptr;
int ret;
int i;
@@ -255,7 +257,7 @@ int cmd_mw(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
/* Loop for the number of requested bytes */
- for (i = 0, ptr = (volatile uint32*)mem.dm_addr; i < mem.dm_count; i += 4, ptr++)
+ for (i = 0, ptr = (volatile uint32_t*)mem.dm_addr; i < mem.dm_count; i += 4, ptr++)
{
/* Print the value at the address */
@@ -312,7 +314,7 @@ int cmd_mem(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
****************************************************************************/
void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
- const ubyte *buffer, ssize_t nbytes)
+ const uint8_t *buffer, ssize_t nbytes)
{
char line[128];
int ch;
@@ -371,7 +373,7 @@ int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ERROR;
}
- nsh_dumpbuffer(vtbl, "Hex dump", (ubyte*)addr, nbytes);
+ nsh_dumpbuffer(vtbl, "Hex dump", (uint8_t*)addr, nbytes);
return OK;
}
#endif
diff --git a/nuttx/examples/nsh/nsh_ddcmd.c b/nuttx/examples/nsh/nsh_ddcmd.c
index 1fe3d5485..d0457cbaa 100644
--- a/nuttx/examples/nsh/nsh_ddcmd.c
+++ b/nuttx/examples/nsh/nsh_ddcmd.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh_ddcmd.c
*
- * Copyright (C) 2008, 2009 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
@@ -41,7 +41,8 @@
#include <sys/types.h>
#include <sys/stat.h>
-
+#include <stdint.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
@@ -119,16 +120,16 @@ struct dd_s
int fd; /* File descriptor of the character device */
} outf;
#else
- int outfd; /* File descriptor of the output device */
+ int outfd; /* File descriptor of the output device */
#endif
- uint32 nsectors; /* Number of sectors to transfer */
- uint32 sector; /* The current sector number */
- uint32 skip; /* The number of sectors skipped on input */
- boolean eof; /* TRUE: The of the input or output file has been hit */
- uint16 sectsize; /* Size of one sector */
- uint16 nbytes; /* Number of valid bytes in the buffer */
- ubyte *buffer; /* Buffer of data to write to the output file */
+ uint32_t nsectors; /* Number of sectors to transfer */
+ uint32_t sector; /* The current sector number */
+ uint32_t skip; /* The number of sectors skipped on input */
+ bool eof; /* true: The of the input or output file has been hit */
+ uint16_t sectsize; /* Size of one sector */
+ uint16_t nbytes; /* Number of valid bytes in the buffer */
+ uint8_t *buffer; /* Buffer of data to write to the output file */
/* Function pointers to handle differences between block and character devices */
@@ -220,7 +221,7 @@ static int dd_writeblk(struct dd_s *dd)
if (nbytes == -EFBIG)
{
- dd->eof = TRUE; /* Set end-of-file */
+ dd->eof = true; /* Set end-of-file */
}
else
{
@@ -240,8 +241,8 @@ static int dd_writeblk(struct dd_s *dd)
static int dd_writech(struct dd_s *dd)
{
- ubyte *buffer = dd->buffer;
- uint16 written ;
+ uint8_t *buffer = dd->buffer;
+ uint16_t written ;
ssize_t nbytes;
/* Is the out buffer full (or is this the last one)? */
@@ -297,7 +298,7 @@ static int dd_readblk(struct dd_s *dd)
static int dd_readch(struct dd_s *dd)
{
- ubyte *buffer = dd->buffer;
+ uint8_t *buffer = dd->buffer;
ssize_t nbytes;
dd->nbytes = 0;
@@ -338,7 +339,7 @@ static int dd_filetype(const char *filename)
return ERROR; /* Return -1 on failure */
}
- return S_ISBLK(sb.st_mode); /* Return TRUE(1) if block, FALSE(0) if char */
+ return S_ISBLK(sb.st_mode); /* Return true(1) if block, false(0) if char */
}
#endif
@@ -378,7 +379,7 @@ static inline int dd_infopen(const char *name, struct dd_s *dd)
}
else
{
- ret = bchlib_setup(name, TRUE, &DD_INHANDLE);
+ ret = bchlib_setup(name, true, &DD_INHANDLE);
if (ret < 0)
{
return ERROR;
@@ -419,9 +420,9 @@ static inline int dd_outfopen(const char *name, struct dd_s *dd)
/* Open the block driver for input */
- if (type == TRUE)
+ if (type == true)
{
- ret = bchlib_setup(name, TRUE, &DD_OUTHANDLE);
+ ret = bchlib_setup(name, true, &DD_OUTHANDLE);
if (ret < 0)
{
return ERROR;
diff --git a/nuttx/examples/nsh/nsh_envcmds.c b/nuttx/examples/nsh/nsh_envcmds.c
index b0d714550..1c701e46d 100644
--- a/nuttx/examples/nsh/nsh_envcmds.c
+++ b/nuttx/examples/nsh/nsh_envcmds.c
@@ -1,7 +1,7 @@
/****************************************************************************
* nsh_envcmds.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>
*
* Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/nuttx/examples/nsh/nsh_fscmds.c b/nuttx/examples/nsh/nsh_fscmds.c
index 5b51a4db0..f61b084e2 100644
--- a/nuttx/examples/nsh/nsh_fscmds.c
+++ b/nuttx/examples/nsh/nsh_fscmds.c
@@ -38,7 +38,10 @@
****************************************************************************/
#include <nuttx/config.h>
+
#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
#if CONFIG_NFILE_DESCRIPTORS > 0
# include <sys/stat.h>
@@ -655,13 +658,13 @@ errout:
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP
int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
- char *loopdev = NULL;
- char *filepath = NULL;
- boolean teardown = FALSE;
- boolean readonly = FALSE;
- off_t offset = 0;
- int ret = ERROR;
- int option;
+ char *loopdev = NULL;
+ char *filepath = NULL;
+ bool teardown = false;
+ bool readonly = false;
+ off_t offset = 0;
+ int ret = ERROR;
+ int option;
/* Get the losetup options: Two forms are supported:
*
@@ -678,7 +681,7 @@ int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
case 'd':
loopdev = nsh_getfullpath(vtbl, optarg);
- teardown = TRUE;
+ teardown = true;
break;
case 'o':
@@ -686,7 +689,7 @@ int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
break;
case 'r':
- readonly = TRUE;
+ readonly = true;
break;
case '?':
@@ -938,8 +941,8 @@ int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
const char *fmt;
- ubyte *buffer;
- uint32 nsectors;
+ uint8_t *buffer;
+ uint32_t nsectors;
int sectsize = 512;
int minor = 0;
int ret;
@@ -984,7 +987,7 @@ int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
if (optind == argc-1)
{
- nsectors = (uint32)atoi(argv[optind]);
+ nsectors = (uint32_t)atoi(argv[optind]);
}
else if (optind >= argc)
{
@@ -999,7 +1002,7 @@ int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* Allocate the memory backing up the ramdisk */
- buffer = (ubyte*)malloc(sectsize * nsectors);
+ buffer = (uint8_t*)malloc(sectsize * nsectors);
if (!buffer)
{
fmt = g_fmtcmdoutofmemory;
@@ -1013,7 +1016,7 @@ int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* Then register the ramdisk */
- ret = ramdisk_register(minor, buffer, nsectors, sectsize, TRUE);
+ ret = ramdisk_register(minor, buffer, nsectors, sectsize, true);
if (ret < 0)
{
nsh_output(vtbl, g_fmtcmdfailed, argv[0], "ramdisk_register", NSH_ERRNO_OF(-ret));
diff --git a/nuttx/examples/nsh/nsh_main.c b/nuttx/examples/nsh/nsh_main.c
index 53e7d5efd..f41d2e450 100644
--- a/nuttx/examples/nsh/nsh_main.c
+++ b/nuttx/examples/nsh/nsh_main.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh_main.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>
*
* Redistribution and use in source and binary forms, with or without
@@ -38,9 +38,10 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <sys/stat.h>
+#include <stdint.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -92,8 +93,8 @@ struct cmdmap_s
{
const char *cmd; /* Name of the command */
cmd_t handler; /* Function that handles the command */
- ubyte minargs; /* Minimum number of arguments (including command) */
- ubyte maxargs; /* Maximum number of arguments (including command) */
+ uint8_t minargs; /* Minimum number of arguments (including command) */
+ uint8_t maxargs; /* Maximum number of arguments (including command) */
const char *usage; /* Usage instructions for 'help' command */
};
@@ -574,7 +575,7 @@ char *nsh_argument(FAR struct nsh_vtbl_s *vtbl, char **saveptr)
char *pend = NULL;
const char *term;
#ifndef CONFIG_DISABLE_ENVIRON
- boolean quoted = FALSE;
+ bool quoted = false;
#endif
/* Find the beginning of the next token */
@@ -632,7 +633,7 @@ char *nsh_argument(FAR struct nsh_vtbl_s *vtbl, char **saveptr)
pbegin++;
term = "\"";
#ifndef CONFIG_DISABLE_ENVIRON
- quoted = TRUE;
+ quoted = true;
#endif
}
else
@@ -710,10 +711,10 @@ char *nsh_argument(FAR struct nsh_vtbl_s *vtbl, char **saveptr)
****************************************************************************/
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
-static inline boolean nsh_cmdenabled(FAR struct nsh_vtbl_s *vtbl)
+static inline bool nsh_cmdenabled(FAR struct nsh_vtbl_s *vtbl)
{
struct nsh_parser_s *np = &vtbl->np;
- boolean ret = !np->np_st[np->np_ndx].ns_disabled;
+ bool ret = !np->np_st[np->np_ndx].ns_disabled;
if (ret)
{
switch (np->np_st[np->np_ndx].ns_state)
@@ -745,7 +746,7 @@ static inline int nsh_ifthenelse(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
{
struct nsh_parser_s *np = &vtbl->np;
FAR char *cmd = *ppcmd;
- boolean disabled;
+ bool disabled;
if (cmd)
{
@@ -786,7 +787,7 @@ static inline int nsh_ifthenelse(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
np->np_ndx++;
np->np_st[np->np_ndx].ns_state = NSH_PARSER_IF;
np->np_st[np->np_ndx].ns_disabled = disabled;
- np->np_st[np->np_ndx].ns_ifcond = FALSE;
+ np->np_st[np->np_ndx].ns_ifcond = false;
}
else if (strcmp(cmd, "then") == 0)
{
@@ -869,8 +870,8 @@ static inline int nsh_ifthenelse(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
errout:
np->np_ndx = 0;
np->np_st[0].ns_state = NSH_PARSER_NORMAL;
- np->np_st[0].ns_disabled = FALSE;
- np->np_st[0].ns_ifcond = FALSE;
+ np->np_st[0].ns_disabled = false;
+ np->np_st[0].ns_ifcond = false;
return ERROR;
}
#endif
@@ -879,14 +880,14 @@ errout:
* Name: nsh_saveresult
****************************************************************************/
-static inline int nsh_saveresult(FAR struct nsh_vtbl_s *vtbl, boolean result)
+static inline int nsh_saveresult(FAR struct nsh_vtbl_s *vtbl, bool result)
{
struct nsh_parser_s *np = &vtbl->np;
#ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT
if (np->np_st[np->np_ndx].ns_state == NSH_PARSER_IF)
{
- np->np_fail = FALSE;
+ np->np_fail = false;
np->np_st[np->np_ndx].ns_ifcond = result;
return OK;
}
@@ -1041,9 +1042,9 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
memset(argv, 0, MAX_ARGV_ENTRIES*sizeof(FAR char *));
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
- vtbl->np.np_bg = FALSE;
+ vtbl->np.np_bg = false;
#endif
- vtbl->np.np_redirect = FALSE;
+ vtbl->np.np_redirect = false;
/* Parse out the command at the beginning of the line */
@@ -1115,7 +1116,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
if (argc > 1 && strcmp(argv[argc-1], "&") == 0)
{
- vtbl->np.np_bg = TRUE;
+ vtbl->np.np_bg = true;
argv[argc-1] = NULL;
argc--;
}
@@ -1129,7 +1130,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
if (strcmp(argv[argc-2], g_redirect1) == 0)
{
- vtbl->np.np_redirect = TRUE;
+ vtbl->np.np_redirect = true;
oflags = O_WRONLY|O_CREAT|O_TRUNC;
redirfile = nsh_getfullpath(vtbl, argv[argc-1]);
argc -= 2;
@@ -1139,7 +1140,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
else if (strcmp(argv[argc-2], g_redirect2) == 0)
{
- vtbl->np.np_redirect = TRUE;
+ vtbl->np.np_redirect = true;
oflags = O_WRONLY|O_CREAT|O_APPEND;
redirfile = nsh_getfullpath(vtbl, argv[argc-1]);
argc -= 2;
@@ -1268,7 +1269,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
else
#endif
{
- ubyte save[SAVE_SIZE];
+ uint8_t save[SAVE_SIZE];
/* Handle redirection of output via a file descriptor */
@@ -1302,7 +1303,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
* command task succeeded).
*/
- return nsh_saveresult(vtbl, FALSE);
+ return nsh_saveresult(vtbl, false);
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
errout_with_redirect:
@@ -1312,5 +1313,5 @@ errout_with_redirect:
}
#endif
errout:
- return nsh_saveresult(vtbl, TRUE);
+ return nsh_saveresult(vtbl, true);
}
diff --git a/nuttx/examples/nsh/nsh_netcmds.c b/nuttx/examples/nsh/nsh_netcmds.c
index 27ab06421..306ab8232 100644
--- a/nuttx/examples/nsh/nsh_netcmds.c
+++ b/nuttx/examples/nsh/nsh_netcmds.c
@@ -40,8 +40,9 @@
#include <nuttx/config.h>
#ifdef CONFIG_NET
-#include <sys/types.h>
#include <sys/stat.h> /* Needed for open */
+#include <stdint.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -94,8 +95,8 @@
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
struct tftpc_args_s
{
- boolean binary; /* TRUE:binary ("octect") FALSE:text ("netascii") */
- boolean allocated; /* TRUE: destpath is allocated */
+ bool binary; /* true:binary ("octect") false:text ("netascii") */
+ bool allocated; /* true: destpath is allocated */
char *destpath; /* Path at destination */
const char *srcpath; /* Path at src */
in_addr_t ipaddr; /* Host IP address */
@@ -112,7 +113,7 @@ struct tftpc_args_s
#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) && \
!defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_DISABLE_SIGNALS)
-static uint16 g_pingid = 0;
+static uint16_t g_pingid = 0;
#endif
/****************************************************************************
@@ -129,10 +130,10 @@ static uint16 g_pingid = 0;
#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) && \
!defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_DISABLE_SIGNALS)
-static inline uint16 ping_newid(void)
+static inline uint16_t ping_newid(void)
{
irqstate_t save = irqsave();
- uint16 ret = ++g_pingid;
+ uint16_t ret = ++g_pingid;
irqrestore(save);
return ret;
}
@@ -290,11 +291,11 @@ int tftpc_parseargs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
switch (option)
{
case 'b':
- args->binary = TRUE;
+ args->binary = true;
break;
case 'n':
- args->binary = FALSE;
+ args->binary = false;
break;
case 'f':
@@ -378,7 +379,7 @@ int tftpc_parseargs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
{
goto errout;
}
- args->allocated = TRUE;
+ args->allocated = true;
}
return OK;
@@ -473,14 +474,14 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
FAR const char *fmt = g_fmtarginvalid;
const char *staddr;
uip_ipaddr_t ipaddr;
- uint32 start;
- uint32 next;
- uint32 dsec = 10;
- uint16 id;
- int count = 10;
+ uint32_t start;
+ uint32_t next;
+ uint32_t dsec = 10;
+ uint16_t id;
+ int count = 10;
int option;
int seqno;
- int replies = 0;
+ int replies = 0;
int elapsed;
int tmp;
int i;
diff --git a/nuttx/examples/nsh/nsh_proccmds.c b/nuttx/examples/nsh/nsh_proccmds.c
index abf0dc66c..6c0c14e37 100644
--- a/nuttx/examples/nsh/nsh_proccmds.c
+++ b/nuttx/examples/nsh/nsh_proccmds.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh_proccmds.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>
*
* Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/nuttx/examples/nsh/nsh_romfsetc.c b/nuttx/examples/nsh/nsh_romfsetc.c
index 0370a00bb..80ebdd584 100644
--- a/nuttx/examples/nsh/nsh_romfsetc.c
+++ b/nuttx/examples/nsh/nsh_romfsetc.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh_romfsetc.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
@@ -39,7 +39,6 @@
#include <nuttx/config.h>
-#include <sys/types.h>
#include <sys/mount.h>
#include <debug.h>
#include <errno.h>
diff --git a/nuttx/examples/nsh/nsh_serial.c b/nuttx/examples/nsh/nsh_serial.c
index fe5fac93b..1f76de533 100644
--- a/nuttx/examples/nsh/nsh_serial.c
+++ b/nuttx/examples/nsh/nsh_serial.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh_serial.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>
*
* Redistribution and use in source and binary forms, with or without
@@ -38,8 +38,8 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -49,7 +49,7 @@
#include "nsh.h"
/****************************************************************************
- * Definitions
+ * Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@@ -80,8 +80,8 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl);
#endif
static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...);
static FAR char *nsh_consolelinebuffer(FAR struct nsh_vtbl_s *vtbl);
-static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR ubyte *save);
-static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, FAR ubyte *save);
+static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save);
+static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save);
static void nsh_consoleexit(FAR struct nsh_vtbl_s *vtbl);
/****************************************************************************
@@ -269,7 +269,7 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl)
*
****************************************************************************/
-static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR ubyte *save)
+static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save)
{
FAR struct serial_s *pstate = (FAR struct serial_s *)vtbl;
FAR struct serialsave_s *ssave = (FAR struct serialsave_s *)save;
@@ -298,7 +298,7 @@ static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR ubyte *
*
****************************************************************************/
-static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, FAR ubyte *save)
+static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save)
{
FAR struct serial_s *pstate = (FAR struct serial_s *)vtbl;
FAR struct serialsave_s *ssave = (FAR struct serialsave_s *)save;
diff --git a/nuttx/examples/nsh/nsh_telnetd.c b/nuttx/examples/nsh/nsh_telnetd.c
index 57d0e7ac6..a3eb4965d 100644
--- a/nuttx/examples/nsh/nsh_telnetd.c
+++ b/nuttx/examples/nsh/nsh_telnetd.c
@@ -44,7 +44,8 @@
#include <sys/types.h>
#include <sys/socket.h>
-
+#include <stdint.h>
+#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -96,11 +97,11 @@
struct telnetio_s
{
- sem_t tio_sem;
- int tio_sockfd;
- uint8 tio_bufndx;
- uint8 tio_state;
- char tio_inbuffer[CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE];
+ sem_t tio_sem;
+ int tio_sockfd;
+ uint8_t tio_bufndx;
+ uint8_t tio_state;
+ char tio_inbuffer[CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE];
};
struct redirect_s
@@ -111,7 +112,7 @@ struct redirect_s
struct telnetsave_s
{
- boolean ts_redirected;
+ bool ts_redirected;
union
{
struct telnetio_s *tn;
@@ -122,8 +123,8 @@ struct telnetsave_s
struct telnetd_s
{
struct nsh_vtbl_s tn_vtbl;
- uint16 tn_sndlen;
- boolean tn_redirected;
+ uint16_t tn_sndlen;
+ bool tn_redirected;
union
{
struct telnetio_s *tn;
@@ -145,8 +146,8 @@ static void nsh_telnetrelease(FAR struct nsh_vtbl_s *vtbl);
static int nsh_telnetoutput(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...);
static int nsh_redirectoutput(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...);
static FAR char *nsh_telnetlinebuffer(FAR struct nsh_vtbl_s *vtbl);
-static void nsh_telnetredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR ubyte *save);
-static void nsh_telnetundirect(FAR struct nsh_vtbl_s *vtbl, FAR ubyte *save);
+static void nsh_telnetredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save);
+static void nsh_telnetundirect(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save);
static void nsh_telnetexit(FAR struct nsh_vtbl_s *vtbl);
/****************************************************************************
@@ -263,7 +264,7 @@ static void nsh_closeifnotclosed(struct telnetd_s *pstate)
*
****************************************************************************/
-static void nsh_putchar(struct telnetd_s *pstate, uint8 ch)
+static void nsh_putchar(struct telnetd_s *pstate, uint8_t ch)
{
struct telnetio_s *tio = pstate->u.tn;
@@ -284,7 +285,7 @@ static void nsh_putchar(struct telnetd_s *pstate, uint8 ch)
{
pstate->tn_cmd[tio->tio_bufndx] = '\0';
nsh_telnetdump(&pstate->tn_vtbl, "TELNET CMD",
- (ubyte*)pstate->tn_cmd, strlen(pstate->tn_cmd));
+ (uint8_t*)pstate->tn_cmd, strlen(pstate->tn_cmd));
nsh_parse(&pstate->tn_vtbl, pstate->tn_cmd);
tio->tio_bufndx = 0;
}
@@ -302,10 +303,10 @@ static void nsh_putchar(struct telnetd_s *pstate, uint8 ch)
*
****************************************************************************/
-static void nsh_sendopt(struct telnetd_s *pstate, uint8 option, uint8 value)
+static void nsh_sendopt(struct telnetd_s *pstate, uint8_t option, uint8_t value)
{
struct telnetio_s *tio = pstate->u.tn;
- uint8 optbuf[4];
+ uint8_t optbuf[4];
optbuf[0] = TELNET_IAC;
optbuf[1] = option;
optbuf[2] = value;
@@ -335,7 +336,7 @@ static void nsh_flush(FAR struct telnetd_s *pstate)
if (pstate->tn_sndlen > 0)
{
nsh_telnetdump(&pstate->tn_vtbl, "Shell output",
- (ubyte*)pstate->tn_outbuffer, pstate->tn_sndlen);
+ (uint8_t*)pstate->tn_outbuffer, pstate->tn_sndlen);
tio_semtake(tio); /* Only one call to send at a time */
if (send(tio->tio_sockfd, pstate->tn_outbuffer, pstate->tn_sndlen, 0) < 0)
{
@@ -358,7 +359,7 @@ static int nsh_receive(struct telnetd_s *pstate, size_t len)
{
struct telnetio_s *tio = pstate->u.tn;
char *ptr = tio->tio_inbuffer;
- uint8 ch;
+ uint8_t ch;
while (len > 0)
{
@@ -504,7 +505,7 @@ static void *nsh_connection(void *arg)
/* Process the received TELNET data */
nsh_telnetdump(vtbl, "Received buffer",
- (ubyte*)tio->tio_inbuffer, ret);
+ (uint8_t*)tio->tio_inbuffer, ret);
ret = nsh_receive(pstate, ret);
}
}
@@ -655,7 +656,7 @@ static FAR struct nsh_vtbl_s *nsh_telnetclone(FAR struct nsh_vtbl_s *vtbl)
{
if (pstate->tn_redirected)
{
- pclone->tn_redirected = TRUE;
+ pclone->tn_redirected = true;
pclone->tn_vtbl.output = nsh_redirectoutput;
pclone->u.rd.rd_fd = pstate->u.rd.rd_fd;
pclone->u.rd.rd_stream = NULL;
@@ -703,7 +704,7 @@ static void nsh_telnetrelease(FAR struct nsh_vtbl_s *vtbl)
*
****************************************************************************/
-static void nsh_telnetredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR ubyte *save)
+static void nsh_telnetredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save)
{
FAR struct telnetd_s *pstate = (FAR struct telnetd_s *)vtbl;
FAR struct telnetsave_s *ssave = (FAR struct telnetsave_s *)save;
@@ -724,7 +725,7 @@ static void nsh_telnetredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR ubyte *s
memcpy(&ssave->u.rd, &pstate->u.rd, sizeof(struct redirect_s));
}
- pstate->tn_redirected = TRUE;
+ pstate->tn_redirected = true;
pstate->u.rd.rd_fd = fd;
pstate->u.rd.rd_stream = NULL;
}
@@ -737,7 +738,7 @@ static void nsh_telnetredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR ubyte *s
*
****************************************************************************/
-static void nsh_telnetundirect(FAR struct nsh_vtbl_s *vtbl, FAR ubyte *save)
+static void nsh_telnetundirect(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save)
{
FAR struct telnetd_s *pstate = (FAR struct telnetd_s *)vtbl;
FAR struct telnetsave_s *ssave = (FAR struct telnetsave_s *)save;
@@ -782,7 +783,7 @@ int nsh_telnetmain(int argc, char *argv[])
{
struct in_addr addr;
#if defined(CONFIG_EXAMPLES_NSH_DHCPC) || defined(CONFIG_EXAMPLES_NSH_NOMAC)
- uint8 mac[IFHWADDRLEN];
+ uint8_t mac[IFHWADDRLEN];
#endif
/* Many embedded network interfaces must have a software assigned MAC */