~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzle.cc

  • Committer: Brian Aker
  • Date: 2008-12-09 17:33:02 UTC
  • mfrom: (656.1.54 devel)
  • Revision ID: brian@tangent.org-20081209173302-aptngvc7efxnatnt
Merge from Monty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1027
1027
 
1028
1028
  MY_INIT(argv[0]);
1029
1029
  delimiter_str= delimiter;
1030
 
  default_prompt= my_strdup(getenv("DRIZZLE_PS1") ?
1031
 
                            getenv("DRIZZLE_PS1") :
1032
 
                            "drizzle>> ", MYF(0));
1033
 
  current_prompt= my_strdup(default_prompt, MYF(0));
 
1030
  default_prompt= strdup(getenv("DRIZZLE_PS1") ?
 
1031
                         getenv("DRIZZLE_PS1") :
 
1032
                         "drizzle> ");
 
1033
  
 
1034
  if (default_prompt == NULL)
 
1035
  {
 
1036
    fprintf(stderr, _("Memory allocation error while constructing initial "
 
1037
                      "prompt. Aborting.\n"));
 
1038
    exit(ENOMEM);
 
1039
  }
 
1040
  current_prompt= strdup(default_prompt);
 
1041
  if (current_prompt == NULL)
 
1042
  {
 
1043
    fprintf(stderr, _("Memory allocation error while constructing initial "
 
1044
                      "prompt. Aborting.\n"));
 
1045
    exit(ENOMEM);
 
1046
  }
1034
1047
  processed_prompt= new string();
1035
1048
  processed_prompt->reserve(32);
1036
1049
 
4296
4309
static int com_prompt(string *, const char *line)
4297
4310
{
4298
4311
  const char *ptr=strchr(line, ' ');
4299
 
  prompt_counter = 0;
4300
 
  free(current_prompt);
4301
 
  current_prompt= strdup(ptr ? ptr+1 : default_prompt);
4302
 
  if (!ptr)
 
4312
  if (ptr == NULL)
4303
4313
    tee_fprintf(stdout, "Returning to default PROMPT of %s\n",
4304
4314
                default_prompt);
 
4315
  prompt_counter = 0;
 
4316
  char * tmpptr= strdup(ptr ? ptr+1 : default_prompt);
 
4317
  if (tmpptr == NULL)
 
4318
    tee_fprintf(stdout, "Memory allocation error. Not changing prompt\n");
4305
4319
  else
 
4320
  {
 
4321
    free(current_prompt);
 
4322
    current_prompt= tmpptr;
4306
4323
    tee_fprintf(stdout, "PROMPT set to '%s'\n", current_prompt);
 
4324
  }
4307
4325
  return 0;
4308
4326
}
4309
4327