예제 #1
0
static void usage()
{
  char desc[] = 
    "This program will retreive config options for a ndb cluster\n";
  puts(desc);
  ndb_std_print_version();
  print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
  puts("");
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
예제 #2
0
파일: mysqldump.c 프로젝트: OPSF/uClinux
static void usage(void)
{
  print_version();
  puts("By Igor Romanenko, Monty, Jani & Sinisa");
  puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
  puts("Dumping definition and data mysql database or table");
  short_usage_sub();
  print_defaults("my",load_default_groups);
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
} /* usage */
예제 #3
0
static void usage()
{
#ifdef NOT_USED
  char desc[] = 
    "tabname\n"\
    "This program will delete all records in the specified table using scan delete.\n";
#endif
  ndb_std_print_version();
  print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
  puts("");
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
예제 #4
0
파일: drop_tab.cpp 프로젝트: A-eolus/mysql
static void usage()
{
#ifdef NOT_USED
  char desc[] = 
    "tabname\n"\
    "This program will drop one table in Ndb\n";
#endif
  ndb_std_print_version();  
  print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
  puts("");
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
예제 #5
0
static void usage()
{
#ifdef NOT_USED
  char desc[] = 
    "tabname1 ... tabnameN\n"\
    "This program will count the number of records in tables\n";
#endif
  ndb_std_print_version();
  print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
  puts("");
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
예제 #6
0
파일: main.cpp 프로젝트: soundgnome/mysqlcc
static void usage()
{
  print_version();
  printf("usage: %s [options] [database]\n\n", progname);
  printf("Options:\n");
  my_print_help(my_long_options);

#ifndef WIN32  //Win32 doesn't support load_defaults yet.
  print_defaults("my", load_default_groups);  
#endif

  my_print_variables(my_long_options);
  exit(-1);
}
예제 #7
0
파일: desc.cpp 프로젝트: A-eolus/mysql
static void usage()
{
#ifdef NOT_USED
  char desc[] = 
    "tabname\n"\
    "This program list all properties of table(s) in NDB Cluster.\n"\
    "  ex: desc T1 T2 T4\n";
#endif
  ndb_std_print_version();
  print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
  puts("");
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
예제 #8
0
static void usage(void)
{
/* show the usage string when the user asks for this */
 putc('\n', stdout);
 printf("%s  Ver %s Distrib %s, for %s (%s)\n",
 my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
 puts("By Monty, Venu, Kent and others\n");
 printf("\
Copyright (C) 2002-2004 MySQL AB\n\
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
and you are welcome to modify and redistribute it under the GPL license\n");
 printf("Usage: %s [OPTIONS] [TESTNAME1 TESTNAME2...]\n", my_progname);
 my_print_help(client_test_long_options);
 print_defaults("my", client_test_load_default_groups);
 my_print_variables(client_test_long_options);
}
static void usage(void)
{
  print_version();
  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
  printf("\
Loads tables from text files in various formats.  The base name of the\n\
text file must be the name of the table that should be used.\n\
If one uses sockets to connect to the MySQL server, the server will open and\n\
read the text file directly. In other cases the client will open the text\n\
file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n");

  printf("\nUsage: %s [OPTIONS] database textfile...",my_progname);
  print_defaults("my",load_default_groups);
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
예제 #10
0
static void usage()
{
#ifdef NOT_USED
    char desc[] =
        "tabname\n"\
        "This program reads all records from one table in NDB Cluster\n"\
        "and print them to stdout.  This is performed using a scan read.\n"\
        "(It only print error messages if it encounters a permanent error.)\n"\
        "It can also be used to dump the content of a table to file \n"\
        "  ex: select_all --no-header --delimiter=';' T4 > T4.data\n";
#endif
    ndb_std_print_version();
    print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
    puts("");
    my_print_help(my_long_options);
    my_print_variables(my_long_options);
}
예제 #11
0
static void usage()
{
#ifdef NOT_USED
  char desc[] = 
    "tabname\n"\
    "This program list all system objects in  NDB Cluster.\n"\
    "Type of objects to display can be limited with -t option\n"\
    " ex: ndb_show_tables -t 2 would show all UserTables\n"\
    "To show all indexes for a table write table name as final argument\n"\
    "  ex: ndb_show_tables T1\n";
#endif
  ndb_std_print_version();
  print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
  puts("");
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
예제 #12
0
파일: mysqlshow.c 프로젝트: isleon/Jaxer
static void usage(void)
{
  print_version();
  puts("Copyright (C) 2000-2006 MySQL AB");
  puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
  puts("Shows the structure of a mysql database (databases,tables and columns)\n");
  printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname);
  puts("\n\
If last argument contains a shell or SQL wildcard (*,?,% or _) then only\n\
what\'s matched by the wildcard is shown.\n\
If no database is given then all matching databases are shown.\n\
If no table is given then all matching tables in database are shown\n\
If no column is given then all matching columns and columntypes in table\n\
are shown");
  print_defaults("my",load_default_groups);
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
예제 #13
0
static void usage(void)
{
  print_version();
  puts("Copyright (C) 2007 MySQL AB, 2009-2011 Monty Program Ab");
  puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,");
  puts("and you are welcome to modify and redistribute it under the GPL license\n");

  puts("Display and apply log records from a Aria transaction log");
  puts("found in the current directory (for now)");
#ifndef IDENTICAL_PAGES_AFTER_RECOVERY
  puts("\nNote: Aria is compiled without -DIDENTICAL_PAGES_AFTER_RECOVERY\n"
       "which means that the table files are not byte-to-byte identical to\n"
       "files created during normal execution. This should be ok, except for\n"
       "test scripts that tries to compare files before and after recovery.");
#endif
  printf("\nUsage: %s OPTIONS\n", my_progname_short);
  puts("You need to use one of -d or -a");
  my_print_help(my_long_options);
  print_defaults("my", load_default_groups);
  my_print_variables(my_long_options);
}
예제 #14
0
파일: mysqlcheck.c 프로젝트: A-eolus/mysql
static void usage(void)
{
  print_version();
  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
  puts("This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),");
  puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
  puts("used at the same time. Not all options are supported by all storage engines.");
  puts("Please consult the MySQL manual for latest information about the");
  puts("above. The options -c, -r, -a, and -o are exclusive to each other, which");
  puts("means that the last option will be used, if several was specified.\n");
  puts("The option -c will be used by default, if none was specified. You");
  puts("can change the default behavior by making a symbolic link, or");
  puts("copying this file somewhere with another name, the alternatives are:");
  puts("mysqlrepair:   The default option will be -r");
  puts("mysqlanalyze:  The default option will be -a");
  puts("mysqloptimize: The default option will be -o\n");
  printf("Usage: %s [OPTIONS] database [tables]\n", my_progname);
  printf("OR     %s [OPTIONS] --databases DB1 [DB2 DB3...]\n",
	 my_progname);
  printf("OR     %s [OPTIONS] --all-databases\n", my_progname);
  print_defaults("my", load_default_groups);
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
} /* usage */
예제 #15
0
static void usage(void)
{
  DBUG_ENTER("usage");
  print_version();
  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
  puts("This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),");
  puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
  puts("used at the same time. Not all options are supported by all storage engines.");
  puts("The options -c, -r, -a, and -o are exclusive to each other, which");
  puts("means that the last option will be used, if several was specified.\n");
  puts("The option -c (--check) will be used by default, if none was specified.");
  puts("You can change the default behavior by making a symbolic link, or");
  puts("copying this file somewhere with another name, the alternatives are:");
  puts("mysqlrepair:   The default option will be -r");
  puts("mysqlanalyze:  The default option will be -a");
  puts("mysqloptimize: The default option will be -o\n");
  puts("Please consult the MariaDB/MySQL knowledgebase at");
  puts("http://kb.askmonty.org/v/mysqlcheck for latest information about");
  puts("this program.");
  print_defaults("my", load_default_groups);
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
  DBUG_VOID_RETURN;
} /* usage */
예제 #16
0
static my_bool
get_one_option(int optid, const struct my_option *opt,
               char *argument)
{
  my_bool add_option= TRUE;

  switch (optid) {

  case '?':
    printf("%s  Ver %s Distrib %s, for %s (%s)\n",
           my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
    puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
    puts("MariaDB utility for upgrading databases to new MariaDB versions.");
    print_defaults("my", load_default_groups);
    puts("");
    my_print_help(my_long_options);
    my_print_variables(my_long_options);
    die(0);
    break;

  case '#':
    DBUG_PUSH(argument ? argument : default_dbug_option);
    add_option= FALSE;
    debug_check_flag= 1;
    break;

  case 'p':
    if (argument == disabled_my_option)
      argument= (char*) "";			/* Don't require password */
    tty_password= 1;
    add_option= FALSE;
    if (argument)
    {
      /* Add password to ds_args before overwriting the arg with x's */
      add_one_option(&ds_args, opt, argument);
      while (*argument)
        *argument++= 'x';                       /* Destroy argument */
      tty_password= 0;
    }
    break;

  case 't':
    strnmov(opt_tmpdir, argument, sizeof(opt_tmpdir));
    add_option= FALSE;
    break;

  case 'b': /* --basedir   */
  case 'd': /* --datadir   */
    fprintf(stderr, "%s: the '--%s' option is always ignored\n",
            my_progname, optid == 'b' ? "basedir" : "datadir");
    /* FALLTHROUGH */

  case 'k':                                     /* --version-check */
  case 'v': /* --verbose   */
    opt_verbose++;
    if (argument == disabled_my_option)
    {
      opt_verbose= 0;
      opt_silent= 1;
    }
    add_option= 0;
    break;
  case 'V':
    printf("%s  Ver %s Distrib %s, for %s (%s)\n",
           my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
    die(0);
    break;
  case OPT_SILENT:
    opt_verbose= 0;
    add_option= 0;
    break;
  case 'f': /* --force     */
  case 's':                                     /* --upgrade-system-tables */
  case OPT_WRITE_BINLOG:                        /* --write-binlog */
    add_option= FALSE;
    break;

  case 'h': /* --host */
  case 'W': /* --pipe */
  case 'P': /* --port */
  case 'S': /* --socket */
  case OPT_MYSQL_PROTOCOL: /* --protocol */
  case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
  case OPT_PLUGIN_DIR:                          /* --plugin-dir */
  case OPT_DEFAULT_AUTH:                        /* --default-auth */
    add_one_option(&conn_args, opt, argument);
    break;
  }

  if (add_option)
  {
    /*
      This is an option that is accpted by mysql_upgrade just so
      it can be passed on to "mysql" and "mysqlcheck"
      Save it in the ds_args string
    */
    add_one_option(&ds_args, opt, argument);
  }
  return 0;
}
예제 #17
0
파일: config.c 프로젝트: andreiw/polaris
int
parse_config(char *config_file, boolean_t file_required)
{
	FILE *fp;
	char line[MAXLINELEN];
	char pline[MAXLINELEN];
	int argcount;
	char *argvec[MAXARGSPERLINE];
	int defaultdone = 0;	/* Set when first non-default command found */

	if (debug & D_CONFIG)
		logmsg(LOG_DEBUG, "parse_config()\n");

	set_protocol_defaults();
	if (debug & D_DEFAULTS)
		print_defaults();

	fp = open_conffile(config_file);
	if (fp == NULL) {
		if (errno == ENOENT && !file_required)
			return (0);
		logperror(config_file);
		return (-1);
	}
	while (readline(fp, line, sizeof (line)) != 0) {
		(void) strncpy(pline, line, sizeof (pline));
		pline[sizeof (pline) - 1] = '\0';	/* NULL terminate */
		argcount = parse_line(pline, argvec,
		    sizeof (argvec) / sizeof (argvec[0]));
		if (debug & D_PARSE) {
			int i;

			logmsg(LOG_DEBUG, "scanned %d args\n", argcount);
			for (i = 0; i < argcount; i++)
				logmsg(LOG_DEBUG, "arg[%d]: %s\n",
				    i, argvec[i]);
		}
		if (argcount == 0) {
			/* Empty line - or comment only line */
			continue;
		}
		if (strcmp(argvec[0], "ifdefault") == 0) {
			char save[sizeof (ifdefaults)];

			if (defaultdone) {
				conferr("ifdefault after non-default "
				    "command\n");
				continue;
			}
			/*
			 * Save existing values in case what we read is
			 * invalid and we need to restore previous settings.
			 */
			(void) memcpy(save, ifdefaults, sizeof (ifdefaults));
			parse_default(CONFIG_IF, iflist, argvec+1, argcount-1,
			    ifdefaults);
			check_if_var_consistency(ifdefaults, save,
			    sizeof (save));
		} else if (strcmp(argvec[0], "prefixdefault") == 0) {
			char save[sizeof (prefixdefaults)];

			if (defaultdone) {
				conferr("prefixdefault after non-default "
				    "command\n");
				continue;
			}
			/*
			 * Save existing values in case what we read is
			 * invalid and we need to restore previous settings.
			 */
			(void) memcpy(save, prefixdefaults,
			    sizeof (prefixdefaults));
			parse_default(CONFIG_PREFIX, prefixlist, argvec+1,
			    argcount-1, prefixdefaults);
			check_var_consistency(prefixdefaults, save,
			    sizeof (save));
		} else if (strcmp(argvec[0], "if") == 0) {
			defaultdone = 1;
			parse_if(iflist, argvec+1, argcount-1);
		} else if (strcmp(argvec[0], "prefix") == 0) {
			defaultdone = 1;
			parse_prefix(prefixlist, argvec+1, argcount-1);
		} else {
			conferr("Unknown command: %s\n", argvec[0]);
		}
	}
	(void) fclose(fp);
	if (debug & D_DEFAULTS)
		print_defaults();
	return (0);
}
예제 #18
0
파일: main.c 프로젝트: bert/pcb-rnd
int
main (int argc, char *argv[])
{
  int i;

  /* init application:
   * - make program name available for error handlers
   * - evaluate special options
   * - initialize toplevel shell and resources
   * - create an empty PCB with default symbols
   * - initialize all other widgets
   * - update screen and get size of drawing area
   * - evaluate command-line arguments
   * - register 'call on exit()' function
   */

  setbuf (stdout, 0);
  InitPaths (argv[0]);

#ifdef LOCALEDIR
  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
  textdomain(GETTEXT_PACKAGE);
  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
  setlocale(LC_ALL,"");
#endif

  srand ( time(NULL) ); /* Set seed for rand() */

  initialize_units();
  polygon_init ();
  hid_init ();

  hid_load_settings ();

  program_name = argv[0];
  program_basename = strrchr (program_name, PCB_DIR_SEPARATOR_C);
  if (program_basename)
    {
      program_directory = strdup (program_name);
      *strrchr (program_directory, PCB_DIR_SEPARATOR_C) = 0;
      program_basename++;
    }
  else
    {
      program_directory = ".";
      program_basename = program_name;
    }
  Progname = program_basename;

  /* Print usage or version if requested.  Then exit.  */  
  if (argc > 1 &&
      (strcmp (argv[1], "-h") == 0 ||
       strcmp (argv[1], "-?") == 0 ||
       strcmp (argv[1], "--help") == 0))
    usage ();
  if (argc > 1 && strcmp (argv[1], "-V") == 0)
    print_version ();
  /* Export pcb from command line if requested.  */
  if (argc > 1 && strcmp (argv[1], "-p") == 0)
    {
      exporter = gui = hid_find_printer ();
      argc--;
      argv++;
    }
  else if (argc > 2 && strcmp (argv[1], "-x") == 0)
    {
      exporter = gui = hid_find_exporter (argv[2]);
      argc -= 2;
      argv += 2;
    }
    /* Otherwise start GUI. */
  else if (argc > 2 && strcmp (argv[1], "--gui") == 0)
  {
    gui = hid_find_gui (argv[2]);
    if (gui == NULL) {
      Message("Can't find the gui requested.\n");
      exit(1);
    }
    argc -= 2;
    argv += 2;
  }
  else {
    const char **g;

    gui = NULL;
    for(g = try_gui_hids; (*g != NULL) && (gui == NULL); g++) {
      gui = hid_find_gui (*g);
    }

    /* try anything */
    if (gui == NULL) {
      Message("Warning: can't find any of the preferred GUIs, falling back to anything available...\n");
      gui = hid_find_gui (NULL);
    }
  }

  /* Exit with error if GUI failed to start. */
  if (!gui)
    exit (1);

/* Initialize actions only when the gui is already known so only the right
   one is registered (there can be only one GUI). */
#include "action_list.h"


  /* Set up layers. */
  for (i = 0; i < MAX_LAYER; i++)
    {
      char buf[20];
      sprintf (buf, "signal%d", i + 1);
      Settings.DefaultLayerName[i] = strdup (buf);
      Settings.LayerColor[i] = "#c49350";
      Settings.LayerSelectedColor[i] = "#00ffff";
    }

  gui->parse_arguments (&argc, &argv);

  if (show_help || (argc > 1 && argv[1][0] == '-'))
    usage ();
  if (show_version)
    print_version ();
  if (show_defaults)
    print_defaults ();
  if (show_copyright)
    copyright ();

  settings_post_process ();


  if (show_actions)
    {
      print_actions ();
      exit (0);
    }

  if (do_dump_actions)
    {
      extern void dump_actions (void);
      dump_actions ();
      exit (0);
    }

  set_fontfile();

  /* Create a new PCB object in memory */
  PCB = CreateNewPCB ();

	if (PCB == NULL) {
		Message("Can't load the default pcb (%s) for creating an empty layout\n", Settings.DefaultPcbFile);
		exit(1);
	}

  /* Add silk layers to newly created PCB */
  CreateNewPCBPost (PCB, 1);
  if (argc > 1)
    command_line_pcb = argv[1];

  ResetStackAndVisibility ();

  if (gui->gui)
    InitCrosshair ();
  InitHandler ();
  InitBuffers ();
  SetMode (ARROW_MODE);

  if (command_line_pcb)
    {
      /* keep filename even if initial load command failed;
       * file might not exist
       */
      if (LoadPCB (command_line_pcb))
	PCB->Filename = strdup (command_line_pcb);
    }

  if (Settings.InitialLayerStack
      && Settings.InitialLayerStack[0])
    {
      LayerStringToLayerStack (Settings.InitialLayerStack);
    }

  /* This must be called before any other atexit functions
   * are registered, as it configures an atexit function to
   * clean up and free various items of allocated memory,
   * and must be the last last atexit function to run.
   */
  leaky_init ();

  /* Register a function to be called when the program terminates.
   * This makes sure that data is saved even if LEX/YACC routines
   * abort the program.
   * If the OS doesn't have at least one of them,
   * the critical sections will be handled by parse_l.l
   */
  atexit (EmergencySave);

  /* read the library file and display it if it's not empty
   */
  if (!ReadLibraryContents () && Library.MenuN)
    hid_action ("LibraryChanged");

#ifdef HAVE_LIBSTROKE
  stroke_init ();
#endif

  if (Settings.ScriptFilename)
    {
      Message (_("Executing startup script file %s\n"),
	       Settings.ScriptFilename);
      hid_actionl ("ExecuteFile", Settings.ScriptFilename, NULL);
    }
  if (Settings.ActionString)
    {
      Message (_("Executing startup action %s\n"), Settings.ActionString);
      hid_parse_actions (Settings.ActionString);
    }

  if (gui->printer || gui->exporter)
    {
      // Workaround to fix batch output for non-C locales
      setlocale(LC_NUMERIC,"C");
      gui->do_export (0);
      exit (0);
    }

#if HAVE_DBUS
  pcb_dbus_setup();
#endif

  EnableAutosave ();

#ifdef DEBUG
  printf ("Settings.FontPath            = \"%s\"\n", 
          Settings.FontPath);
  printf ("Settings.ElementPath         = \"%s\"\n", 
          Settings.ElementPath);
  printf ("Settings.LibrarySearchPaths  = \"%s\"\n", 
          Settings.LibrarySearchPaths);
  printf ("Settings.LibraryShell        = \"%s\"\n", 
          Settings.LibraryShell);
  printf ("Settings.MakeProgram = \"%s\"\n",
          UNKNOWN (Settings.MakeProgram));
  printf ("Settings.GnetlistProgram = \"%s\"\n",
          UNKNOWN (Settings.GnetlistProgram));
#endif

	buildin_init();

  gui->do_export (0);
#if HAVE_DBUS
  pcb_dbus_finish();
#endif

  return (0);
}