mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
util_prg_example: Add --help and --version options
Add missing long options for --help and --version in util_prg_example. Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
5ef1320a7b
commit
257490366b
@@ -34,6 +34,12 @@ const struct util_prg prg = {
|
||||
}
|
||||
};
|
||||
|
||||
static const struct option opt_list[] = {
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "version", no_argument, NULL, 'v' },
|
||||
{ NULL, no_argument, NULL, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Demonstrate the util_prg_print() functions
|
||||
*/
|
||||
@@ -49,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
util_prg_init(&prg);
|
||||
|
||||
while ((opt = getopt(argc, argv, "vhe")) != -1) {
|
||||
while ((opt = getopt_long(argc, argv, "vhe", opt_list, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
util_prg_print_version();
|
||||
|
||||
Reference in New Issue
Block a user