summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <jani@ua141d10.elisa.omakaista.fi>2007-03-19 11:22:10 +0200
committerunknown <jani@ua141d10.elisa.omakaista.fi>2007-03-19 11:22:10 +0200
commit7f5c589cdae55b7a0e111e51072cc246eaf3816d (patch)
tree9c2497068d590134809c8b6c590e58bc3788fc07 /mysys
parent6bb4208084654c0e7c1218ff1d70cb6298514ab8 (diff)
parent3615debeb1377b1ddf51b546ed7342186c18db59 (diff)
downloadmariadb-git-7f5c589cdae55b7a0e111e51072cc246eaf3816d.tar.gz
Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel sql/mysqld.cc: Auto merged
Diffstat (limited to 'mysys')
-rw-r--r--mysys/typelib.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysys/typelib.c b/mysys/typelib.c
index 4fab6f20493..780e63b4b04 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -20,6 +20,28 @@
#include <m_ctype.h>
+int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
+{
+ int res;
+ const char **ptr;
+
+ if ((res= find_type((my_string) x, typelib, 2)) <= 0)
+ {
+ ptr= typelib->type_names;
+ if (!*x)
+ fprintf(stderr, "No option given to %s\n", option);
+ else
+ fprintf(stderr, "Unknown option to %s: %s\n", option, x);
+ fprintf(stderr, "Alternatives are: '%s'", *ptr);
+ while (*++ptr)
+ fprintf(stderr, ",'%s'", *ptr);
+ fprintf(stderr, "\n");
+ exit(1);
+ }
+ return res;
+}
+
+
/*
Search after a string in a list of strings. Endspace in x is not compared.