6 #include "std-string.hh"
12 a struct this for initialising the commandline options.
14 struct Long_option_init
16 char const *take_arg_str0_;
17 char const *longname_str0_;
20 = 0: don't take short version.
24 char const *help_str0_;
26 Std_string to_string () const;
27 Std_string str_for_help () const;
30 static int compare (Long_option_init const &, Long_option_init const &);
31 static Std_string table_string (Long_option_init *);
34 /** C++ for version of long_getopt. For processing GNU style command
35 line arguments. No pointer (return values, arguments) contents are
39 command - , and command --
47 const Long_option_init *option_a_;
50 /// if doing short option, arg_value_char_a_a_[optind][optindind] is processed next.
54 const Long_option_init *found_option_;
57 /** errorcodes: no error, argument expected, no argument expected,
58 unknown option, illegal argument (eg. int expected). */
59 enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
62 /// argument. Set to 0 if not present
63 char const *optional_argument_str0_;
65 /// current error status
68 /// arg_value_char_a_a_[array_index_] will be processed next.
72 char **arg_value_char_a_a_;
80 /// get ready for processing next error.
82 const Long_option_init *parselong ();
83 const Long_option_init *parseshort ();
87 /// report an error and abort
88 void report (Errorcod c);
90 /// return an integer (with err. detect)
91 long get_argument_index ();
94 What to do with errors.
95 report messages on #*os#, and abort.
96 if #os# is null, then do not report nor abort, just set #error#
99 void seterror (FILE *os);
101 /// construct: pass arguments and option info.
102 Getopt_long (int c, char **v, Long_option_init *lo);
104 /** get the next option.
105 @return pointer to next option found.
106 0 if error occurred, or next argument is no option.
108 const Long_option_init *operator () ();
110 char const *current_arg ();
111 char const *get_next_arg ();
114 #endif // GETOPT_LONG_HH