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 char const * help_str0_;
17 String to_string () const;
18 String str_for_help () const;
21 static int compare (Long_option_init const&,Long_option_init const&);
22 static String table_string (Long_option_init *);
26 /** C++ for version of long_getopt. For processing GNU style command
27 line arguments. No pointer (return values, arguments) contents are
31 command - , and command --
38 const Long_option_init *option_a_;
41 /// if doing short option, arg_value_char_a_a_[optind][optindind] is processed next.
45 const Long_option_init *found_option_;
49 /** errorcodes: no error, argument expected, no argument expected,
50 unknown option, illegal argument (eg. int expected). */
51 enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
54 /// argument. Set to 0 if not present
55 char const * optional_argument_str0_;
57 /// current error status
60 /// arg_value_char_a_a_[array_index_] will be processed next.
64 char **arg_value_char_a_a_;
72 /// get ready for processing next error.
74 const Long_option_init *parselong ();
75 const Long_option_init *parseshort ();
79 /// report an error and abort
80 void report (Errorcod c);
83 /// return an integer (with err. detect)
84 long get_argument_index ();
88 What to do with errors.
89 report messages on #*os#, and abort.
90 if #os# is null, then do not report nor abort, just set #error#
93 void seterror (FILE *os);
95 /// construct: pass arguments and option info.
96 Getopt_long (int c, char **v, Long_option_init *lo);
98 /** get the next option.
99 @return pointer to next option found.
100 0 if error occurred, or next argument is no option.
102 const Long_option_init *operator () ();
104 char const *current_arg ();
105 char const * get_next_arg ();
108 #endif // GETOPT_LONG_HH