#include <stdint.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <errno.h>#include <getopt.h>#include <gpxe/settings.h>#include <gpxe/command.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static int | show_exec (int argc, char **argv) |
| static int | set_exec (int argc, char **argv) |
| static int | clear_exec (int argc, char **argv) |
Variables | |
| struct command nvo_commands[] | __command |
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static int show_exec | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 12 of file nvo_cmd.c.
References fetchf_named_setting(), printf(), and strerror().
00012 { 00013 char buf[256]; 00014 int rc; 00015 00016 if ( argc != 2 ) { 00017 printf ( "Syntax: %s <identifier>\n", argv[0] ); 00018 return 1; 00019 } 00020 00021 if ( ( rc = fetchf_named_setting ( argv[1], buf, 00022 sizeof ( buf ) ) ) < 0 ){ 00023 printf ( "Could not find \"%s\": %s\n", 00024 argv[1], strerror ( rc ) ); 00025 return 1; 00026 } 00027 00028 printf ( "%s = %s\n", argv[1], buf ); 00029 return 0; 00030 }
| static int set_exec | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 32 of file nvo_cmd.c.
References printf(), storef_named_setting(), and strerror().
00032 { 00033 int rc; 00034 00035 if ( argc != 3 ) { 00036 printf ( "Syntax: %s <identifier> <value>\n", argv[0] ); 00037 return 1; 00038 } 00039 00040 if ( ( rc = storef_named_setting ( argv[1], argv[2] ) ) != 0 ) { 00041 printf ( "Could not set \"%s\"=\"%s\": %s\n", 00042 argv[1], argv[2], strerror ( rc ) ); 00043 return 1; 00044 } 00045 00046 return 0; 00047 }
| static int clear_exec | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 49 of file nvo_cmd.c.
References delete_named_setting(), printf(), and strerror().
00049 { 00050 int rc; 00051 00052 if ( argc != 2 ) { 00053 printf ( "Syntax: %s <identifier>\n", argv[0] ); 00054 return 1; 00055 } 00056 00057 if ( ( rc = delete_named_setting ( argv[1] ) ) != 0 ) { 00058 printf ( "Could not clear \"%s\": %s\n", 00059 argv[1], strerror ( rc ) ); 00060 return 1; 00061 } 00062 00063 return 0; 00064 }
Initial value:
{
{
.name = "show",
.exec = show_exec,
},
{
.name = "set",
.exec = set_exec,
},
{
.name = "clear",
.exec = clear_exec,
},
}
1.5.7.1