~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_getopt.c

  • Committer: Monty Taylor
  • Date: 2008-08-05 18:04:31 UTC
  • mto: (266.1.1 codestyle)
  • mto: This revision was merged to the branch mainline in revision 266.
  • Revision ID: monty@inaugust.com-20080805180431-a49929xr292qyevp
Added some strings from my_error and my_getopt we'd missed before.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
#include "mysys_priv.h"
 
17
#include <libdrizzle/gettext.h>
17
18
 
18
19
#include <mystrings/m_string.h>
19
20
#include <stdlib.h>
79
80
  va_list args;
80
81
  va_start(args, format);
81
82
  if (level == WARNING_LEVEL)
82
 
    fprintf(stderr, "%s", "Warning: ");
 
83
    fprintf(stderr, "%s", _("Warning: "));
83
84
  else if (level == INFORMATION_LEVEL)
84
 
    fprintf(stderr, "%s", "Info: ");
 
85
    fprintf(stderr, "%s", _("Info: "));
85
86
  vfprintf(stderr, format, args);
86
87
  va_end(args);
87
88
  fputc('\n', stderr);
341
342
        {
342
343
          if (my_getopt_print_errors)
343
344
            fprintf(stderr,
344
 
                    "%s: %s: Option '%s' used, but is disabled\n", my_progname,
345
 
                    option_is_loose ? "WARNING" : "ERROR", opt_str);
 
345
                    _("%s: %s: Option '%s' used, but is disabled\n"), my_progname,
 
346
                    option_is_loose ? _("WARNING") : _("ERROR"), opt_str);
346
347
          if (option_is_loose)
347
348
          {
348
349
            (*argc)--;
445
446
              {
446
447
                if (my_getopt_print_errors)
447
448
                  fprintf(stderr,
448
 
                          "%s: ERROR: Option '-%c' used, but is disabled\n",
 
449
                          _("%s: ERROR: Option '-%c' used, but is disabled\n"),
449
450
                          my_progname, optp->id);
450
451
                return EXIT_OPTION_DISABLED;
451
452
              }
758
759
  else if (*endchar)
759
760
  {
760
761
    fprintf(stderr,
761
 
            "Unknown suffix '%c' used for variable '%s' (value '%s')\n",
 
762
            _("Unknown suffix '%c' used for variable '%s' (value '%s')\n"),
762
763
            *endchar, option_name, argument);
763
764
    *error= 1;
764
765
    return 0;
939
940
  if (end[0] != 0 || error)
940
941
  {
941
942
    fprintf(stderr,
942
 
            "%s: ERROR: Invalid decimal value for option '%s'\n",
 
943
            _("%s: ERROR: Invalid decimal value for option '%s'\n"),
943
944
            my_progname, optp->name);
944
945
    *err= EXIT_ARGUMENT_INVALID;
945
946
    return 0.0;
1141
1142
      putchar(' ');
1142
1143
    if (optp->comment && *optp->comment)
1143
1144
    {
1144
 
      const char *comment= gettext(optp->comment), *end= strend(comment);
 
1145
      const char *comment= _(optp->comment), *end= strend(comment);
1145
1146
 
1146
1147
      while ((uint) (end - comment) > comment_space)
1147
1148
      {
1161
1162
    {
1162
1163
      if (optp->def_value != 0)
1163
1164
      {
1164
 
        printf(gettext("%*s(Defaults to on; use --skip-%s to disable.)\n"), name_space, "", optp->name);
 
1165
        printf(_("%*s(Defaults to on; use --skip-%s to disable.)\n"), name_space, "", optp->name);
1165
1166
      }
1166
1167
    }
1167
1168
  }
1181
1182
  char buff[255];
1182
1183
  const struct my_option *optp;
1183
1184
 
1184
 
  printf("\nVariables (--variable-name=value)\n");
1185
 
  printf("and boolean options {false|true}  Value (after reading options)\n");
1186
 
  printf("--------------------------------- -----------------------------\n");
 
1185
  printf(_("\nVariables (--variable-name=value)\n"
 
1186
         "and boolean options {false|true}  Value (after reading options)\n"
 
1187
         "--------------------------------- -----------------------------\n"));
1187
1188
  for (optp= options; optp->id; optp++)
1188
1189
  {
1189
1190
    char* *value= (optp->var_type & GET_ASK_ADDR ?
1197
1198
      switch ((optp->var_type & GET_TYPE_MASK)) {
1198
1199
      case GET_SET:
1199
1200
        if (!(llvalue= *(uint64_t*) value))
1200
 
          printf("%s\n", "(No default value)");
 
1201
          printf("%s\n", _("(No default value)"));
1201
1202
        else
1202
1203
        for (nr= 0, bit= 1; llvalue && nr < optp->typelib->count; nr++, bit<<=1)
1203
1204
        {
1213
1214
      case GET_STR:
1214
1215
      case GET_STR_ALLOC:                    /* fall through */
1215
1216
        printf("%s\n", *((char**) value) ? *((char**) value) :
1216
 
               "(No default value)");
 
1217
               _("(No default value)"));
1217
1218
        break;
1218
1219
      case GET_BOOL:
1219
 
        printf("%s\n", *((bool*) value) ? "true" : "false");
 
1220
        printf("%s\n", *((bool*) value) ? _("true") : _("false"));
1220
1221
        break;
1221
1222
      case GET_INT:
1222
1223
        printf("%d\n", *((int*) value));
1241
1242
        printf("%g\n", *(double*) value);
1242
1243
        break;
1243
1244
      default:
1244
 
        printf("(Disabled)\n");
 
1245
        printf(_("(Disabled)\n"));
1245
1246
        break;
1246
1247
      }
1247
1248
    }