~ubuntu-branches/ubuntu/trusty/gengetopt/trusty

« back to all changes in this revision

Viewing changes to tests/test_only_flags_cmd.h.test

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2011-09-26 10:27:31 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: package-import@ubuntu.com-20110926102731-vh42p0vriqz4kp3h
Tags: 2.22.5-1
* New upstream release:
  - correctly wraps and preprocess the specified usage string
  - handle escaped newline chars in the .ggo file correctly
  - initialize enum variables with a generated null value (makes
    the parser compilable in C++)
  - removed warnings in generated parser when only flags are used
* Fix gbp config file.
* Bump Standards.
* Drop unneeded dependency on dpkg (>= 1.15.4), stable has a newer version.
* Refresh patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file test_only_flags_cmd.h
 
2
 *  @brief The header file for the command line option parser
 
3
 *  generated by GNU Gengetopt 
 
4
 *  http://www.gnu.org/software/gengetopt.
 
5
 *  DO NOT modify this file, since it can be overwritten
 
6
 *  @author GNU Gengetopt by Lorenzo Bettini */
 
7
 
 
8
#ifndef TEST_ONLY_FLAGS_CMD_H
 
9
#define TEST_ONLY_FLAGS_CMD_H
 
10
 
 
11
/* If we use autoconf.  */
 
12
#ifdef HAVE_CONFIG_H
 
13
#include "config.h"
 
14
#endif
 
15
 
 
16
#include <stdio.h> /* for FILE */
 
17
 
 
18
#ifdef __cplusplus
 
19
extern "C" {
 
20
#endif /* __cplusplus */
 
21
 
 
22
#ifndef TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE
 
23
/** @brief the program name (used for printing errors) */
 
24
#define TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE "test_only_flags"
 
25
#endif
 
26
 
 
27
#ifndef TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE_NAME
 
28
/** @brief the complete program name (used for help and version) */
 
29
#define TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE_NAME "test_only_flags"
 
30
#endif
 
31
 
 
32
#ifndef TEST_ONLY_FLAGS_CMD_PARSER_VERSION
 
33
/** @brief the program version */
 
34
#define TEST_ONLY_FLAGS_CMD_PARSER_VERSION "1.0"
 
35
#endif
 
36
 
 
37
/** @brief Where the command line options are stored */
 
38
struct gengetopt_args_info
 
39
{
 
40
  const char *help_help; /**< @brief Print help and exit help description.  */
 
41
  const char *version_help; /**< @brief Print version and exit help description.  */
 
42
  int foo_flag; /**< @brief foo option (default=on).  */
 
43
  const char *foo_help; /**< @brief foo option help description.  */
 
44
  
 
45
  unsigned int help_given ;     /**< @brief Whether help was given.  */
 
46
  unsigned int version_given ;  /**< @brief Whether version was given.  */
 
47
  unsigned int foo_given ;      /**< @brief Whether foo was given.  */
 
48
 
 
49
  char **inputs ; /**< @brief unamed options (options without names) */
 
50
  unsigned inputs_num ; /**< @brief unamed options number */
 
51
} ;
 
52
 
 
53
/** @brief The additional parameters to pass to parser functions */
 
54
struct test_only_flags_cmd_parser_params
 
55
{
 
56
  int override; /**< @brief whether to override possibly already present options (default 0) */
 
57
  int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
 
58
  int check_required; /**< @brief whether to check that all required options were provided (default 1) */
 
59
  int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
 
60
  int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
 
61
} ;
 
62
 
 
63
/** @brief the purpose string of the program */
 
64
extern const char *gengetopt_args_info_purpose;
 
65
/** @brief the usage string of the program */
 
66
extern const char *gengetopt_args_info_usage;
 
67
/** @brief all the lines making the help output */
 
68
extern const char *gengetopt_args_info_help[];
 
69
 
 
70
/**
 
71
 * The command line parser
 
72
 * @param argc the number of command line options
 
73
 * @param argv the command line options
 
74
 * @param args_info the structure where option information will be stored
 
75
 * @return 0 if everything went fine, NON 0 if an error took place
 
76
 */
 
77
int test_only_flags_cmd_parser (int argc, char **argv,
 
78
  struct gengetopt_args_info *args_info);
 
79
 
 
80
/**
 
81
 * The command line parser (version with additional parameters - deprecated)
 
82
 * @param argc the number of command line options
 
83
 * @param argv the command line options
 
84
 * @param args_info the structure where option information will be stored
 
85
 * @param override whether to override possibly already present options
 
86
 * @param initialize whether to initialize the option structure my_args_info
 
87
 * @param check_required whether to check that all required options were provided
 
88
 * @return 0 if everything went fine, NON 0 if an error took place
 
89
 * @deprecated use test_only_flags_cmd_parser_ext() instead
 
90
 */
 
91
int test_only_flags_cmd_parser2 (int argc, char **argv,
 
92
  struct gengetopt_args_info *args_info,
 
93
  int override, int initialize, int check_required);
 
94
 
 
95
/**
 
96
 * The command line parser (version with additional parameters)
 
97
 * @param argc the number of command line options
 
98
 * @param argv the command line options
 
99
 * @param args_info the structure where option information will be stored
 
100
 * @param params additional parameters for the parser
 
101
 * @return 0 if everything went fine, NON 0 if an error took place
 
102
 */
 
103
int test_only_flags_cmd_parser_ext (int argc, char **argv,
 
104
  struct gengetopt_args_info *args_info,
 
105
  struct test_only_flags_cmd_parser_params *params);
 
106
 
 
107
/**
 
108
 * Save the contents of the option struct into an already open FILE stream.
 
109
 * @param outfile the stream where to dump options
 
110
 * @param args_info the option struct to dump
 
111
 * @return 0 if everything went fine, NON 0 if an error took place
 
112
 */
 
113
int test_only_flags_cmd_parser_dump(FILE *outfile,
 
114
  struct gengetopt_args_info *args_info);
 
115
 
 
116
/**
 
117
 * Save the contents of the option struct into a (text) file.
 
118
 * This file can be read by the config file parser (if generated by gengetopt)
 
119
 * @param filename the file where to save
 
120
 * @param args_info the option struct to save
 
121
 * @return 0 if everything went fine, NON 0 if an error took place
 
122
 */
 
123
int test_only_flags_cmd_parser_file_save(const char *filename,
 
124
  struct gengetopt_args_info *args_info);
 
125
 
 
126
/**
 
127
 * Print the help
 
128
 */
 
129
void test_only_flags_cmd_parser_print_help(void);
 
130
/**
 
131
 * Print the version
 
132
 */
 
133
void test_only_flags_cmd_parser_print_version(void);
 
134
 
 
135
/**
 
136
 * Initializes all the fields a test_only_flags_cmd_parser_params structure 
 
137
 * to their default values
 
138
 * @param params the structure to initialize
 
139
 */
 
140
void test_only_flags_cmd_parser_params_init(struct test_only_flags_cmd_parser_params *params);
 
141
 
 
142
/**
 
143
 * Allocates dynamically a test_only_flags_cmd_parser_params structure and initializes
 
144
 * all its fields to their default values
 
145
 * @return the created and initialized test_only_flags_cmd_parser_params structure
 
146
 */
 
147
struct test_only_flags_cmd_parser_params *test_only_flags_cmd_parser_params_create(void);
 
148
 
 
149
/**
 
150
 * Initializes the passed gengetopt_args_info structure's fields
 
151
 * (also set default values for options that have a default)
 
152
 * @param args_info the structure to initialize
 
153
 */
 
154
void test_only_flags_cmd_parser_init (struct gengetopt_args_info *args_info);
 
155
/**
 
156
 * Deallocates the string fields of the gengetopt_args_info structure
 
157
 * (but does not deallocate the structure itself)
 
158
 * @param args_info the structure to deallocate
 
159
 */
 
160
void test_only_flags_cmd_parser_free (struct gengetopt_args_info *args_info);
 
161
 
 
162
/**
 
163
 * Checks that all the required options were specified
 
164
 * @param args_info the structure to check
 
165
 * @param prog_name the name of the program that will be used to print
 
166
 *   possible errors
 
167
 * @return
 
168
 */
 
169
int test_only_flags_cmd_parser_required (struct gengetopt_args_info *args_info,
 
170
  const char *prog_name);
 
171
 
 
172
 
 
173
#ifdef __cplusplus
 
174
}
 
175
#endif /* __cplusplus */
 
176
#endif /* TEST_ONLY_FLAGS_CMD_H */