summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2007-03-24 11:06:09 +0200
committerunknown <monty@narttu.mysql.fi>2007-03-24 11:06:09 +0200
commite2a3fdd1fe463a58a733726973d59d247ad8853e (patch)
tree9da46d5da168cf6be98e5d92f1946ee853a76ea4 /mysys
parent212ecf348cbb43f71cfd14a51ca19b7ef987859f (diff)
parentc59dba87b64179fdaca7519f1433f0547cdcbb68 (diff)
downloadmariadb-git-e2a3fdd1fe463a58a733726973d59d247ad8853e.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into mysql.com:/home/my/mysql-5.1 client/mysqladmin.cc: Auto merged client/mysqlbinlog.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_view.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.