X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=hivex%2Fhivexsh.c;h=00f33ae8fc4e97ba183a32293182f9fb6d34b21a;hb=982b00ba7ba1ef69ffc09cbbce7ea69aef48bcd4;hp=1bd3b8be8d68d53d9fd2fbd618ade45622aaa77b;hpb=56e3b1c8b234dbde84e092e3edc654913f6410b2;p=hivex.git diff --git a/hivex/hivexsh.c b/hivex/hivexsh.c index 1bd3b8b..00f33ae 100644 --- a/hivex/hivexsh.c +++ b/hivex/hivexsh.c @@ -76,6 +76,7 @@ static char *rl_gets (const char *prompt_string); static void sort_strings (char **strings, int len); static int get_xdigit (char c); static int dispatch (char *cmd, char *args); +static int cmd_add (char *name); static int cmd_cd (char *path); static int cmd_close (char *path); static int cmd_commit (char *path); @@ -411,7 +412,9 @@ dispatch (char *cmd, char *args) return -1; } - if (STRCASEEQ (cmd, "cd")) + if (STRCASEEQ (cmd, "add")) + return cmd_add (args); + else if (STRCASEEQ (cmd, "cd")) return cmd_cd (args); else if (STRCASEEQ (cmd, "close") || STRCASEEQ (cmd, "unload")) return cmd_close (args); @@ -855,7 +858,6 @@ cmd_setval (char *nrvals_str) /* Read nrvals * 2 lines of input, nrvals * (key, value) pairs, as * explained in the man page. */ - int prompt = isatty (0) ? 2 : 0; int i, j; for (i = 0; i < nrvals; ++i) { /* Read key. */ @@ -1069,7 +1071,7 @@ cmd_del (char *args) hive_node_h new_cwd = hivex_node_parent (h, cwd); if (hivex_node_delete_child (h, cwd) == -1) { - perror ("del"); + perror ("hivexsh: del"); return -1; } @@ -1077,3 +1079,14 @@ cmd_del (char *args) set_prompt_string (); return 0; } + +static int +cmd_add (char *name) +{ + hive_node_h node = hivex_node_add_child (h, cwd, name); + if (node == 0) { + perror ("hivexsh: add"); + return -1; + } + return 0; +}