Add the commands rm and rmdir to init.

rm only removes a single non-directory directory entry (no -r support)
rmdir removes a single empty directory

Change-Id: I49702b02ba98a177027b126268c2c2846f968195
This commit is contained in:
Ken Sumrall 2011-01-18 17:37:41 -08:00
parent 108d3d74a8
commit 203bad597f
3 changed files with 16 additions and 0 deletions

View File

@ -485,6 +485,16 @@ int do_symlink(int nargs, char **args)
return symlink(args[1], args[2]);
}
int do_rm(int nargs, char **args)
{
return unlink(args[1]);
}
int do_rmdir(int nargs, char **args)
{
return rmdir(args[1]);
}
int do_sysclktz(int nargs, char **args)
{
struct timezone tz;

View File

@ -125,6 +125,8 @@ int lookup_keyword(const char *s)
break;
case 'r':
if (!strcmp(s, "estart")) return K_restart;
if (!strcmp(s, "mdir")) return K_rmdir;
if (!strcmp(s, "m")) return K_rm;
break;
case 's':
if (!strcmp(s, "ervice")) return K_service;

View File

@ -15,6 +15,8 @@ int do_import(int nargs, char **args);
int do_mkdir(int nargs, char **args);
int do_mount(int nargs, char **args);
int do_restart(int nargs, char **args);
int do_rm(int nargs, char **args);
int do_rmdir(int nargs, char **args);
int do_setkey(int nargs, char **args);
int do_setprop(int nargs, char **args);
int do_setrlimit(int nargs, char **args);
@ -59,6 +61,8 @@ enum {
KEYWORD(oneshot, OPTION, 0, 0)
KEYWORD(onrestart, OPTION, 0, 0)
KEYWORD(restart, COMMAND, 1, do_restart)
KEYWORD(rm, COMMAND, 1, do_rm)
KEYWORD(rmdir, COMMAND, 1, do_rmdir)
KEYWORD(service, SECTION, 0, 0)
KEYWORD(setenv, OPTION, 2, 0)
KEYWORD(setkey, COMMAND, 0, do_setkey)