~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzletest.cc

  • Committer: Brian Aker
  • Date: 2010-03-26 06:54:35 UTC
  • mfrom: (1393.3.1 drizzle-bug-308381)
  • Revision ID: brian@gir.local-20100326065435-f99s3vr10jgqu18x
Merge Andrew

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
extern "C"
78
78
unsigned char *get_var_key(const unsigned char* var, size_t *len, bool);
79
79
 
80
 
bool get_one_option(int optid, const struct my_option *, char *argument);
 
80
int get_one_option(int optid, const struct my_option *, char *argument);
81
81
 
82
82
#define MAX_VAR_NAME_LENGTH    256
83
83
#define MAX_COLUMNS            256
4666
4666
  my_print_variables(my_long_options);
4667
4667
}
4668
4668
 
4669
 
bool get_one_option(int optid, const struct my_option *, char *argument)
 
4669
int get_one_option(int optid, const struct my_option *, char *argument)
4670
4670
{
4671
4671
  char *endchar= NULL;
4672
4672
  uint64_t temp_drizzle_port= 0;
4686
4686
    internal::fn_format(buff, argument, "", "", MY_UNPACK_FILENAME);
4687
4687
    assert(cur_file == file_stack && cur_file->file == 0);
4688
4688
    if (!(cur_file->file= fopen(buff, "r")))
4689
 
      die("Could not open '%s' for reading: errno = %d", buff, errno);
 
4689
    {
 
4690
      fprintf(stderr, _("Could not open '%s' for reading: errno = %d"), buff, errno);
 
4691
      return EXIT_ARGUMENT_INVALID;
 
4692
    }
4690
4693
    if (!(cur_file->file_name= strdup(buff)))
4691
 
      die("Out of memory");
 
4694
    {
 
4695
      fprintf(stderr, _("Out of memory"));
 
4696
      return EXIT_OUT_OF_MEMORY;
 
4697
    }
4692
4698
    cur_file->lineno= 1;
4693
4699
    break;
4694
4700
  }
4711
4717
    if (strlen(endchar) != 0)
4712
4718
    {
4713
4719
      fprintf(stderr, _("Non-integer value supplied for port.  If you are trying to enter a password please use --password instead.\n"));
4714
 
      exit(1);
 
4720
      return EXIT_ARGUMENT_INVALID;
4715
4721
    }
4716
4722
    /* If the port number is > 65535 it is not a valid port
4717
4723
       This also helps with potential data loss casting unsigned long to a
4719
4725
    if ((temp_drizzle_port == 0) || (temp_drizzle_port > 65535))
4720
4726
    {
4721
4727
      fprintf(stderr, _("Value supplied for port is not valid.\n"));
4722
 
      exit(1);
 
4728
      return EXIT_ARGUMENT_INVALID;
4723
4729
    }
4724
4730
    else
4725
4731
    {
4733
4739
        free(opt_pass);
4734
4740
      opt_pass = strdup(argument);
4735
4741
      if (opt_pass == NULL)
4736
 
        die("Out of memory");
 
4742
      {
 
4743
        fprintf(stderr, _("Out of memory"));
 
4744
        return EXIT_OUT_OF_MEMORY;
 
4745
      }
4737
4746
      while (*argument)
4738
4747
      {
4739
4748
        /* Overwriting password with 'x' */