Example #1
0
static void netware_init()
{
  char cwd[PATH_MAX], *name;

  DBUG_ENTER("netware_init");

  /* init only if we are not a client library */
  if (my_progname)
  {
#if SUPPORTED_BY_LIBC   /* Removed until supported in Libc */
    struct termios tp;
    /* Disable control characters */
    tcgetattr(STDIN_FILENO, &tp);
    tp.c_cc[VINTR] = _POSIX_VDISABLE;
    tp.c_cc[VEOF] = _POSIX_VDISABLE;
    tp.c_cc[VSUSP] = _POSIX_VDISABLE;
    tcsetattr(STDIN_FILENO, TCSANOW, &tp);
#endif /* SUPPORTED_BY_LIBC */

    /* With stdout redirection */
    if (!isatty(STDOUT_FILENO))
    {
      setscreenmode(SCR_AUTOCLOSE_ON_EXIT);      /* auto close the screen */
    }
    else
    {
      setscreenmode(SCR_NO_MODE);		/* keep the screen up */
    }

    /* Parse program name and change to base format */
    name= (char*) my_progname;
    for (; *name; name++)
    {
      if (*name == '\\')
      {
        *name = '/';
      }
      else
      {
        *name = tolower(*name);
      }
    }
  }

  DBUG_VOID_RETURN;
}
Example #2
0
/******************************************************************************

	main()

******************************************************************************/
int main(int argc, char **argv)
{
    // get options
    get_options(argc, argv);

    // check for an autoclose option
    if (!autoclose) setscreenmode(SCR_NO_MODE);

    // header
    printf("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE,
           MACHINE_TYPE);

    // create paths
    create_paths();

    // install the database
    if (mysql_install_db(argc, argv))
    {
        printf("ERROR - The database creation failed!\n");
        printf("        %s\n", strerror(errno));
        printf("See the following log for more infomration:\n");
        printf("\t%s\n\n", err_log);
        exit(-1);
    }

    // status
    printf("Initial database successfully created in the directory:\n");
    printf("\t%s\n", datadir);

    // info
    printf("\nPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !\n");

    printf("\nThis is done with:\n");
    printf("\tmysqladmin -u root password 'new-password'\n");

    printf("\nSee the manual for more instructions.\n");

    printf("\nYou can start the MySQL daemon with:\n");
    printf("\tmysqld_safe\n");

    printf("\nPlease report any problems with:\n");
    printf("\t/mysql/mysqlbug.txt\n");

    printf("\nThe latest information about MySQL is available on the web at\n");
    printf("\thttp://www.mysql.com\n");

    printf("\nSupport MySQL by buying support at http://shop.mysql.com\n\n");

    return 0;
}
Example #3
0
void generalcommands(void)
{
    /* Block selecting */
    if (key == KEY_Z) blk--;
    if (key == KEY_X) blk++;
    if (key == KEY_A) blk -= 10;
    if (key == KEY_S) blk += 10;
    if (blk < 0) blk = 0;
    if (blk > (int)gfx_nblocks) blk = gfx_nblocks;

    /* General commands */
    if (key == KEY_SCROLLLOCK) scrolllock ^= 1;
    if (key == KEY_1)
    {
        cl = 0;
        mark = 0;
    }
    if (key == KEY_2)
    {
        cl = 1;
        mark = 0;
    }
    if (key == KEY_3)
    {
        cl = 2;
        mark = 0;
    }
    if (key == KEY_4)
    {
        cl = 3;
        mark = 0;
    }
    if (key == KEY_5) layervisible[0] ^=1;
    if (key == KEY_6) layervisible[1] ^=1;
    if (key == KEY_7) layervisible[2] ^=1;
    if (key == KEY_8) layervisible[3] ^=1;
    if (key == KEY_L) layeroptions();
    if (key == KEY_F3) loadblocks();
    if (key == KEY_F4) loadpalette();
    if (key == KEY_F1) loadmapname();
    if (key == KEY_F2) savemap();
    if (key == KEY_F10) help();
    if (key == KEY_F12)
    {
        screenmode++;
        if (screenmode > GFX_DOUBLESIZE) screenmode = 0;
        setscreenmode();
    }
}
Example #4
0
void generalcommands(void)
{
    // Block selecting
    if (key == KEY_Z) blk--;
    if (key == KEY_X) blk++;
    if (key == KEY_COMMA) blk--;
    if (key == KEY_COLON) blk++;
    if (key == KEY_A) blk -= 10;
    if (key == KEY_S) blk += 10;
    if (key == KEY_F1) loadinf();
    if (key == KEY_F2) saveinf();
    if (key == KEY_F3) loadblocks();
    if (key == KEY_F4) loadpalette();
    if (blk < 0) blk = 0;
    if (blk > (int)gfx_nblocks) blk = gfx_nblocks;
    if (key == KEY_F10) help();
    if (key == KEY_F12)
    {
        screenmode++;
        if (screenmode > GFX_DOUBLESIZE) screenmode = 0;
        setscreenmode();
    }
    if (key == KEY_C) memset(&blkinfdata[blk*16], 0, 16);
    if (key == KEY_P) memcpy(copybuffer, &blkinfdata[blk*16], 16);
    if (key == KEY_T) memcpy(&blkinfdata[blk*16], copybuffer, 16);

    if ((mousey >= 64) && (mousey < 80))
    {
        if ((mousex >= 32) && (mousex < 8*24+32))
        {
            int bit = (mousex - 32) / 24;
            int fine = (mousex - 32) % 24;
            if (fine < 16)
            {
                if (mouseb & 1)
                {
                    blkinfdata[blk*16+((mousey-64)/4)*4+fine/4] |= 1 << bit;
                }
                if (mouseb & 2)
                {
                    blkinfdata[blk*16+((mousey-64)/4)*4+fine/4] &= 0xff - (1 << bit);
                }
            }
        }
    }
}
Example #5
0
void initstuff(void)
{
    win_openwindow("Map Editor V1.26", NULL);
    win_setmousemode(MOUSE_ALWAYS_HIDDEN);
    win_fullscreen = 1;
    setscreenmode();
    kbd_init();
    mou_init();
    if (!gfx_loadsprites(SPR_FONTS, "fonts.spr"))
    {
        win_messagebox("Sprite load error (FONTS.SPR)");
        exit(1);
    }
    if (!gfx_loadsprites(SPR_EDITOR, "editor.spr"))
    {
        win_messagebox("Sprite load error (FONTS.SPR)");
        exit(1);
    }
    io_setfilemode(0); /* Rest of file access happens without datafile */
}
Example #6
0
void initstuff(void)
{
    FILE *handle;

    win_openwindow("Block-info Editor V1.26", NULL);
    win_fullscreen = 1;
    win_setmousemode(MOUSE_ALWAYS_HIDDEN);
    setscreenmode();
    kbd_init();
    mou_init();
    if (!gfx_loadsprites(SPR_FONTS, "fonts.spr"))
    {
        win_messagebox("Sprite load error (FONTS.SPR)");
        exit(1);
    }
    if (!gfx_loadsprites(SPR_EDITOR, "editor.spr"))
    {
        win_messagebox("Sprite load error (EDITOR.SPR)");
        exit(1);
    }
    blkinfdata = malloc((MAXBLOCKS+1)*16);
    if (!blkinfdata)
    {
        win_messagebox("No memory for blockinfotable!");
        exit(1);
    }
    memset(blkinfdata, 0, (MAXBLOCKS+1)*16);

    io_setfilemode(0); // Rest of file access happens without datafile

    gfx_loadblocks(blkname);
    gfx_loadpalette(palname);
    gfx_calcpalette(64,0,0,0);
    gfx_setpalette();
    handle = fopen(infname, "rb");
    if (!handle) return;
    fread(&blkinfdata[0], (gfx_nblocks+1) * 16, 1, handle);
    fclose(handle);
}
Example #7
0
int main(int argc, char **argv)
{
  char self_name[FN_REFLEN];

  MY_INIT(argv[0]);
#ifdef __NETWARE__
  setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
#endif

#if __WIN__
  if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
#endif
  {
    strncpy(self_name, argv[0], FN_REFLEN);
  }

  if (init_dynamic_string(&ds_args, "", 512, 256) ||
      init_dynamic_string(&conn_args, "", 512, 256))
    die("Out of memory");

  load_defaults("my", load_default_groups, &argc, &argv);
  defaults_argv= argv; /* Must be freed by 'free_defaults' */

  if (handle_options(&argc, &argv, my_long_options, get_one_option))
    die(NULL);
  if (debug_info_flag)
    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
  if (debug_check_flag)
    my_end_arg= MY_CHECK_ERROR;

  if (tty_password)
  {
    opt_password= get_tty_password(NullS);
    /* add password to defaults file */
    dynstr_append_os_quoted(&ds_args, "--password="******" ");
  }
  /* add user to defaults file */
  dynstr_append_os_quoted(&ds_args, "--user="******" ");

  /* Find mysql */
  find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);

  /* Find mysqlcheck */
  find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);

  /*
    Read the mysql_upgrade_info file to check if mysql_upgrade
    already has been run for this installation of MySQL
  */
  if (!opt_force && upgrade_already_done())
  {
    printf("This installation of MySQL is already upgraded to %s, "
           "use --force if you still need to run mysql_upgrade\n",
           MYSQL_SERVER_VERSION);
    die(NULL);
  }

  /*
    Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
  */
  if (run_mysqlcheck_fixnames() ||
      run_mysqlcheck_upgrade() ||
      run_sql_fix_privilege_tables())
  {
    /*
      The upgrade failed to complete in some way or another,
      significant error message should have been printed to the screen
    */
    die("Upgrade failed" );
  }
  verbose("OK");

  /* Create a file indicating upgrade has been performed */
  create_mysql_upgrade_info_file();

  free_used_memory();
  my_end(my_end_arg);
  exit(0);
}