File:  [Local Repository] / gnujdoc / gengetopt-2.14 / multiple_example.c.texinfo
Revision 1.1: download - view: text, annotated - select for diffs
Fri Oct 28 13:07:30 2005 UTC (15 years ago) by futoshi
Branches: MAIN
CVS tags: HEAD
Add gengetopt-2.14.

    1: @c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
    2: @smallexample
    3: @r{@i{/*}}@r{@i{ test options that can be given more than once }}@r{@i{*/}}
    4: 
    5: @b{#include} @t{<stdlib.h>}
    6: @b{#include} @t{<stdio.h>}
    7: 
    8: @b{#include} @t{"test_multiple_cmd.h"}
    9: 
   10: @b{static} @b{struct} gengetopt_args_info args_info;
   11: 
   12: @b{int}
   13: main (@b{int} argc, @b{char} **argv)
   14: @{ 
   15:   @b{int} i = 0;
   16:  
   17:   @b{if} (test_multiple_cmd_parser (argc, argv, &args_info) != 0)
   18:     exit(1) ;
   19: 
   20:   @b{for} (i = 0; i < args_info.string_given; ++i)
   21:     printf (@t{"passed string: %s\n"}, args_info.string_arg[i]);
   22: 
   23:   @b{for} (i = 0; i < args_info.int_given; ++i)
   24:     printf (@t{"passed int: %d\n"}, args_info.int_arg[i]);
   25: 
   26:   @b{return} 0;
   27: @}
   28: 
   29: @end smallexample

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>