File:  [Local Repository] / gnujdoc / gengetopt-2.14 / test_conf_parser_ov2.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_conf_parser_ov2.c test }}@r{@i{*/}}
    4: 
    5: @r{@i{/*}}@r{@i{ test all kinds of options and the conf file parser }}@r{@i{*/}}
    6: @r{@i{/*}}@r{@i{ differently from test_conf_parser_ov.c, first scan the conf file and}}
    7: @r{@i{   then the command line }}@r{@i{*/}}
    8: 
    9: @b{#include} @t{<stdlib.h>}
   10: @b{#include} @t{<stdio.h>}
   11: 
   12: @b{#include} @t{"test_conf_parser_cmd.h"}
   13: 
   14: @b{static} @b{struct} my_args_info args_info;
   15: 
   16: @b{int}
   17: main (@b{int} argc, @b{char} **argv)
   18: @{  
   19:   @r{@i{/*}}@r{@i{ do not override command line options, initialize args_info }}@r{@i{*/}}
   20:   @b{if} (test_conf_parser_cmd_parser_configfile
   21:       (@t{"./test_conf2.conf"}, &args_info, 0, 1, 0) != 0)
   22:     exit(1);
   23: 
   24:   @b{if} (test_conf_parser_cmd_parser2 (argc, argv, &args_info, 1, 0, 1) != 0)
   25:     exit(1) ;
   26: 
   27:   printf (@t{"value of required: %s\n"}, args_info.required_arg);
   28:   printf (@t{"value of string: %s\n"}, args_info.string_arg);
   29:   printf (@t{"value of no-short_given: %d\n"}, args_info.no_short_given);
   30:   printf (@t{"value of int: %d\n"}, args_info.int_arg);
   31:   printf (@t{"value of float: %f\n"}, args_info.float_arg);
   32: 
   33:   test_conf_parser_cmd_parser_free (&args_info);
   34: 
   35:   @b{return} 0;
   36: @}
   37: 
   38: @end smallexample

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