File: no_optgiven2.c

package info (click to toggle)
gengetopt 2.23%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 5,032 kB
  • sloc: cpp: 14,765; ansic: 8,232; sh: 4,782; makefile: 754; yacc: 514; lex: 179; sed: 3
file content (29 lines) | stat: -rw-r--r-- 691 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* no_optgiven.c test */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <stdlib.h>
#include <stdio.h>
#include "no_optgiven_cmd.h"

int
main (int argc, char **argv)
{
  struct gengetopt_args_info args_info;

  /* let's call our cmdline parser */
  /* since it is called with no option we expect an error since the
     option --foo is required, however we check for this explicitly
     by calling the _required function */
  if (no_optgiven_cmd_parser2 (argc, argv, &args_info, 0, 1, 0) == 0)
    {
      fprintf(stderr, "the no_optgiven_cmd_parser2 returned successfully\n");
    }

  if (no_optgiven_cmd_parser_required (&args_info, argv[0]) == 0)
    exit(0);

  return 1;
}