op_popt.c

Go to the documentation of this file.
00001 
00013 #include <stdlib.h>
00014 #include <string.h>
00015 #include "op_libiberty.h"
00016 #include "op_popt.h"
00017 
00018 poptContext op_poptGetContext(char const * name,
00019         int argc, char const ** argv,
00020         struct poptOption const * options, int flags)
00021 {
00022     poptContext optcon;
00023     int c;
00024 
00025     xmalloc_set_program_name(argv[0]);
00026 
00027 #ifdef CONST_POPT
00028     optcon = poptGetContext(name, argc, argv, options, flags);
00029 #else
00030     optcon = poptGetContext((char *)name, argc, (char **)argv, options, flags);
00031 #endif
00032 
00033     c = poptGetNextOpt(optcon);
00034 
00035     if (c < -1) {
00036         fprintf(stderr, "%s: %s: %s\n", argv[0],
00037             poptBadOption(optcon, POPT_BADOPTION_NOALIAS),
00038             poptStrerror(c));
00039         poptPrintHelp(optcon, stderr, 0);
00040         exit(EXIT_FAILURE);
00041     }
00042 
00043     return optcon;
00044 }

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1