Add rm and rmdir commandsChangeLog
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@304 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
f0c085abec
commit
4a0697786a
@ -633,7 +633,7 @@ Other memory:
|
||||
* examples/ostest: Added an environment variable test.
|
||||
* examples/nsh/: Break into several files.
|
||||
* lib/: Added strrchr, basename, dirname
|
||||
* examples/nsh/: Add cp command
|
||||
* examples/nsh/: Add cp, rm, and rmdir commands
|
||||
* Started m68322
|
||||
</pre></ul>
|
||||
|
||||
|
@ -85,6 +85,8 @@ void cmd_mount(int argc, char **argv);
|
||||
#endif
|
||||
void cmd_ps(int argc, char **argv);
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
void cmd_rm(int argc, char **argv);
|
||||
void cmd_rmdir(int argc, char **argv);
|
||||
void cmd_umount(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
|
@ -683,6 +683,34 @@ void cmd_mount(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_rm
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
void cmd_rm(int argc, char **argv)
|
||||
{
|
||||
if (unlink(argv[1]) < 0)
|
||||
{
|
||||
printf(g_fmtcmdfailed, argv[0], "unlink", strerror(errno));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_rm
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
void cmd_rmdir(int argc, char **argv)
|
||||
{
|
||||
if (rmdir(argv[1]) < 0)
|
||||
{
|
||||
printf(g_fmtcmdfailed, argv[0], "rmdir", strerror(errno));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_umount
|
||||
****************************************************************************/
|
||||
|
@ -91,15 +91,17 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||
{ "exec", cmd_exec, 2, 3, "<hex-address>" },
|
||||
{ "help", cmd_help, 1, 1, NULL },
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
{ "ls", cmd_ls, 2, 5, "[-lRs] <path>" },
|
||||
{ "ls", cmd_ls, 2, 5, "[-lRs] <dir-path>" },
|
||||
#endif
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
{ "mkdir", cmd_mkdir, 2, 2, "<path>" },
|
||||
{ "mount", cmd_mount, 4, 5, "-t <fstype> <device> <dir>" },
|
||||
{ "mount", cmd_mount, 4, 5, "-t <fstype> <block-device> <dir-path>" },
|
||||
#endif
|
||||
{ "ps", cmd_ps, 1, 1, NULL },
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
{ "umount", cmd_umount, 2, 2, "<mountpoint-dir>" },
|
||||
{ "rm", cmd_rm, 2, 2, "<file-path>" },
|
||||
{ "rmdir", cmd_rmdir, 2, 2, "<dir-path>" },
|
||||
{ "umount", cmd_umount, 2, 2, "<dir-path>" },
|
||||
#endif
|
||||
{ NULL, NULL, 1, 1, NULL }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user