+
+Example
+~~~~~~~
+Typically, @cf_getopt() is used as follows: it works like
+the traditional @getopt_long() from the C library, but it also handles
+configuration files.
+
+ #include <ucw/lib.h>
+ #include <ucw/conf.h>
+ #include <ucw/getopt.h>
+
+ static char short_opts[] = CF_SHORT_OPTS "v";
+ static struct option long_opts[] = {
+ CF_LONG_OPTS
+ { "verbose", 0, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+
+ static int verbose;
+
+ int main(int argc, char *argv[]) {
+ cf_def_file = "default.cf";
+ int opt;
+ while((opt = cf_getopt(argc, argv, short_opts, long_opts, NULL)) >= 0)
+ switch(opt) {
+ case 'v': verbose = 1; break;
+ default: fprintf("Unknown option %c\n", opt); return 1;
+ }
+ }
+
+The `short_opts` and `long_opts` variables describe the command line
+arguments. Notice the `CF_SHORT_OPTS` and `CF_LONG_OPTS` macros. They
+add the `-S` and `-C` options for the configuration parser as described
+in <<config:>>. These options are handled internally by @cf_getopt().
+
+You can rely on the configuration files having been loaded before the
+first of your program's options is parsed.