~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzle.c

  • Committer: Monty Taylor
  • Date: 2008-08-02 00:45:47 UTC
  • mto: (236.1.42 codestyle)
  • mto: This revision was merged to the branch mainline in revision 261.
  • Revision ID: monty@inaugust.com-20080802004547-bj3q88qrkhqfffws
Changed gettext() to _() in drizzle.c.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1123
1123
  window_resize(0);
1124
1124
#endif
1125
1125
 
1126
 
  put_info(gettext("Welcome to the Drizzle client..  Commands end with ; or \\g."),
 
1126
  put_info(_("Welcome to the Drizzle client..  Commands end with ; or \\g."),
1127
1127
           INFO_INFO,0,0);
1128
1128
 
1129
1129
  glob_buffer= (DYNAMIC_STRING *)my_malloc(sizeof(DYNAMIC_STRING), MYF(0));
1131
1131
 
1132
1132
  /* this is a slight abuse of the DYNAMIC_STRING interface. deal. */
1133
1133
  sprintf(glob_buffer->str,
1134
 
          gettext("Your Drizzle connection id is %u\nServer version: %s\n"),
 
1134
          _("Your Drizzle connection id is %u\nServer version: %s\n"),
1135
1135
          drizzle_thread_id(&drizzle), server_version_string(&drizzle));
1136
1136
  put_info(glob_buffer->str, INFO_INFO, 0, 0);
1137
1137
  dynstr_set(glob_buffer, NULL);
1161
1161
    if (histfile)
1162
1162
    {
1163
1163
      if (verbose)
1164
 
        tee_fprintf(stdout, gettext("Reading history-file %s\n"),histfile);
 
1164
        tee_fprintf(stdout, _("Reading history-file %s\n"),histfile);
1165
1165
      read_history(histfile);
1166
1166
      if (!(histfile_tmp= (char*) my_malloc((uint) strlen(histfile) + 5,
1167
1167
                                            MYF(MY_WME))))
1168
1168
      {
1169
 
        fprintf(stderr, gettext("Couldn't allocate memory for temp histfile!\n"));
 
1169
        fprintf(stderr, _("Couldn't allocate memory for temp histfile!\n"));
1170
1170
        exit(1);
1171
1171
      }
1172
1172
      sprintf(histfile_tmp, "%s.TMP", histfile);
1173
1173
    }
1174
1174
  }
1175
1175
  sprintf(buff, "%s",
1176
 
          gettext("Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"));
 
1176
          _("Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"));
1177
1177
 
1178
1178
  put_info(buff,INFO_INFO,0,0);
1179
1179
  status.exit_status= read_and_execute(!status.batch);
1192
1192
  {
1193
1193
    /* write-history */
1194
1194
    if (verbose)
1195
 
      tee_fprintf(stdout, gettext("Writing history-file %s\n"),histfile);
 
1195
      tee_fprintf(stdout, _("Writing history-file %s\n"),histfile);
1196
1196
    if (!write_history(histfile_tmp))
1197
1197
      my_rename(histfile_tmp, histfile, MYF(MY_WME));
1198
1198
  }
1201
1201
  free_root(&hash_mem_root,MYF(0));
1202
1202
 
1203
1203
  if (sig >= 0)
1204
 
    put_info(sig ? gettext("Aborted") : gettext("Bye"), INFO_RESULT,0,0);
 
1204
    put_info(sig ? _("Aborted") : _("Bye"), INFO_RESULT,0,0);
1205
1205
  if (glob_buffer)
1206
1206
    dynstr_free(glob_buffer);
1207
1207
  my_free(glob_buffer, MYF(MY_ALLOW_ZERO_PTR));
1254
1254
  sprintf(kill_buffer, "KILL /*!50000 QUERY */ %u", drizzle_thread_id(&drizzle));
1255
1255
  drizzle_real_query(kill_drizzle, kill_buffer, strlen(kill_buffer));
1256
1256
  drizzle_close(kill_drizzle);
1257
 
  tee_fprintf(stdout, gettext("Query aborted by Ctrl+C\n"));
 
1257
  tee_fprintf(stdout, _("Query aborted by Ctrl+C\n"));
1258
1258
 
1259
1259
  interrupted_query= 1;
1260
1260
 
1463
1463
{
1464
1464
  const char* readline= "readline";
1465
1465
 
1466
 
  printf(gettext("%s  Ver %s Distrib %s, for %s (%s) using %s %s\n"),
 
1466
  printf(_("%s  Ver %s Distrib %s, for %s (%s) using %s %s\n"),
1467
1467
         my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE,
1468
1468
         readline, rl_library_version);
1469
1469
 
1470
1470
  if (version)
1471
1471
    return;
1472
 
  printf(gettext("\
 
1472
  printf(_("\
1473
1473
Copyright (C) 2000-2008 MySQL AB\n                                      \
1474
1474
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n \
1475
1475
and you are welcome to modify and redistribute it under the GPL license\n"));
1476
 
  printf(gettext("Usage: %s [OPTIONS] [database]\n"), my_progname);
 
1476
  printf(_("Usage: %s [OPTIONS] [database]\n"), my_progname);
1477
1477
  my_print_help(my_long_options);
1478
1478
  print_defaults("my", load_default_groups);
1479
1479
  my_print_variables(my_long_options);
1506
1506
      }
1507
1507
      else
1508
1508
      {
1509
 
        put_info(gettext("DELIMITER cannot contain a backslash character"),
 
1509
        put_info(_("DELIMITER cannot contain a backslash character"),
1510
1510
                 INFO_ERROR,0,0);
1511
1511
        return 0;
1512
1512
      }
1527
1527
      init_tee(argument);
1528
1528
    break;
1529
1529
  case OPT_NOTEE:
1530
 
    printf(gettext("WARNING: option deprecated; use --disable-tee instead.\n"));
 
1530
    printf(_("WARNING: option deprecated; use --disable-tee instead.\n"));
1531
1531
    if (opt_outfile)
1532
1532
      end_tee();
1533
1533
    break;
1550
1550
    }
1551
1551
    break;
1552
1552
  case OPT_NOPAGER:
1553
 
    printf(gettext("WARNING: option deprecated; use --disable-pager instead.\n"));
 
1553
    printf(_("WARNING: option deprecated; use --disable-pager instead.\n"));
1554
1554
    opt_nopager= 1;
1555
1555
    break;
1556
1556
  case OPT_DRIZZLE_PROTOCOL:
1929
1929
      }
1930
1930
      else
1931
1931
      {
1932
 
        sprintf(buff,gettext("Unknown command '\\%c'."),inchar);
 
1932
        sprintf(buff,_("Unknown command '\\%c'."),inchar);
1933
1933
        if (put_info(buff,INFO_ERROR,0,0) > 0)
1934
1934
          return(1);
1935
1935
        *out++='\\';
2359
2359
    {
2360
2360
      if (drizzle_num_rows(tables) > 0 && !opt_silent && write_info)
2361
2361
      {
2362
 
        tee_fprintf(stdout, gettext("\
 
2362
        tee_fprintf(stdout, _("\
2363
2363
Reading table information for completion of table and column names\n    \
2364
2364
You can turn off this feature to get a quicker startup with -A\n\n"));
2365
2365
      }
2456
2456
  /* purecov: begin tested */
2457
2457
  if (opt_reconnect)
2458
2458
  {
2459
 
    put_info(gettext("No connection. Trying to reconnect..."),INFO_INFO,0,0);
 
2459
    put_info(_("No connection. Trying to reconnect..."),INFO_INFO,0,0);
2460
2460
    (void) com_connect((DYNAMIC_STRING *) 0, 0);
2461
2461
    if (opt_rehash)
2462
2462
      com_rehash(NULL, NULL);
2463
2463
  }
2464
2464
  if (!connected)
2465
 
    return put_info(gettext("Can't connect to the server\n"),INFO_ERROR,0,0);
 
2465
    return put_info(_("Can't connect to the server\n"),INFO_ERROR,0,0);
2466
2466
  /* purecov: end */
2467
2467
  return 0;
2468
2468
}
2519
2519
  char ccat= (*cur)[num_cat][0];
2520
2520
  if (*last_char != ccat)
2521
2521
  {
2522
 
    put_info(ccat == 'Y' ? gettext("categories:") : gettext("topics:"), INFO_INFO,0,0);
 
2522
    put_info(ccat == 'Y' ? _("categories:") : _("topics:"), INFO_INFO,0,0);
2523
2523
    *last_char= ccat;
2524
2524
  }
2525
2525
  tee_fprintf(PAGER, "   %s\n", (*cur)[num_name]);
2570
2570
      }
2571
2571
 
2572
2572
      init_pager();
2573
 
      tee_fprintf(PAGER,   gettext("Name: \'%s\'\n"), cur[0]);
2574
 
      tee_fprintf(PAGER,   gettext("Description:\n%s"), cur[1]);
 
2573
      tee_fprintf(PAGER,   _("Name: \'%s\'\n"), cur[0]);
 
2574
      tee_fprintf(PAGER,   _("Description:\n%s"), cur[1]);
2575
2575
      if (cur[2] && *((char*)cur[2]))
2576
 
        tee_fprintf(PAGER, gettext("Examples:\n%s"), cur[2]);
 
2576
        tee_fprintf(PAGER, _("Examples:\n%s"), cur[2]);
2577
2577
      tee_fprintf(PAGER,   "\n");
2578
2578
      end_pager();
2579
2579
    }
2586
2586
 
2587
2587
      if (num_fields == 2)
2588
2588
      {
2589
 
        put_info(gettext("Many help items for your request exist."), INFO_INFO,0,0);
2590
 
        put_info(gettext("To make a more specific request, please type 'help <item>',\nwhere <item> is one of the following"), INFO_INFO,0,0);
 
2589
        put_info(_("Many help items for your request exist."), INFO_INFO,0,0);
 
2590
        put_info(_("To make a more specific request, please type 'help <item>',\nwhere <item> is one of the following"), INFO_INFO,0,0);
2591
2591
        num_name= 0;
2592
2592
        num_cat= 1;
2593
2593
      }
2594
2594
      else if ((cur= drizzle_fetch_row(result)))
2595
2595
      {
2596
 
        tee_fprintf(PAGER, gettext("You asked for help about help category: '%s'\n"), cur[0]);
2597
 
        put_info(gettext("For more information, type 'help <item>', where <item> is one of the following"), INFO_INFO,0,0);
 
2596
        tee_fprintf(PAGER, _("You asked for help about help category: '%s'\n"), cur[0]);
 
2597
        put_info(_("For more information, type 'help <item>', where <item> is one of the following"), INFO_INFO,0,0);
2598
2598
        num_name= 1;
2599
2599
        num_cat= 2;
2600
2600
        print_help_item(&cur,1,2,&last_char);
2607
2607
    }
2608
2608
    else
2609
2609
    {
2610
 
      put_info(gettext("\nNothing found"), INFO_INFO,0,0);
2611
 
      put_info(gettext("Please try to run 'help contents' for a list of all accessible topics\n"), INFO_INFO,0,0);
 
2610
      put_info(_("\nNothing found"), INFO_INFO,0,0);
 
2611
      put_info(_("Please try to run 'help contents' for a list of all accessible topics\n"), INFO_INFO,0,0);
2612
2612
    }
2613
2613
  }
2614
2614
 
2631
2631
      return com_server_help(buffer,line,help_arg);
2632
2632
  }
2633
2633
 
2634
 
  put_info(gettext("List of all Drizzle commands:"), INFO_INFO,0,0);
 
2634
  put_info(_("List of all Drizzle commands:"), INFO_INFO,0,0);
2635
2635
  if (!named_cmds)
2636
 
    put_info(gettext("Note that all text commands must be first on line and end with ';'"),INFO_INFO,0,0);
 
2636
    put_info(_("Note that all text commands must be first on line and end with ';'"),INFO_INFO,0,0);
2637
2637
  for (i = 0; commands[i].name; i++)
2638
2638
  {
2639
2639
    end= strmov(buff, commands[i].name);
2641
2641
      end= strmov(end, " ");
2642
2642
    if (commands[i].func)
2643
2643
      tee_fprintf(stdout, "%s(\\%c) %s\n", buff,
2644
 
                  commands[i].cmd_char, gettext(commands[i].doc));
 
2644
                  commands[i].cmd_char, _(commands[i].doc));
2645
2645
  }
2646
2646
  if (connected && drizzle_get_server_version(&drizzle) >= 40100)
2647
 
    put_info(gettext("\nFor server side help, type 'help contents'\n"), INFO_INFO,0,0);
 
2647
    put_info(_("\nFor server side help, type 'help contents'\n"), INFO_INFO,0,0);
2648
2648
  return 0;
2649
2649
}
2650
2650
 
2667
2667
  param= get_arg(buff, 0);
2668
2668
  if (!param || !*param)
2669
2669
  {
2670
 
    return put_info(gettext("Usage: \\C char_setname | charset charset_name"),
 
2670
    return put_info(_("Usage: \\C char_setname | charset charset_name"),
2671
2671
                    INFO_ERROR, 0, 0);
2672
2672
  }
2673
2673
  new_cs= get_charset_by_csname(param, MY_CS_PRIMARY, MYF(MY_WME));
2677
2677
    drizzle_set_character_set(&drizzle, charset_info->csname);
2678
2678
    default_charset= (char *)charset_info->csname;
2679
2679
    default_charset_used= 1;
2680
 
    put_info(gettext("Charset changed"), INFO_INFO,0,0);
 
2680
    put_info(_("Charset changed"), INFO_INFO,0,0);
2681
2681
  }
2682
 
  else put_info(gettext("Charset is not found"), INFO_INFO,0,0);
 
2682
  else put_info(_("Charset is not found"), INFO_INFO,0,0);
2683
2683
  return 0;
2684
2684
}
2685
2685
 
2710
2710
    // Ignore empty quries
2711
2711
    if (status.batch)
2712
2712
      return 0;
2713
 
    return put_info(gettext("No query specified\n"),INFO_ERROR,0,0);
 
2713
    return put_info(_("No query specified\n"),INFO_ERROR,0,0);
2714
2714
 
2715
2715
  }
2716
2716
  if (!connected && reconnect())
2725
2725
  if (skip_updates &&
2726
2726
      ((buffer->length < 4) || !strncmp(buffer->str, "SET ", 4)))
2727
2727
  {
2728
 
    (void) put_info(gettext("Ignoring query to other database"),INFO_INFO,0,0);
 
2728
    (void) put_info(_("Ignoring query to other database"),INFO_INFO,0,0);
2729
2729
    return 0;
2730
2730
  }
2731
2731
 
2774
2774
    {
2775
2775
      if (!drizzle_num_rows(result) && ! quick && !column_types_flag)
2776
2776
      {
2777
 
        strmov(buff, gettext("Empty set"));
 
2777
        strmov(buff, _("Empty set"));
2778
2778
        if (opt_xml)
2779
2779
        {
2780
2780
          /*
2810
2810
      }
2811
2811
    }
2812
2812
    else if (drizzle_affected_rows(&drizzle) == ~(uint64_t) 0)
2813
 
      strmov(buff,gettext("Query OK"));
 
2813
      strmov(buff,_("Query OK"));
2814
2814
    else
2815
2815
      sprintf(buff, ngettext("Query OK, %ld row affected",
2816
2816
                             "Query OK, %ld rows affected",