9 a struct this for initialising the commandline options.
11 struct Long_option_init {
12 char const * take_arg_str0_;
13 char const * longname_str0_;
16 = 0: don't take short version.
20 char const * help_str0_;
22 String to_string () const;
23 String str_for_help () const;
26 static int compare (Long_option_init const&,Long_option_init const&);
27 static String table_string (Long_option_init *);
31 /** C++ for version of long_getopt. For processing GNU style command
32 line arguments. No pointer (return values, arguments) contents are
36 command - , and command --
43 const Long_option_init *option_a_;
46 /// if doing short option, arg_value_char_a_a_[optind][optindind] is processed next.
50 const Long_option_init *found_option_;
54 /** errorcodes: no error, argument expected, no argument expected,
55 unknown option, illegal argument (eg. int expected). */
56 enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
59 /// argument. Set to 0 if not present
60 char const * optional_argument_str0_;
62 /// current error status
65 /// arg_value_char_a_a_[array_index_] will be processed next.
69 char **arg_value_char_a_a_;
77 /// get ready for processing next error.
79 const Long_option_init *parselong ();
80 const Long_option_init *parseshort ();
84 /// report an error and abort
85 void report (Errorcod c);
88 /// return an integer (with err. detect)
89 long get_argument_index ();
93 What to do with errors.
94 report messages on #*os#, and abort.
95 if #os# is null, then do not report nor abort, just set #error#
98 void seterror (FILE *os);
100 /// construct: pass arguments and option info.
101 Getopt_long (int c, char **v, Long_option_init *lo);
103 /** get the next option.
104 @return pointer to next option found.
105 0 if error occurred, or next argument is no option.
107 const Long_option_init *operator () ();
109 char const *current_arg ();
110 char const * get_next_arg ();
113 #endif // GETOPT_LONG_HH