~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzle.cc

  • Committer: Monty Taylor
  • Date: 2008-12-17 02:02:09 UTC
  • mfrom: (673.5.7 usability-cli-port)
  • mto: This revision was merged to the branch mainline in revision 713.
  • Revision ID: monty@inaugust.com-20081217020209-p4g06zj2r1783c4p
Merged in changes from LinuxJedi.

Show diffs side-by-side

added added

removed removed

Lines of Context:
163
163
static bool debug_info_flag, debug_check_flag;
164
164
static bool column_types_flag;
165
165
static bool preserve_comments= false;
166
 
static uint32_t opt_max_allowed_packet, opt_net_buffer_length;
167
 
static int verbose= 0, opt_drizzle_port= 0, opt_silent= 0, opt_local_infile= 0;
 
166
static uint32_t opt_max_allowed_packet, opt_net_buffer_length,
 
167
  opt_drizzle_port= 0;
 
168
static int verbose= 0, opt_silent= 0, opt_local_infile= 0;
168
169
static uint my_end_arg;
169
170
static char * opt_drizzle_unix_port= NULL;
170
171
static int connect_flag= CLIENT_INTERACTIVE;
1473
1474
extern "C" bool
1474
1475
get_one_option(int optid, const struct my_option *, char *argument)
1475
1476
{
1476
 
  char *endchar = NULL;
 
1477
  char *endchar= NULL;
 
1478
  uint64_t temp_drizzle_port= 0;
1477
1479
 
1478
1480
  switch(optid) {
1479
1481
  case OPT_CHARSETS_DIR:
1506
1508
    delimiter_str= delimiter;
1507
1509
    break;
1508
1510
  case OPT_LOCAL_INFILE:
1509
 
    using_opt_local_infile=1;
 
1511
    using_opt_local_infile= 1;
1510
1512
    break;
1511
1513
  case OPT_TEE:
1512
1514
    if (argument == disabled_my_option)
1568
1570
      one_database= skip_updates= 1;
1569
1571
    break;
1570
1572
  case 'p':
1571
 
    opt_drizzle_port= strtol(argument, &endchar, 10);
 
1573
    temp_drizzle_port= (uint64_t) strtoul(argument, &endchar, 10);
1572
1574
    /* if there is an alpha character this is not a valid port */
1573
1575
    if (strlen(endchar) != 0)
1574
1576
    {
1575
1577
      put_info(_("Non-integer value supplied for port.  If you are trying to enter a password please use --password instead."), INFO_ERROR, 0, 0);
1576
1578
      return false;
1577
1579
    }
 
1580
    /* If the port number is > 65535 it is not a valid port
 
1581
       This also helps with potential data loss casting unsigned long to a
 
1582
       uint32_t. */
 
1583
    if (temp_drizzle_port > 65535)
 
1584
    {
 
1585
      put_info(_("Value supplied for port is not valid."), INFO_ERROR, 0, 0);
 
1586
      return false;
 
1587
    }
 
1588
    else
 
1589
    {
 
1590
      opt_drizzle_port= (uint32_t) temp_drizzle_port;
 
1591
    }
1578
1592
    break;
1579
1593
  case 'P':
1580
1594
    /* Don't require password */