Exemplo n.º 1
0
Arquivo: leaf.c Projeto: shaoner/leaf
int main(int argc, char *argv[])
{
	struct option longopts[] = {
		{ "version", no_argument, NULL,	'v' },
		{ "help", no_argument, NULL, 'h' },
		{ 0, 0, 0, 0 }
	};
	int c = 0;

	/* Parse command-line options */
	while ((c = getopt_long(argc, argv, "vh", longopts, NULL)) > -1) {
		switch (c) {
		case 'h':
			display_usage(stdout);
			return EXIT_SUCCESS;
		case 'v':
			display_version();
			return EXIT_SUCCESS;
		default:
			/* Unknown option */
			display_usage(stderr);
			return EXIT_FAILURE;
		}
	}
	/* Start the wm */
	if (leaf_init() != ERR_NONE)
		return leaf_exit(EXIT_FAILURE);
	if (leaf_run() != ERR_NONE)
		return leaf_exit(EXIT_FAILURE);

	return leaf_exit(EXIT_SUCCESS);
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
    char *exec_name = argv[0];
    int option, option_index;

    static struct option long_options[] = 
    {
        {"help",0,0,'h'},
        {"version",0,0,'v'},
        {0,0,0,0}
    };

    while ((option = getopt_long(argc, argv, "hv", long_options, 
                    &option_index)) != -1)
    {
        switch(option)
        {
            case 'h':
                display_usage(exec_name);
                exit(EXIT_SUCCESS);
            case 'v':
                display_version();
                exit(EXIT_SUCCESS);
            default:
                display_usage(exec_name);
                exit(EXIT_FAILURE);
        }
    }

    begin();
    return EXIT_SUCCESS;
}
Exemplo n.º 3
0
int			main(int ac, char *av[])
{
	char	*flags;
	char	*command;
	char	*op_list;
	t_pile	*pile_tab[2];

	command = av[0];
	if (ac < 2)
		display_usage(command);
	flags = get_flags(&ac, &av);
	if (ac < 1)
		display_usage(command);
	pile_tab[0] = save_param_to_pile(ac, av, command);
	pile_tab[1] = NULL;
	if (has_duplicate(pile_tab[0]))
		print_error();
	if (ft_strchr(flags, 'v'))
		print_piles(pile_tab);
	op_list = solve(pile_tab, flags);
	if (op_list == NULL)
		ft_putendl("Already sorted");
	else
		ft_putendl(op_list);
	return (0);
}
Exemplo n.º 4
0
int main( int argc, char ** argv )
{
	int opt;
	char type;
	char * dst_ip_str;

	type = '.';
	while( ( opt = getopt(argc, argv, "s:f:") ) != -1 ){
		switch( opt ){
		case 's':
			printf( "option s: %s\n", optarg );
			type = 's';
			dst_ip_str = optarg;
			break;
		case 'f':
			printf( "option f: %s\n", optarg );
			type = 'f';
			dst_ip_str = optarg;
			break;
		default:
			display_usage( argv[0] );
			exit( -1 );
		}
	}

	if( type == '.' ){
		display_usage( argv[0] );
		exit(-1);
	}

	port_scan( type, dst_ip_str );
	return 0;
}
Exemplo n.º 5
0
int main(int argc, char **argv) {
  int opt;
  while ((opt = getopt_long(argc, argv, optString, longOpts, NULL)) != -1) {
    switch(opt) {
    case 'p':
      pinStr = optarg;
      sscanf(pinStr, "%u", &pinIndex);
      break;
    case 'r':
      sscanf(optarg,"%u",&periodValue);
      break;
    case 'd':
      sscanf(optarg,"%u",&dutyValue);
      break;
    case 'h':
    case '?':
	display_usage();
        helpDisplayed = 1;
	return EXIT_SUCCESS;
      break;
    default:
      break;
    }
  }
  if (pinIndex >= 0 && pinIndex <= 7) {
    doPWM(pinIndex,periodValue,dutyValue);
  }
  else {
    display_usage();
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}
Exemplo n.º 6
0
int main(int argc, char **argv) {
  int opt;
  while ((opt = getopt_long(argc, argv, optString, longOpts, NULL)) != -1) {
    switch(opt) {
    case 'p':
      pinStr = optarg;
      pinIndex = compute_pin_index(pinStr);
      break;
    case 'v':
      valueStr = optarg;
      sscanf(valueStr, "%u", &value);
      break;
    case 'h':
    case '?':
	display_usage();
        helpDisplayed = 1;
	return EXIT_SUCCESS;
      break;
    default:
      break;
    }
  }
  if (pinIndex != -1 && value != -1) {
    doMux(pinIndex, value);
  }
  else {
    display_usage();
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}
Exemplo n.º 7
0
//----------------------------------------------------------------------
// main
//----------------------------------------------------------------------
int
main (int argc, char *argv[])
{
    int option_error = 0;
    const char *progname = argv[0];
    if (argc < 2)
    {
        display_usage(progname);
        exit(option_error);
    }
    else if (argv[1][0] == 'g')
    {
        initialize();
        main_gdbserver(argc, argv);
        terminate();
    }
    else if (argv[1][0] == 'p')
    {
        initialize();
        main_platform(argc, argv);
        terminate();
    }
    else {
        display_usage(progname);
        exit(option_error);
    }
}
Exemplo n.º 8
0
Arquivo: main.c Projeto: gpalma/semep
static void parse_args(int argc, char **argv)
{
     int i, opt;

     if (argc != (MIN_ARG+3))
	  display_usage();
     
     initialize_arguments();
     opt = getopt(argc, argv, optString);
     while(opt != -1) {
	  switch(opt) {
	  case 'r':
	       g_args.threshold_right = strtod(optarg, (char **)NULL);
	       break;
	  case 'l':
	       g_args.threshold_left = strtod(optarg, (char **)NULL);
	       break;
	  case '?':
	       display_usage();
	       break;
	  default:
	       /* You won't actually get here. */
	       fatal("?? getopt returned character code 0%o ??\n", opt);
	  }
	  opt = getopt(argc, argv, optString);
     }
     i = optind;
     g_args.matrix_left_filename = argv[i++];
     g_args.left_filename = argv[i++];
     g_args.matrix_right_filename = argv[i++];
     g_args.right_filename = argv[i++];
     g_args.graph_filename = argv[i];
}
Exemplo n.º 9
0
int main(int argc, char **argv)
{
	const char *options_list = "hVA:P:C:L:v";
	int option;
	const char *cert = NULL;
	const char *ca_cert = NULL;
	const char *ca_path = NULL;
	const char *crl = NULL;
	int command = 0;
	char ret_message[4096];
	size_t message_sz = sizeof(ret_message);
	int rc;

	while ((option = getopt_long(argc, argv, options_list, long_options, NULL)) != -1) {
		switch (option) {
		case 'h':
			display_usage();
			return 0;
		case 'V':
			fprintf(stdout, "ssl_tool for nussl version %s\n", PACKAGE_VERSION);
			return 0;
		case 'A':
			ca_cert = strdup(optarg);
			break;
		case 'P':
			ca_path = strdup(optarg);
			break;
		case 'C':
			cert = strdup(optarg);
			break;
		case 'L':
			crl = strdup(optarg);
			break;
		case 'v':
			command = COMMAND_VERIFY;
			break;
		}
	}

	nussl_init();

	switch (command) {
	case COMMAND_VERIFY:
		rc = nussl_local_check_certificate(cert, ca_cert, ca_path, crl,
				ret_message, message_sz);
		fprintf(stdout, "nussl_local_check_certificate: %d\n"
				"message: %s\n",
				rc, ret_message);
		break;
	default:
		fprintf(stderr, "no command provided\n");
		display_usage();
		return 0;
	}

	return 0;
}
Exemplo n.º 10
0
int	main(int ac, char **av)
{
  int	nb = 0;

  if (ac != 2)
    return (display_usage(av[0]));
  if ((nb = atoif(av[1])) == -1)
    return (display_usage(av[0]));
  display_convert(nb);
  return (EXIT_SUCCESS);
}
Exemplo n.º 11
0
static int process_args (LPWSTR lpCmdLine, int skip, Args & args) {
	int i, iNumArgs;
	LPWSTR * argvW;

	argvW = CommandLineToArgvW (lpCmdLine, &iNumArgs);
	// Skip over the command name
	for (i = skip; i < iNumArgs; i++)
	{
		if (wcsstr (argvW[i], L"help")
			|| !_wcsicmp (argvW[i], L"?")
			|| (wcslen(argvW[i]) == 2 && argvW[i][1] == L'?'))
		{
			display_usage();
			GlobalFree (argvW);
			return 0;
		}

		if (!_wcsicmp (argvW[i], L"q") || !_wcsicmp (argvW[i], L"quiet")) {
			args.bQuiet = true;
			continue;
		}

		if (!args.lpConnectionName) {
			wcsMallocAndCpy (&args.lpConnectionName, argvW[i]);
			continue;
		}

		if (!args.lpIPAddr) {
			wcsMallocAndCpy (&args.lpIPAddr, argvW[i]);
			continue;
		}

		if (!args.lpSubnetMask) {
			wcsMallocAndCpy (&args.lpSubnetMask, argvW[i]);
			continue;
		}

		display_usage();
		GlobalFree (argvW);
		return 0;
	}

	if (!args.lpConnectionName)
		wcsMallocAndCpy (&args.lpConnectionName, DEFAULT_NAME);
	if (!args.lpIPAddr)
		wcsMallocAndCpy (&args.lpIPAddr, DEFAULT_IP);
	if (!args.lpSubnetMask)
		wcsMallocAndCpy (&args.lpSubnetMask, DEFAULT_MASK);

	GlobalFree (argvW);

	return 1;
}
Exemplo n.º 12
0
int do_grep(regex_t* preg, char* filename) {
    #ifdef DEBUG
    printf("----preg %d to grep file %s\n", (int)preg, filename);
    #endif

    char *label = NULL;
    FILE *file  = NULL;
    if (strcmp(filename, "-") == 0) {
        label = "(standard input)";
        file = stdin;
    } else {
        label = filename;
        file = fopen(filename, "r");
        if (file == NULL)
            display_usage(EXIT_TROUBLE, "Open file failed.", errno);
    }
    
    char linebuf[MAXLINE];
    int regexec_code = 0;
    int line_number = 0;
    while ( fgets(linebuf, MAXLINE, file) != NULL ) {
        line_number++;
        int len = strlen(linebuf) - 1;
        if ( linebuf[len] == '\n' )
            linebuf[len] = 0; //replace newline with null
        regexec_code = regexec(preg, linebuf, 0, NULL, 0);
        if (regexec_code > REG_NOMATCH) { // >1?
            regfree(preg);
            display_usage(EXIT_TROUBLE, "Match Error.", regexec_code);
        }

        /* this condition equals to:
           (regexec_code == 0 && gargs.is_invert == 0) 
           || (regexec_code == 1 && gargs.is_invert == 1)
        */
        if ( !(regexec_code ^ gargs.is_invert) ) {
            if (gargs.show_filename && gargs.show_line_number)
                printf("%s:%d:%s\n", label, line_number, linebuf);
            else if (gargs.show_filename && !gargs.show_line_number)
                printf("%s:%s\n", label, linebuf);
            else if (!gargs.show_filename && gargs.show_line_number)
                printf("%d:%s\n", line_number, linebuf);
            else
                puts(linebuf);
        }
    }

    fclose(file);
    return regexec_code;
}
Exemplo n.º 13
0
Arquivo: main.c Projeto: gpalma/taxsim
static void parse_args(int argc, char **argv)
{
     int i, opt;

     opt = 0;
     initialize_arguments();
     opt = getopt(argc, argv, optString);
     while(opt != -1) {
	  switch(opt) {
	  case 'l':
	       g_args.lca = true;
	       break;
	  case 'd':
	       g_args.description = true;
	       break;
	  case 'm':
	       if (strcmp(optarg, "tax") == 0) {
		    g_args.d = DTAX;
	       } else if (strcmp(optarg, "str") == 0) {
		    g_args.d = DSTR;
	       } else if (strcmp(optarg, "ps") == 0) {
		    g_args.d = DPS;
	       } else {
		    display_usage();
	       }
	       break;
	  case 't':
	       g_args.n_threads = strtod(optarg, (char **)NULL);
	       if (0 >= g_args.n_threads)
		    fatal("Error, The minimum number of threads allowed is 1");

	       if (MAX_THREADS < g_args.n_threads)
		    fatal("Error, The maximum number of threads allowed is %d", MAX_THREADS);
	       break;
	  case '?':
	       display_usage();
	       break;
	  default:
	       /* You won't actually get here. */
	       fatal("?? getopt returned character code 0%o ??\n", opt);
	  }
	  opt = getopt(argc, argv, optString);
     }
     if ((argc - optind) != MIN_ARG)
	  display_usage();
     i = optind;
     g_args.graph_filename = argv[i++];
     g_args.desc_filename = argv[i++];
     g_args.annt_filename = argv[i];
}
Exemplo n.º 14
0
int main( int argc, char *argv[]){
    
    // Creates a character array with 256 locations
    char buffer[256];
    
    //  Tells the program ther is a file
    FILE *fp;
    
    // Not sure but I think this checks to see if changes have been made to the file
    if(argc < 2)
    {
        display_usage();
        return 1;
    }
    
    // Not sure but I think this checks to see if a file exists to be opened, and prints a error if it doesn't
    if (( fp = fopen( argv[1], "r" )) == NULL ){
        fprintf( stderr, "Error opening file, %s!", argv[1]);
        return(1);
    }
    
    line = 1;
    
    // Pushes program to the next line while the buffer is not empty
    while( fgets( buffer, 257, fp ) != NULL )
        fprintf(stdout, "%4d:\t%s", line++, buffer);
    
    
    // Closes file
    fclose(fp);
    return 0;
}
Exemplo n.º 15
0
int main(int argc, char **argv)
{
	struct state state;

	memset(&state, 0, sizeof(struct state));

	if (rc_read_options(&state, argc, argv) < 0)
		return EXIT_FAILURE;

	switch (state.rc.action) {
	case ACTION_NONE:
		/* this should never happen... */
		assert(0);
		break;
	case ACTION_USAGE:
		display_usage();
		break;
	case ACTION_VERSION:
		display_version();
		break;
	case ACTION_ANALYZE:
	case ACTION_RANK:
	case ACTION_PREDICT:
		db_load(&state);
		break;
	}

	return EXIT_SUCCESS;
}
Exemplo n.º 16
0
static char	*get_flags(int *ac, char **av[])
{
	char	*flags;
	char	*old;
	char	*command;

	flags = NULL;
	command = **av;
	*ac -= 1;
	*av += 1;
	while ((**av)[0] == '-' && ((**av)[1] == 'c' || (**av)[1] == 'v'))
	{
		if (contains_invalid_flag(**av))
		{
			free(flags);
			display_usage(command);
		}
		old = flags;
		flags = ft_strjoin(flags, **av + 1);
		free(old);
		*av += 1;
		*ac -= 1;
	}
	return (flags);
}
Exemplo n.º 17
0
Bool load_config (const char *filename)
{
    int rc;
    XML_ITEM *config = NULL;
    XML_ITEM *root   = NULL;
    char fullname[FILE_NAME_MAX + 1];

    root = xml_create ("root", NULL);

    ASSERT (filename != NULL);
    ASSERT (strlen(filename) < FILE_NAME_MAX);
    default_extension (fullname, filename, "cfg");

    rc = xml_load_file (&root, ".", fullname, FALSE);

    if (rc != XML_NOERROR)
      {
        coprintf ("Error while loading \"%s\". Check file presence and consistence",
                   fullname);
        display_usage ();
        return FALSE;;
      }

    config = xml_first_child (root);
    ASSERT (config);

    /* default server is localhost */
    main_server =   mem_strdup (xml_get_attr (config, "smtp",    "127.0.0.1"));
    main_sender =   mem_strdup (xml_get_attr (config, "sender",  "admin@crjo"));
    main_dest   =   mem_strdup (xml_get_attr (config, "dest",    "user@crjo"));

    xml_free (root);

    return TRUE;
}
Exemplo n.º 18
0
static void check_options(int argc, char *argv[])
{
    char opt;
    int index;
    static struct option options[]={
        {"help", 0, NULL, 'h'},
        {"version", 0, NULL, 'V'}
    };
    
    opterr = 0;
    while((opt = getopt_long(argc, argv, "hV", options, &index)) != -1)
    {
        switch(opt) 
        {                
            case 'V':
                display_version();
                exit(1);
                break;
                
            case 'h':
                display_usage();
                exit(1);
                break;
                
            default:
                die("Unknown option: %s\nUse --help to show valid options.\n",
                        argv[optind - 1]);
                break;
        }
    }
}
int main(int argc, char* argv[])
{
    if (argc != 2) {
        display_usage();
        return EXIT_FAILURE;
    }

    const char* file_name = argv[1];
    std::string file_data = read_file_data(file_name);

    std::vector<RuleNode*> nodes;
    Parser parser(file_data);
    nodes = parser.parseSyntax();

    if (nodes.empty()) {
        std::cerr << parser.getErrorInfo() << "\n";
        return EXIT_FAILURE;
    }

    for (auto& n: nodes) {
        Placer::placeNode(n);
    }

    std::string dir_name = std::string(file_name) + "_grammar";
    mkdir(dir_name.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
    generate_svg_file(dir_name, nodes);

    generate_html_file(dir_name + "/" + "all.html", nodes);

    return EXIT_SUCCESS;
}
Exemplo n.º 20
0
void getoptions(int argc, char *argv[]) {
	int opt = 0;

	/* Initialize globalArgs before we get to work. */
	globalArgs.verbosity = 0;
	globalArgs.inputFiles = NULL;
	globalArgs.numInputFiles = 0;
	opt = getopt(argc, argv, optString);
	while (opt != -1) {
		switch (opt) {
		case 'v':
			globalArgs.verbosity++;
			break;
		case 'h': /* fall-through is intentional */
		case '?':
			display_usage();
			break;
		default:
			/* You won't actually get here. */
			break;
		}
		opt = getopt(argc, argv, optString);
	}

	globalArgs.inputFiles = argv + optind;
	globalArgs.numInputFiles = argc - optind;
}
Exemplo n.º 21
0
int main( int argc, char *argv[] )
{
	int opt = 0;
	
	/* Initialize globalArgs before we get to work. */
	globalArgs.noIndex = 0;		/* false */
	globalArgs.langCode = NULL;
	globalArgs.outFileName = NULL;
	globalArgs.outFile = NULL;
	globalArgs.verbosity = 0;
	globalArgs.inputFiles = NULL;
	globalArgs.numInputFiles = 0;
	
	/* Process the arguments with getopt(), then 
	 * populate globalArgs. 
	 */
	opt = getopt( argc, argv, optString );
	while( opt != -1 ) {
		printf("optarg=%x\toptind=%x\t%s\n", optarg, optind, optarg);
		switch( opt ) {
			case 'I':
				globalArgs.noIndex = 1;	/* true */
				break;
				
			case 'l':
				globalArgs.langCode = optarg;
				break;
				
			case 'o':
				/* This generates an "assignment from
				 * incompatible pointer type" warning that
				 * you can safely ignore.
				 */
				globalArgs.outFileName = optarg;
				break;
				
			case 'v':
				globalArgs.verbosity++;
				break;
				
			case 'h':	/* fall-through is intentional */
			case '?':
				display_usage();
				break;
				
			default:
				/* You won't actually get here. */
				break;
		}
		
		opt = getopt( argc, argv, optString );
	}
	
	globalArgs.inputFiles = argv + optind;
	globalArgs.numInputFiles = argc - optind;

	convert_document();
	
	return EXIT_SUCCESS;
}
Exemplo n.º 22
0
static void
process_command_line_args (int argc, char *const *argv)
{
  int ch = -1;

  while (-1 != (ch = getopt (argc, argv, "rf:vVh")))
    {
      switch (ch)
        {
        case 'r':
          /* FIXME: implement read-only option */
          break;
        case 'f':
          set_contacts_file ();
          break;
        case 'v':
          display_version ();
          exit (0);
          break;
        case 'V':
          display_license ();
          exit (0);
          break;
        case 'h':
        case '?':
        default:
          display_usage (argv[0]);
          exit (0);
        }
    }
}
Exemplo n.º 23
0
static int identify(int argc, char *argv[])
{
	if (argc<3) {
		fprintf(stderr, "Missing name of file to identify.\n\n");
		display_usage();
		return 1;
	}

	for(int i=2; i<argc; i++) {
		char msg[4096];
		sprintf(msg, "Error opening %s for reading", argv[i]);
		FILE *f = fopen(argv[i], "rb");
		if (!f) {
			perror(msg);
			return 1;
		}
		io_generic io;
		io.file = f;
		io.procs = &stdio_ioprocs_noclose;
		io.filler = 0xff;

		floppy_image_format_t *best_fif = find_format_by_identify(&io);
		if (best_fif)
			printf("%s : %s\n", argv[i], best_fif->description());
		else
			printf("%s : Unknown format\n", argv[i]);
		fclose(f);
	}
	return 0;
}
Exemplo n.º 24
0
int main(int argc, char* argv[], char* envp[]) {
    if(argc <= 1) {
        display_usage();
        return 0;
    }
    // nqkakav comment
    return 0;
}
Exemplo n.º 25
0
void				p_error(char *s, int detailed_message)
{
    if (!detailed_message)
        ft_error("Error\n");
    else if (!s)
        display_usage();
    else
        ft_error(s);
}
Exemplo n.º 26
0
int main(int argc, char *argv[]) {
    if (argc < 2) display_usage(NULL);

    if (arg_matches(argv[1], "ls")) {
        commands_ls_hosts();
    } else if (arg_matches(argv[1], "rm")) {
        if (argc != 3) display_usage("Host required");
        commands_rm_host(argv[2]);
    } else if (arg_matches(argv[1], "version")) {
        printf("Version "VERSION "\n");
    } else if (arg_matches(argv[1], "help")) {
        display_usage(NULL);
    } else {
        display_usage(argv[1]);
    }

    return 0;
}
Exemplo n.º 27
0
char *read_pattern(const char* source) {
    char *pattern = malloc( (strlen(source) + 1) * sizeof(char) );
    if (pattern != 0) {
        strcpy(pattern, source);
        return pattern;
    } else {
        display_usage(EXIT_TROUBLE, "Not enough memory space", -1);
    }
    return NULL; // won't be here
}
Exemplo n.º 28
0
int main (int argc, char *argv [])
{
    bin_name = strip_file_path (argv[0]);

    if (argc < 2 || argc > 3)
      {
         display_usage ();
         return -1;
      }

    if (! load_config (argv[1]) )
        return -1;

    if (argc == 3)
      {
        if (!load_body (argv[2]))
          {
            coprintf ("bad body file");
            return -1;
          }
      }

    coprintf (
        "Sending one mail from [%s] to [%s] via [%s]",
        main_sender,
        main_dest,
        main_server
      );

    smt_init ();                   /*  Initialise SMT kernel    */
    /*  Application is latent - initialise it                   */
    if (agent_lookup (SMT_SOCKET) == NULL)
        sock_init ();
    if (agent_lookup (AGENT_NAME) == NULL)
        tstsmtp_init ();

    thread_create (AGENT_NAME, "");

    /*  Application is active - execute it                      */
    smt_exec_full ();              /*  Run until completed      */

    /*  Application is halted - terminate it                    */
    smt_term ();                   /*  Shut-down SMT kernel     */
    sock_term ();

    mem_free (main_server);
    mem_free (main_sender);
    mem_free (main_dest);
    mem_free (main_body);

    printf ("Allocs=%ld frees=%ld\n", mem_allocs (), mem_frees ());
    mem_assert ();

    return (0);
}
Exemplo n.º 29
0
int main(int argc, char *argv[])
{
    struct OOmnik *oom;
    const char *config = "oomniconf.xml";
    int long_option;
    int opt;
    
    while((opt = getopt_long(argc, argv, 
			     options_string, main_options, &long_option)) >= 0) {
	switch(opt)
	{
	case 'c':
	    if (optarg) {
		config = optarg;
		printf("%s\n", optarg);
	    }
	    break;
	case 'h':
	case '?':
	    display_usage();
	    break;
	case 0:  /* long option without a short arg */
	    if(!strcmp("config", main_options[long_option].name)) {
		config = optarg;
	    }
	    break;
	default:
	    break;
	}
    }

    oom = (struct OOmnik*)OOmnik_create(config);
    if (!oom) {
	display_usage();
	exit(-2);
    }
    oom->interact(oom);
    oom->del(oom);

    exit (0);

}
Exemplo n.º 30
0
int main (int argc, char** argv) {
	std::string file;
	std::string os = "Fedora";
	std::string out;
	boost::shared_ptr<WriterFactory> factory;

	int c;
	while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) != -1) {
		switch (c) {
			case 'h':
				display_usage ();
				exit (0);
			break;
			case 'r': 
				if (optarg) file = optarg; 
				std::cout << "file " << file << std::endl;
			break;
			case 's':
				if (optarg) os = optarg;
				std::cout << "optarg " << optarg << std::endl;
			break;
			case 'o': 
				if (optarg) out = optarg;
				std::cout << "out " << optarg << std::endl;
			break;
			case 't':
				if (strncmp ("sql", optarg, 3) == 0) factory = boost::shared_ptr<WriterFactory> (new SQLFactory);
				if (strncmp ("csv", optarg, 3) == 0) factory = boost::shared_ptr<WriterFactory> (new CSVFactory);
				std::cout << "type " << optarg << std::endl;
			break;
		}
	}

	if (!file.length () || !factory.get ()) {
		display_usage ();
		return 1;
	}

	RepoFile repo (file, factory, out, os);

	return 0;
}