diff options
author | unknown <anjuta@arthur.local> | 2005-01-13 19:14:10 +0200 |
---|---|---|
committer | unknown <anjuta@arthur.local> | 2005-01-13 19:14:10 +0200 |
commit | 111587e9e380693a2437635d67da51111b77d37b (patch) | |
tree | b2e0d5fb70ad167a712a507c2ae7c24769545aeb /extra | |
parent | 9d983c4550cf8e5c5342509f6508ca0e35600acd (diff) | |
parent | 388cd3a7c4b7b14a2529cc757f2e18a7c127997e (diff) | |
download | mariadb-git-111587e9e380693a2437635d67da51111b77d37b.tar.gz |
Merge
BitKeeper/etc/ignore:
auto-union
innobase/os/os0proc.c:
Auto merged
sql/share/errmsg.txt:
Auto merged
extra/comp_err.c:
SCCS merged
Diffstat (limited to 'extra')
-rw-r--r-- | extra/Makefile.am | 5 | ||||
-rw-r--r-- | extra/comp_err.c | 17 |
2 files changed, 19 insertions, 3 deletions
diff --git a/extra/Makefile.am b/extra/Makefile.am index 7bb401f0729..9f18cbf96e6 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -19,7 +19,7 @@ INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include \ -I$(top_srcdir)/extra LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ ../dbug/libdbug.a ../strings/libmystrings.a -BUILT_SOURCES= mysqld_error.h sql_state.h +BUILT_SOURCES= mysqld_error.h sql_state.h mysqld_ername.h pkginclude_HEADERS= $(BUILT_SOURCES) created_sources = created_include_files CLEANFILES = $(created_sources) @@ -29,10 +29,11 @@ all: $(created_sources) # This will build mysqld_error.h and sql_state.h mysqld_error.h: created_include_files +mysqld_ername.h: created_include_files sql_state.h: created_include_files created_include_files: comp_err - $(top_builddir)/extra/comp_err --charset=$(srcdir)/../sql/share/charsets --out-dir=$(top_builddir)/sql/share/ --header_file=$(top_builddir)/extra/mysqld_error.h --state_file=$(top_builddir)/extra/sql_state.h --in_file=$(srcdir)/../sql/share/errmsg.txt + $(top_builddir)/extra/comp_err --charset=$(srcdir)/../sql/share/charsets --out-dir=$(top_builddir)/sql/share/ --header_file=$(top_builddir)/extra/mysqld_error.h --name_file=$(top_builddir)/extra/mysqld_ername.h --state_file=$(top_builddir)/extra/sql_state.h --in_file=$(srcdir)/../sql/share/errmsg.txt touch created_include_files bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \ diff --git a/extra/comp_err.c b/extra/comp_err.c index 8bc8a989a6a..a02eea4e510 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -37,6 +37,7 @@ #define ER_PREFIX "ER_" static char *OUTFILE= (char*) "errmsg.sys"; static char *HEADERFILE= (char*) "mysqld_error.h"; +static char *NAMEFILE= (char*) "mysqld_ername.h"; static char *STATEFILE= (char*) "sql_state.h"; static char *TXTFILE= (char*) "../sql/share/errmsg.txt"; static char *DATADIR= (char*) "../sql/share/"; @@ -117,6 +118,8 @@ static struct my_option my_long_options[]= (gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"header_file", 'H', "mysqld_error.h file ", (gptr *) & HEADERFILE, (gptr *) & HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"name_file", 'N', "mysqld_ername.h file ", (gptr *) & NAMEFILE, + (gptr *) & NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"state_file", 'S', "sql_state.h file", (gptr *) & STATEFILE, (gptr *) & STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} @@ -192,7 +195,7 @@ int main(int argc, char *argv[]) static int create_header_files(struct errors *error_head) { uint er_last; - FILE *er_definef, *sql_statef; + FILE *er_definef, *sql_statef, *er_namef; struct errors *tmp_error; DBUG_ENTER("create_header_files"); LINT_INIT(er_last); @@ -206,9 +209,16 @@ static int create_header_files(struct errors *error_head) my_fclose(er_definef, MYF(0)); DBUG_RETURN(1); } + if (!(er_namef= my_fopen(NAMEFILE, O_WRONLY, MYF(MY_WME)))) + { + my_fclose(er_definef, MYF(0)); + my_fclose(sql_statef, MYF(0)); + DBUG_RETURN(1); + } fprintf(er_definef, "/* Autogenerated file, please don't edit */\n\n"); fprintf(sql_statef, "/* Autogenerated file, please don't edit */\n\n"); + fprintf(er_namef, "/* Autogenerated file, please don't edit */\n\n"); fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code); @@ -227,11 +237,16 @@ static int create_header_files(struct errors *error_head) fprintf(sql_statef, "%-40s,\"%s\", \"%s\",\n", tmp_error->er_name, tmp_error->sql_code1, tmp_error->sql_code2); + /*generating er_name file */ + fprintf(er_namef, "{ \"%s\", %d },\n", tmp_error->er_name, + tmp_error->d_code); + } /* finishing off with mysqld_error.h */ fprintf(er_definef, "#define ER_ERROR_LAST %d\n", er_last); my_fclose(er_definef, MYF(0)); my_fclose(sql_statef, MYF(0)); + my_fclose(er_namef, MYF(0)); DBUG_RETURN(0); } |