argp-ex1.c 598 B

123456789101112131415161718192021
  1. /* Argp example #1 -- a minimal program using argp */
  2. /* This is (probably) the smallest possible program that
  3. uses argp. It won't do much except give an error
  4. messages and exit when there are any arguments, and print
  5. a (rather pointless) messages for --help. */
  6. #include <stdlib.h>
  7. #if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
  8. #include <argp.h>
  9. #endif
  10. int main (int argc, char **argv)
  11. {
  12. #if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
  13. argp_parse (0, argc, argv, 0, 0, 0);
  14. exit (0);
  15. #else
  16. return 23;
  17. #endif
  18. }