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);
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);
/* 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. */
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;
}
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;
+}