diff options
author | unknown <anjuta@arthur.local> | 2005-01-04 15:49:51 +0200 |
---|---|---|
committer | unknown <anjuta@arthur.local> | 2005-01-04 15:49:51 +0200 |
commit | d5202685048e4b89f08478de56ec2e367c4c751b (patch) | |
tree | 236828f4d3c33e549fae8985182d795c236a114d /extra | |
parent | c7eace29497e9938102d46085be4f229c1a57864 (diff) | |
download | mariadb-git-d5202685048e4b89f08478de56ec2e367c4c751b.tar.gz |
Added creation of mysqld_ername.h
extra/Makefile.am:
Added rule for creating mysqld_ername.h
Diffstat (limited to 'extra')
-rw-r--r-- | extra/Makefile.am | 5 | ||||
-rw-r--r-- | extra/comp_err.c | 16 |
2 files changed, 18 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 9ddd1d7d971..7f6b6a5996b 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_count= 0; - FILE *er_definef, *sql_statef; + FILE *er_definef, *sql_statef, *er_namef; struct errors *tmp_error; DBUG_ENTER("create_header_files"); @@ -205,9 +208,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"); for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error) { @@ -223,6 +233,10 @@ 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); + er_count++; } /* finishing off with mysqld_error.h */ |