~mdcallag/+junk/5.1-map

« back to all changes in this revision

Viewing changes to mysys/typelib.c

  • Committer: msvensson at pilot
  • Date: 2007-04-24 09:11:45 UTC
  • mfrom: (2469.1.106)
  • Revision ID: sp1r-msvensson@pilot.blaudden-20070424091145-10463
Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <m_ctype.h>
21
21
 
22
22
 
 
23
int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
 
24
{
 
25
  int res;
 
26
  const char **ptr;
 
27
 
 
28
  if ((res= find_type((my_string) x, typelib, 2)) <= 0)
 
29
  {
 
30
    ptr= typelib->type_names;
 
31
    if (!*x)
 
32
      fprintf(stderr, "No option given to %s\n", option);
 
33
    else
 
34
      fprintf(stderr, "Unknown option to %s: %s\n", option, x);
 
35
    fprintf(stderr, "Alternatives are: '%s'", *ptr);
 
36
    while (*++ptr)
 
37
      fprintf(stderr, ",'%s'", *ptr);
 
38
    fprintf(stderr, "\n");
 
39
    exit(1);
 
40
  }
 
41
  return res;
 
42
}
 
43
 
 
44
 
23
45
/*
24
46
  Search after a string in a list of strings. Endspace in x is not compared.
25
47
 
42
64
    >0  Offset+1 in typelib for matched string
43
65
*/
44
66
 
45
 
int find_type(my_string x, TYPELIB *typelib, uint full_name)
 
67
int find_type(char *x, const TYPELIB *typelib, uint full_name)
46
68
{
47
69
  int find,pos,findpos;
48
70
  reg1 my_string i;