summaryrefslogtreecommitdiff
path: root/tests/tst-tool-config.c
blob: 8ea0ec6fb95d581b71935df0b6ac237289fe2516 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>
#include <string.h>

#include "mcpu-tool-options.h"

int
main( int argc, char **argv )
{
  mcpu_tool_options options;
  int               i;
  int               rc = 1;

  mcpu_tool_options_init( &options, argv[0] );

  for( i = 1; i < argc; ++i )
  {
    int parsed = mcpu_tool_parse_common_option( &options, argc, argv, &i );

    if( parsed < 0 )
      goto done;
    if( parsed == 0 )
    {
      fprintf( stderr, "%s: unknown option '%s'\n",
               options.progname, argv[i] );
      goto done;
    }
  }

  if( mcpu_tool_options_prepare(&options, argv[0]) != 0 )
    goto done;

  printf( "root=%s\n", options.runtime.installation_root );
  printf( "config=%s\n", options.runtime.config_file );
  printf( "lib=%s\n", options.runtime.system_library_path );
  rc = 0;

done:
  mcpu_tool_options_free( &options );
  return( rc );

} /* End of main() */