Exemple #1
0
int main(int argc, char *argv[])
{
  MY_INIT(argv[0]);
  {
    uint row_count;
    struct errors *error_head;
    struct languages *lang_head;
    DBUG_ENTER("main");

    charsets_dir= DEFAULT_CHARSET_DIR;
    my_umask_dir= 0777;
    if (get_options(&argc, &argv))
      DBUG_RETURN(1);
    if (!(row_count= parse_input_file(TXTFILE, &error_head, &lang_head)))
    {
      fprintf(stderr, "Failed to parse input file %s\n", TXTFILE);
      DBUG_RETURN(1);
    }
#if MYSQL_VERSION_ID >= 50100 && MYSQL_VERSION_ID < 50500
/* Number of error messages in 5.1 - do not change this number! */
#define MYSQL_OLD_GA_ERROR_MESSAGE_COUNT 641
#elif MYSQL_VERSION_ID >= 50500 && MYSQL_VERSION_ID < 50600
/* Number of error messages in 5.5 - do not change this number! */
#define MYSQL_OLD_GA_ERROR_MESSAGE_COUNT 728
#endif
#if MYSQL_OLD_GA_ERROR_MESSAGE_COUNT
    if (row_count != MYSQL_OLD_GA_ERROR_MESSAGE_COUNT)
    {
      fprintf(stderr, "Can only add new error messages to latest GA. ");
      fprintf(stderr, "Use ER_UNKNOWN_ERROR instead.\n");
      fprintf(stderr, "Expected %u messages, found %u.\n",
              MYSQL_OLD_GA_ERROR_MESSAGE_COUNT, row_count);
      DBUG_RETURN(1);
    }
#endif
    if (lang_head == NULL || error_head == NULL)
    {
      fprintf(stderr, "Failed to parse input file %s\n", TXTFILE);
      DBUG_RETURN(1);
    }

    if (create_header_files(error_head))
    {
      fprintf(stderr, "Failed to create header files\n");
      DBUG_RETURN(1);
    }
    if (create_sys_files(lang_head, error_head, row_count))
    {
      fprintf(stderr, "Failed to create sys files\n");
      DBUG_RETURN(1);
    }
    clean_up(lang_head, error_head);
    DBUG_LEAVE;			/* Can't use dbug after my_end() */
    my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
    return 0;
  }
}
int main(int argc, char *argv[])
{
  MY_INIT(argv[0]);
  {
    uint row_count;
    struct errors *error_head;
    struct languages *lang_head;
    DBUG_ENTER("main");

    charsets_dir= DEFAULT_CHARSET_DIR;
    my_umask_dir= 0777;
    if (get_options(&argc, &argv))
      DBUG_RETURN(1);
    if (!(row_count= parse_input_file(TXTFILE, &error_head, &lang_head)))
    {
      fprintf(stderr, "Failed to parse input file %s\n", TXTFILE);
      DBUG_RETURN(1);
    }
    if (lang_head == NULL || error_head == NULL)
    {
      fprintf(stderr, "Failed to parse input file %s\n", TXTFILE);
      DBUG_RETURN(1);
    }

    if (create_header_files(error_head))
    {
      fprintf(stderr, "Failed to create header files\n");
      DBUG_RETURN(1);
    }
    if (create_sys_files(lang_head, error_head, row_count))
    {
      fprintf(stderr, "Failed to create sys files\n");
      DBUG_RETURN(1);
    }
    clean_up(lang_head, error_head);
    DBUG_LEAVE;			/* Can't use dbug after my_end() */
    my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
    return 0;
  }
}