File: multiple_example.c.texinfo

package info (click to toggle)
gengetopt 2.22.6+dfsg0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,732 kB
  • sloc: cpp: 14,709; sh: 11,845; ansic: 8,030; makefile: 689; yacc: 514; lex: 171; sed: 3
file content (33 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (2)
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
30
31
32
33
@c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
@example
@r{@i{/* test options that can be given more than once */}}

@b{#ifdef} HAVE_CONFIG_H
@b{#include} @t{"config.h"}
@b{#endif}

@b{#include} @t{<stdlib.h>}
@b{#include} @t{<stdio.h>}

@b{#include} @t{"test_multiple_cmd.h"}

@b{static} @b{struct} gengetopt_args_info args_info;

@b{int}
main (@b{int} argc, @b{char} **argv)
@{ 
  @b{int} i = 0;
 
  @b{if} (test_multiple_cmd_parser (argc, argv, &args_info) != 0)
    exit(1) ;

  @b{for} (i = 0; i < args_info.string_given; ++i)
    printf (@t{"passed string: %s}\n@t{"}, args_info.string_arg[i]);

  @b{for} (i = 0; i < args_info.int_given; ++i)
    printf (@t{"passed int: %d}\n@t{"}, args_info.int_arg[i]);

  @b{return} 0;
@}

@end example