summaryrefslogblamecommitdiffstats
path: root/src/foodopts.h
blob: c8b0686f0ef8f0d7cdfb579cf866d45ea0d8d1ed (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                     


















                                                


                         
#ifndef __FOODOPTS_H
#define __FOODOPTS_H

#include <getopt.h>

/**
 * This is a wrapper on getopt.h, specifically 
 * 
 * It provides a unified interface for defining
 * cli options, printing the help, and looping though
 * the parsing results.
 *
 */
struct foodoption {
  const char *name;
  int has_arg;
  int *flag;
  int val;
  /* Extra values */
  const char *help;
  const char *arg;
};

int
get_foodopt(int argc, char *const argv[],
            const char *optstring,
            const struct foodoption *longopts,
            int *longindex);

void
foodopt_help(char * argv0,
             const struct foodoption *longopts);


#endif /* __FOODOPTS_H */