Added mkfifo command to NSH

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@812 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-08-10 19:16:39 +00:00
parent 75ec13c73e
commit ffbd312fe1
5 changed files with 42 additions and 19 deletions

View File

@ -395,4 +395,5 @@
0.3.13 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
* Added mkfatfs command to NSH
* Added mkfifo command to NSH

View File

@ -1029,6 +1029,7 @@ buildroot-0.1.0 2007-03-09 &lt;spudmonkey@racsa.co.cr&gt
nuttx-0.3.13 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* Added mkfatfs command to NSH
* Added mkfifo command to NSH
pascal-0.1.3 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;

View File

@ -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 */

View File

@ -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
****************************************************************************/

View File

@ -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, "<path>" },
#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
#ifdef CONFIG_FS_FAT
{ "mkfatfs", cmd_mkfatfs, 2, 2, "<path>" },
#endif
{ "mkfifo", cmd_mkfifo, 2, 2, "<path>" },
#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
{ "mount", cmd_mount, 4, 5, "-t <fstype> <block-device> <dir-path>" },
#endif
#endif