8 a struct this for initialising the commandline options.
10 struct Long_option_init {
11 char const * take_arg_str0_;
12 char const * longname_str0_;
15 = 0: don't take short version.
19 char const * help_str0_;
21 String to_string () const;
22 String str_for_help () const;
25 static int compare (Long_option_init const&,Long_option_init const&);
26 static String table_string (Long_option_init *);
30 /** C++ for version of long_getopt. For processing GNU style command
31 line arguments. No pointer (return values, arguments) contents are
35 command - , and command --
42 const Long_option_init *option_a_;
45 /// if doing short option, arg_value_char_a_a_[optind][optindind] is processed next.
49 const Long_option_init *found_option_;
53 /** errorcodes: no error, argument expected, no argument expected,
54 unknown option, illegal argument (eg. int expected). */
55 enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
58 /// argument. Set to 0 if not present
59 char const * optional_argument_str0_;
61 /// current error status
64 /// arg_value_char_a_a_[array_index_] will be processed next.
68 char **arg_value_char_a_a_;
76 /// get ready for processing next error.
78 const Long_option_init *parselong ();
79 const Long_option_init *parseshort ();
83 /// report an error and abort
84 void report (Errorcod c);
87 /// return an integer (with err. detect)
88 long get_argument_index ();
92 What to do with errors.
93 report messages on #*os#, and abort.
94 if #os# is null, then do not report nor abort, just set #error#
97 void seterror (FILE *os);
99 /// construct: pass arguments and option info.
100 Getopt_long (int c, char **v, Long_option_init *lo);
102 /** get the next option.
103 @return pointer to next option found.
104 0 if error occurred, or next argument is no option.
106 const Long_option_init *operator () ();
108 char const *current_arg ();
109 char const * get_next_arg ();
112 #endif // GETOPT_LONG_HH