File: util_prg.h

package info (click to toggle)
s390-tools 2.40.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,288 kB
  • sloc: ansic: 187,079; sh: 12,157; cpp: 5,049; makefile: 2,812; perl: 2,541; asm: 1,097; python: 697; xml: 29
file content (58 lines) | stat: -rw-r--r-- 1,406 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
 * @defgroup util_prg_h util_prg: Program interface
 * @{
 * @brief Print standard program messages
 *
 * Copyright IBM Corp. 2016, 2017
 *
 * s390-tools is free software; you can redistribute it and/or modify
 * it under the terms of the MIT license. See LICENSE for details.
 */

#ifndef LIB_UTIL_PRG_H
#define LIB_UTIL_PRG_H

#include <err.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct util_prg_copyright {
	/** Name of the copyright owner, e.g. IBM */
	const char *owner;
	/** Year of first publishing */
	int pub_first;
	/** Year of last major changes */
	int pub_last;
};

/**
 * @brief Coypright end marker
 */
#define UTIL_PRG_COPYRIGHT_END {NULL, 0, 0}

/**
 * Program description
 */
struct util_prg {
	/** Description for help  */
	const char *desc;
	/** Command arguments in front of other options */
	const char *command_args;
	/** Positional arguments  */
	const char *args;
	/** Copyright list */
	struct util_prg_copyright copyright_vec[];
};

void util_prg_init(const struct util_prg *prg);
void util_prg_set_command(const char *command);
void util_prg_print_parse_error(void);
void util_prg_print_required_arg(const char *option);
void util_prg_print_invalid_option(const char *option);
void util_prg_print_arg_error(const char *arg_name);
void util_prg_print_version(void);
void util_prg_print_help(void);

#endif /** LIB_UTIL_PRG_H @} */