diff --git a/ChangeLog b/ChangeLog index e2081192af..246bf4ef03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -395,4 +395,5 @@ 0.3.13 2008-xx-xx Gregory Nutt * Added mkfatfs command to NSH + * Added mkfifo command to NSH diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 1f6993e4d8..a00736b20b 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -1029,6 +1029,7 @@ buildroot-0.1.0 2007-03-09 <spudmonkey@racsa.co.cr> nuttx-0.3.13 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> * Added mkfatfs command to NSH + * Added mkfifo command to NSH pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/examples/nsh/nsh.h b/examples/nsh/nsh.h index d6fdcb2976..972dc545d6 100644 --- a/examples/nsh/nsh.h +++ b/examples/nsh/nsh.h @@ -114,38 +114,41 @@ extern int nsh_serialmain(void); /* Shell command handlers */ #if CONFIG_NFILE_DESCRIPTORS > 0 -extern void cmd_cat(FAR void *handle, int argc, char **argv); -extern void cmd_cp(FAR void *handle, int argc, char **argv); + extern void cmd_cat(FAR void *handle, int argc, char **argv); + extern void cmd_cp(FAR void *handle, int argc, char **argv); #endif extern void cmd_echo(FAR void *handle, int argc, char **argv); extern void cmd_exec(FAR void *handle, int argc, char **argv); extern void cmd_exit(FAR void *handle, int argc, char **argv); #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 -extern void cmd_ifconfig(FAR void *handle, int argc, char **argv); + extern void cmd_ifconfig(FAR void *handle, int argc, char **argv); #endif #if CONFIG_NFILE_DESCRIPTORS > 0 -extern void cmd_ls(FAR void *handle, int argc, char **argv); + extern void cmd_ls(FAR void *handle, int argc, char **argv); #endif #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 -extern void cmd_mkdir(FAR void *handle, int argc, char **argv); -#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ -extern void cmd_mkfatfs(FAR void *handle, int argc, char **argv); -extern void cmd_mount(FAR void *handle, int argc, char **argv); -#endif -#endif + extern void cmd_mkdir(FAR void *handle, int argc, char **argv); +# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ + extern void cmd_mkfatfs(FAR void *handle, int argc, char **argv); +# endif /* CONFIG_FS_FAT */ + extern void cmd_mkfifo(FAR void *handle, int argc, char **argv); +# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ + extern void cmd_mount(FAR void *handle, int argc, char **argv); +# endif /* CONFIG_FS_FAT */ +#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS */ extern void cmd_ps(FAR void *handle, int argc, char **argv); #ifndef CONFIG_DISABLE_ENVIRON -extern void cmd_set(FAR void *handle, int argc, char **argv); + extern void cmd_set(FAR void *handle, int argc, char **argv); #endif #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 -extern void cmd_rm(FAR void *handle, int argc, char **argv); -extern void cmd_rmdir(FAR void *handle, int argc, char **argv); -#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ -extern void cmd_umount(FAR void *handle, int argc, char **argv); -#endif -#endif + extern void cmd_rm(FAR void *handle, int argc, char **argv); + extern void cmd_rmdir(FAR void *handle, int argc, char **argv); +# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ + extern void cmd_umount(FAR void *handle, int argc, char **argv); +# endif /* CONFIG_FS_FAT */ +#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS */ #ifndef CONFIG_DISABLE_ENVIRON -extern void cmd_unset(FAR void *handle, int argc, char **argv); + extern void cmd_unset(FAR void *handle, int argc, char **argv); #endif #endif /* __NSH_H */ diff --git a/examples/nsh/nsh_fscmds.c b/examples/nsh/nsh_fscmds.c index a1f8c2ee53..45426604f1 100644 --- a/examples/nsh/nsh_fscmds.c +++ b/examples/nsh/nsh_fscmds.c @@ -650,6 +650,21 @@ void cmd_mkfatfs(FAR void *handle, int argc, char **argv) } #endif +/**************************************************************************** + * Name: cmd_mkfifo + ****************************************************************************/ + +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +void cmd_mkfifo(FAR void *handle, int argc, char **argv) +{ + int result = mkfifo(argv[1], 0777); + if ( result < 0) + { + nsh_output(handle, g_fmtcmdfailed, argv[0], "mkfifo", NSH_ERRNO); + } +} +#endif + /**************************************************************************** * Name: cmd_mount ****************************************************************************/ diff --git a/examples/nsh/nsh_main.c b/examples/nsh/nsh_main.c index 242db6872d..cfa3df6e81 100644 --- a/examples/nsh/nsh_main.c +++ b/examples/nsh/nsh_main.c @@ -100,8 +100,11 @@ static const struct cmdmap_s g_cmdmap[] = #endif #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 { "mkdir", cmd_mkdir, 2, 2, "" }, -#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ +#ifdef CONFIG_FS_FAT { "mkfatfs", cmd_mkfatfs, 2, 2, "" }, +#endif + { "mkfifo", cmd_mkfifo, 2, 2, "" }, +#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ { "mount", cmd_mount, 4, 5, "-t " }, #endif #endif