int gt_suffixeratoroptions(Suffixeratoroptions *so,
                        bool doesa,
                        int argc,
                        const char **argv,
                        GtError *err)
{
  int parsed_args, retval = 0;
  GtOPrval rval;

  gt_error_check(err);
  rval = parse_options(&parsed_args, doesa, so, argc, argv, err);
  if (rval == GT_OPTION_PARSER_ERROR)
  {
    retval = -1;
  } else
  {
    if (rval == GT_OPTION_PARSER_REQUESTS_EXIT)
    {
      retval = 2;
    } else
    {
      if (rval == GT_OPTION_PARSER_OK)
      {
        if (so->beverbose)
        {
          showoptions(so);
        }
      }
    }
  }
  return retval;
}
Exemple #2
0
static void showusage(char *program,OptionDescription *options,
                      Uint numofoptions) {
    printf("Usage: %s [options] <reference-file> <query-files>\n\n"
           "Find and output (to stdout) the positions and length of all\n"
           "sufficiently long maximal matches of a substring in\n"
           "<query-file> and <reference-file>\n\n",program);
    printf("Options:\n");
    showoptions(stdout,program,options,numofoptions);
}
Exemple #3
0
void setoptions(void)
{
	int row = 1;
	int trow = 1;		/* row for timer submenu */
	int aborted;

	struct MENU menu;
	struct MENU timermenu;

	WINDOW *statwin;
	PANEL *statpanel;

	struct porttab *ports;

	loadaddports(&ports);

	makeoptionmenu(&menu);

	statwin = newwin(15, 35, (LINES - 19) / 2 - 1, (COLS - 40) / 16 + 40);
	statpanel = new_panel(statwin);

	wattrset(statwin, BOXATTR);
	tx_colorwin(statwin);
	tx_box(statwin, ACS_VLINE, ACS_HLINE);
	wmove(statwin, 9, 1);
	whline(statwin, ACS_HLINE, 33);
	mvwprintw(statwin, 0, 1, " Current Settings ");
	wattrset(statwin, STDATTR);
	mvwprintw(statwin, 1, 2, "Reverse DNS lookups:");
	mvwprintw(statwin, 2, 2, "Service names:");
	mvwprintw(statwin, 3, 2, "Promiscuous:");
	mvwprintw(statwin, 4, 2, "Color:");
	mvwprintw(statwin, 5, 2, "Logging:");
	mvwprintw(statwin, 6, 2, "Activity mode:");
	mvwprintw(statwin, 7, 2, "MAC addresses:");
	mvwprintw(statwin, 8, 2, "v6-in-v4 as IPv6:");
	mvwprintw(statwin, 10, 2, "TCP timeout:");
	mvwprintw(statwin, 11, 2, "Log interval:");
	mvwprintw(statwin, 12, 2, "Update interval:");
	mvwprintw(statwin, 13, 2, "Closed/idle persist:");
	showoptions(statwin);

	do {
		tx_showmenu(&menu);
		tx_operatemenu(&menu, &row, &aborted);

		switch (row) {
		case 1:
			options.revlook = ~options.revlook;
			break;
		case 2:
			options.servnames = ~options.servnames;
			break;
		case 3:
			options.promisc = ~options.promisc;
			break;
		case 4:
			options.color = ~options.color;
			break;
		case 5:
			options.logging = ~options.logging;
			break;
		case 6:
			options.actmode = ~options.actmode;
			break;
		case 7:
			options.mac = ~options.mac;
			break;
		case 8:
			options.v6inv4asv6 = ~options.v6inv4asv6;
			break;
		case 10:
			maketimermenu(&timermenu);
			trow = 1;
			do {
				tx_showmenu(&timermenu);
				tx_operatemenu(&timermenu, &trow, &aborted);

				switch (trow) {
				case 1:
					settimeout(&options.timeout,
						   "minutes", DONT_ALLOW_ZERO,
						   &aborted);
					if (!aborted)
						updatetimes(statwin);
					break;
				case 2:
					settimeout(&options.logspan,
						   "seconds", DONT_ALLOW_ZERO,
						   &aborted);
					if (!aborted) {
//						options.logspan =
//						    options.logspan * 60;
						updatetimes(statwin);
					}
					break;
				case 3:
					settimeout(&options.updrate, "seconds",
						   ALLOW_ZERO, &aborted);
					if (!aborted)
						updatetimes(statwin);
					break;
				case 4:
					settimeout(&options.closedint,
						   "minutes", ALLOW_ZERO,
						   &aborted);
					if (!aborted)
						updatetimes(statwin);
					break;
				}
			} while (trow != 6);

			tx_destroymenu(&timermenu);
			update_panels();
			doupdate();
			break;
		case 12:
			addmoreports(&ports);
			break;
		case 13:
			removeaport(&ports);
			break;
		case 15:
			manage_eth_desc(ARPHRD_ETHER);
			break;
		case 16:
			manage_eth_desc(ARPHRD_FDDI);
			break;
		}

		indicatesetting(row, statwin);
	} while (row != 18);

	destroyporttab(ports);
	tx_destroymenu(&menu);
	del_panel(statpanel);
	delwin(statwin);
	update_panels();
	doupdate();
}
Exemple #4
0
void setoptions(struct OPTIONS *options, struct porttab **ports)
{
	int row = 1;
	int trow = 1;		/* row for timer submenu */
	int aborted;

	struct MENU menu;
	struct MENU timermenu;

	WINDOW *statwin;
	PANEL *statpanel;

	if (!is_first_instance) {
		tui_error(ANYKEY_MSG,
			  "Only the first instance of ipraf-ng"
			  " can configure");
		return;
	}
	makeoptionmenu(&menu);

	statwin = newwin(15, 35, (LINES - 19) / 2 - 1, (COLS - 40) / 16 + 40);
	statpanel = new_panel(statwin);

	wattrset(statwin, BOXATTR);
	tx_colorwin(statwin);
	tx_box(statwin, ACS_VLINE, ACS_HLINE);
	wmove(statwin, 9, 1);
	whline(statwin, ACS_HLINE, 33);
	mvwprintw(statwin, 0, 1, " Current Settings ");
	wattrset(statwin, STDATTR);
	mvwprintw(statwin, 1, 2, "Reverse DNS lookups:");
	mvwprintw(statwin, 2, 2, "Service names:");
	mvwprintw(statwin, 3, 2, "Promiscuous:");
	mvwprintw(statwin, 4, 2, "Color:");
	mvwprintw(statwin, 5, 2, "Logging:");
	mvwprintw(statwin, 6, 2, "Activity mode:");
	mvwprintw(statwin, 7, 2, "MAC addresses:");
	mvwprintw(statwin, 8, 2, "v6-in-v4 as IPv6:");
	mvwprintw(statwin, 10, 2, "TCP timeout:");
	mvwprintw(statwin, 11, 2, "Log interval:");
	mvwprintw(statwin, 12, 2, "Update interval:");
	mvwprintw(statwin, 13, 2, "Closed/idle persist:");
	showoptions(options, statwin);

	do {
		tx_showmenu(&menu);
		tx_operatemenu(&menu, &row, &aborted);

		switch (row) {
		case 1:
			options->revlook = ~(options->revlook);
			break;
		case 2:
			options->servnames = ~(options->servnames);
			break;
		case 3:
			options->promisc = ~(options->promisc);
			break;
		case 4:
			options->color = ~(options->color);
			break;
		case 5:
			options->logging = ~(options->logging);
			break;
		case 6:
			options->actmode = ~(options->actmode);
			break;
		case 7:
			options->mac = ~(options->mac);
			break;
		case 8:
			options->v6inv4asv6 = ~(options->v6inv4asv6);
			break;
		case 10:
			maketimermenu(&timermenu);
			trow = 1;
			do {
				tx_showmenu(&timermenu);
				tx_operatemenu(&timermenu, &trow, &aborted);

				switch (trow) {
				case 1:
					settimeout(&(options->timeout),
						   "minutes", DONT_ALLOW_ZERO,
						   &aborted);
					if (!aborted)
						updatetimes(options, statwin);
					break;
				case 2:
					settimeout(&(options->logspan),
						   "minutes", DONT_ALLOW_ZERO,
						   &aborted);
					if (!aborted) {
						options->logspan =
						    options->logspan * 60;
						updatetimes(options, statwin);
					}
					break;
				case 3:
					settimeout(&options->updrate, "seconds",
						   ALLOW_ZERO, &aborted);
					if (!aborted)
						updatetimes(options, statwin);
					break;
				case 4:
					settimeout(&options->closedint,
						   "minutes", ALLOW_ZERO,
						   &aborted);
					if (!aborted)
						updatetimes(options, statwin);
					break;
				}
			} while (trow != 6);

			tx_destroymenu(&timermenu);
			update_panels();
			doupdate();
			break;
		case 12:
			addmoreports(ports);
			break;
		case 13:
			removeaport(ports);
			break;
		case 15:
			manage_eth_desc(ARPHRD_ETHER);
			break;
		case 16:
			manage_eth_desc(ARPHRD_FDDI);
			break;
		}

		indicatesetting(row, options, statwin);
	} while (row != 18);

	tx_destroymenu(&menu);
	del_panel(statpanel);
	delwin(statwin);
	update_panels();
	doupdate();
}