summaryrefslogtreecommitdiff
path: root/tests/mcpp-options-test.c
blob: a0e8311968eef05c241e5509ef85919431e5b112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <defs.h>

int
main( int argc, char **argv )
{
  mcpp_options options;
  const char  *p;
  int          rc = 1;

  mcpp_options_init( &options, argc );
  if( options.actions == NULL )
    return( 1 );

  p = argv[0] + strlen( argv[0] );
  while( p != argv[0] && p[-1] != '/' ) --p;
  options.progname = p;

  if( mcpp_handle_options(&options, argc - 1, argv + 1) == 0 &&
      mcpp_options_dump(&options, stdout) == 0 )
    rc = 0;

  mcpp_options_free( &options );
  return( rc );
}