Browse Source

Added "clear" command

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
240c9512bb
1 changed files with 30 additions and 0 deletions
  1. 30
    0
      src/commandline/commands/nvo_cmd.c

+ 30
- 0
src/commandline/commands/nvo_cmd.c View File

@@ -79,3 +79,33 @@ struct command set_command __command = {
79 79
 	.name = "set",
80 80
 	.exec = set_exec,
81 81
 };
82
+
83
+static int clear_exec ( int argc, char **argv ) {
84
+	struct config_context dummy_context;
85
+	int rc;
86
+
87
+	if ( ! ugly_nvo_hack ) {
88
+		printf ( "No non-volatile option storage available\n" );
89
+		return 1;
90
+	}
91
+
92
+	if ( argc != 2 ) {
93
+		printf ( "Syntax: %s <identifier>\n",
94
+			 argv[0] );
95
+		return 1;
96
+	}
97
+
98
+	dummy_context.options = ugly_nvo_hack->options;
99
+	if ( ( rc = clear_setting ( &dummy_context, argv[1] ) ) != 0 ) {
100
+		printf ( "Could not clear \"%s\": %s\n",
101
+			 argv[1], strerror ( -rc ) );
102
+		return 1;
103
+	}
104
+	
105
+	return 0;
106
+}
107
+
108
+struct command clear_command __command = {
109
+	.name = "clear",
110
+	.exec = clear_exec,
111
+};

Loading…
Cancel
Save