}
dummy_context.options = ugly_nvo_hack->options;
- if ( ( rc = show_setting ( &dummy_context, argv[1], buf,
- sizeof ( buf ) ) ) != 0 ) {
+ if ( ( rc = show_named_setting ( &dummy_context, argv[1], buf,
+ sizeof ( buf ) ) ) != 0 ) {
printf ( "Could not find \"%s\": %s\n",
argv[1], strerror ( -rc ) );
return 1;
return 0;
}
-struct command show_command __command = {
- .name = "show",
- .exec = show_exec,
-};
-
static int set_exec ( int argc, char **argv ) {
struct config_context dummy_context;
int rc;
}
dummy_context.options = ugly_nvo_hack->options;
- if ( ( rc = set_setting ( &dummy_context, argv[1], argv[2] ) ) != 0 ) {
+ if ( ( rc = set_named_setting ( &dummy_context, argv[1],
+ argv[2] ) ) != 0 ) {
printf ( "Could not set \"%s\"=\"%s\": %s\n",
argv[1], argv[2], strerror ( -rc ) );
return 1;
return 0;
}
-struct command set_command __command = {
- .name = "set",
- .exec = set_exec,
-};
-
static int clear_exec ( int argc, char **argv ) {
struct config_context dummy_context;
int rc;
}
dummy_context.options = ugly_nvo_hack->options;
- if ( ( rc = clear_setting ( &dummy_context, argv[1] ) ) != 0 ) {
+ if ( ( rc = clear_named_setting ( &dummy_context, argv[1] ) ) != 0 ) {
printf ( "Could not clear \"%s\": %s\n",
argv[1], strerror ( -rc ) );
return 1;
return 0;
}
-struct command clear_command __command = {
- .name = "clear",
- .exec = clear_exec,
+struct command nvo_commands[] __command = {
+ {
+ .name = "show",
+ .exec = show_exec,
+ },
+ {
+ .name = "set",
+ .exec = set_exec,
+ },
+ {
+ .name = "clear",
+ .exec = clear_exec,
+ },
};