From: Florian G. <re...@us...> - 2007-03-14 00:05:41
|
Update of /cvsroot/perfparse/_perfparse/db_tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv960/db_tools Modified Files: Makefile.am Makefile.in convert.c Log Message: switching to ncurses Index: Makefile.in =================================================================== RCS file: /cvsroot/perfparse/_perfparse/db_tools/Makefile.in,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Makefile.in 20 Dec 2006 22:57:46 -0000 1.18 --- Makefile.in 14 Mar 2007 00:05:40 -0000 1.19 *************** *** 163,166 **** --- 163,167 ---- GMSGFMT = @GMSGFMT@ GOBJECT_QUERY = @GOBJECT_QUERY@ + GREP = @GREP@ HAVE_ASPRINTF = @HAVE_ASPRINTF@ HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ *************** *** 226,235 **** ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_LIBS@ - ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ - ac_ct_RANLIB = @ac_ct_RANLIB@ - ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ --- 227,233 ---- *************** *** 250,253 **** --- 248,254 ---- cgidir = @cgidir@ datadir = @datadir@ + datarootdir = @datarootdir@ + docdir = @docdir@ + dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ *************** *** 256,259 **** --- 257,261 ---- host_os = @host_os@ host_vendor = @host_vendor@ + htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ *************** *** 261,271 **** --- 263,276 ---- libdir = @libdir@ libexecdir = @libexecdir@ + localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ + pdfdir = @pdfdir@ phpuidir = @phpuidir@ prefix = @prefix@ program_transform_name = @program_transform_name@ + psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ *************** *** 283,287 **** @USE_DB_POSTGRESQL_TRUE@USE_POSTGRESQL_LIBS = -L${top_builddir}/libpp_postgresql -lpp_postgresql ${POSTGRESQL_LIBS} PERFPARSE_DB_INCLUDES = '-DLOCALSTATEDIR="${localstatedir}"' '-DSYSCONFDIR="$(sysconfdir)"' '-DLOCALEDIR="${datadir}/locale"' ${USE_MYSQL_CFLAGS} ${USE_POSTGRESQL_CFLAGS} ${GLIB_CFLAGS} -I${top_srcdir}/libpp_common -I${top_srcdir} ! PERFPARSE_DB_LDADD = ${USE_MYSQL_LIBS} ${USE_POSTGRESQL_LIBS} -L${top_builddir}/libpp_common -lpp_common ${GLIB_LIBS} @LTLIBINTL@ perfparse_db_tool_SOURCES = perfparse-db-tool.c convert.c convert.h perfparse_db_tool_LDADD = ${PERFPARSE_DB_LDADD} --- 288,292 ---- @USE_DB_POSTGRESQL_TRUE@USE_POSTGRESQL_LIBS = -L${top_builddir}/libpp_postgresql -lpp_postgresql ${POSTGRESQL_LIBS} PERFPARSE_DB_INCLUDES = '-DLOCALSTATEDIR="${localstatedir}"' '-DSYSCONFDIR="$(sysconfdir)"' '-DLOCALEDIR="${datadir}/locale"' ${USE_MYSQL_CFLAGS} ${USE_POSTGRESQL_CFLAGS} ${GLIB_CFLAGS} -I${top_srcdir}/libpp_common -I${top_srcdir} ! PERFPARSE_DB_LDADD = ${USE_MYSQL_LIBS} ${USE_POSTGRESQL_LIBS} -L${top_builddir}/libpp_common -lpp_common -lncurses ${GLIB_LIBS} @LTLIBINTL@ perfparse_db_tool_SOURCES = perfparse-db-tool.c convert.c convert.h perfparse_db_tool_LDADD = ${PERFPARSE_DB_LDADD} Index: convert.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/db_tools/convert.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** convert.c 13 Mar 2007 06:45:03 -0000 1.16 --- convert.c 14 Mar 2007 00:05:40 -0000 1.17 *************** *** 40,43 **** --- 40,44 ---- #include <sys/types.h> #include <regex.h> + #include <ncurses.h> /* *************** *** 65,68 **** --- 66,70 ---- int dbtool_rows(MYSQL_RES *p_tmp_query_result); char *read_line (char *buf, size_t length); + char *read_string_from_line(char *buf, size_t length); void *************** *** 145,180 **** int i; ! printf(_("The database schema for perfparse changed dramatically. ")); ! printf(_("Changing the tables\nwould be too error-prone, so we decided to copy the data into a new database.\n")); ! printf(_("This step can take days for large databases. ")); ! printf(_("You should have prepared a new\ndatabase for this conversion step. ")); ! printf(_("This database should contain the v 0.20\ndatabase schema. ")); ! printf(_("You should have enough disk space to duplicate your old\ndatabase. ")); ! printf(_("To minimize downtime you can use the new schema with your new\nperfparse while old data are copied. ")); ! printf(_("For more information visit\nhttp://perfparse.de/tiki-index.php?page=DatabaseUpgrade \n")); ! printf(_("\nAre you sure to start the conversion (y/n)? ")); ! while((yesno=getchar())) { ! if(yesno == 'y') break; if(yesno == 'n') { ! printf(_("\nBye.\n")); exit(1); } } ! printf(_("\n\nIn the next step you will have to provide data of the old and the new database.\n")); ! printf(_("With the commandline or in the configuration file you provided these data:\n")); ! printf(_("Database Host:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_HOST)); ! printf(_("Database User:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_USER)); ! printf(_("Database Password:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_PWD)); ! printf(_("Database Name:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_DATABASE)); ! printf(_("Database TCP Port:\t%d\n"),config_get_value_as_integer(CONFIG_ITEM_ID_DB_PORT)); ! printf(_("Database Unix Socket:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET)); ! printf(_("\n\nAre these values for the old or the new database? (o/n) or none of both (x)?")); ! while((yesno=getchar())) { if(yesno == 'o' || yesno == 'n' || yesno == 'x') break; } // old database connection --- 147,205 ---- int i; ! // ncurses variables ! int iNCrows, iNCcols; ! ! // init ncurses ! initscr(); ! cbreak(); ! getmaxyx(stdscr,iNCrows,iNCcols); ! ! printw(_("The database schema for perfparse changed dramatically. ")); ! printw(_("Changing the tables\nwould be too error-prone, so we decided to copy the data into a new database.\n")); ! printw(_("This step can take days for large databases. ")); ! printw(_("You should have prepared a new\ndatabase for this conversion step. ")); ! printw(_("This database should contain the v 0.20\ndatabase schema. ")); ! printw(_("You should have enough disk space to duplicate your old\ndatabase. ")); ! printw(_("To minimize downtime you can use the new schema with your new\nperfparse while old data are copied. ")); ! printw(_("For more information visit\nhttp://perfparse.de/tiki-index.php?page=DatabaseUpgrade \n")); ! printw(_("\nAre you sure to start the conversion (y/n)? ")); ! refresh(); ! noecho(); ! attron(A_BOLD); ! while((yesno=getch())) { ! if(yesno == 'y'){ ! printw("%c\n",yesno); break; + } if(yesno == 'n') { ! printw("%c",yesno); ! attroff(A_BOLD); ! printw(_("\nBye.\n")); ! refresh(); ! sleep(2); ! endwin(); exit(1); } } + attroff(A_BOLD); + refresh(); ! printw(_("\n\nIn the next step you will have to provide data of the old and the new database.\n")); ! printw(_("With the commandline or in the configuration file you provided these data:\n")); ! printw(_("Database Host:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_HOST)); ! printw(_("Database User:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_USER)); ! printw(_("Database Password:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_PWD)); ! printw(_("Database Name:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_DATABASE)); ! printw(_("Database TCP Port:\t%d\n"),config_get_value_as_integer(CONFIG_ITEM_ID_DB_PORT)); ! printw(_("Database Unix Socket:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET)); ! printw(_("\n\nAre these values for the old or the new database? (o/n) or none of both (x)?")); ! refresh(); ! while((yesno=getch())) { if(yesno == 'o' || yesno == 'n' || yesno == 'x') break; } + attron(A_BOLD); printw("%c\n",yesno); attroff(A_BOLD); + refresh(); // old database connection *************** *** 187,215 **** sODBsocket=config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET); } else { //ask user ! printf(_("Please enter the connection data for the old database below:\n")); sODBhost=malloc(65); ! printf(_("Database Host: ")); ! while(TRUE) { ! if(read_line(sTmpBuf,64)!=NULL) { ! //printf("readed line %s \n",sTmpBuf); ! if(sscanf(sTmpBuf,"%s64",sODBhost)) { ! break; ! } ! } ! printf(_("Wrong input!\n")); } sODBuser=malloc(65); printf(_("Database User: ")); ! fscanf(stdin,"%s64",sODBuser); sODBpass=malloc(65); printf(_("Database Password: ")); ! fscanf(stdin,"%s64",sODBpass); sODBdatabase=malloc(65); printf(_("Database Name: ")); ! fscanf(stdin,"%s64",sODBdatabase); printf(_("Database Port: ")); --- 212,239 ---- sODBsocket=config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET); } else { //ask user ! printw(_("Please enter the connection data for the old database below:\n")); sODBhost=malloc(65); ! printw(_("Database Host (default: localhost): ")); ! refresh(); ! echo(); ! if(scanw("%s64",sODBhost) == 0) { ! printw("localhost"); } + refresh(); + + sODBuser=malloc(65); printf(_("Database User: ")); ! read_string_from_line(sODBuser,64); sODBpass=malloc(65); printf(_("Database Password: ")); ! read_string_from_line(sODBpass,64); sODBdatabase=malloc(65); printf(_("Database Name: ")); ! read_string_from_line(sODBdatabase,64); printf(_("Database Port: ")); *************** *** 218,222 **** sODBsocket=malloc(65); printf(_("Database Socket: ")); ! fscanf(stdin,"%s64",sODBsocket); } --- 242,246 ---- sODBsocket=malloc(65); printf(_("Database Socket: ")); ! read_string_from_line(sODBsocket,64); } *************** *** 452,456 **** char *input_line; ! if (input_line = fgets (buf, length, stdin)) { size_t last = strlen (buf) - 1; --- 476,480 ---- char *input_line; ! if ((input_line = fgets (buf, length, stdin))) { size_t last = strlen (buf) - 1; *************** *** 466,470 **** } ! void dbtool_mysql_query(const char *sql, MYSQL *p_tmp_db_mysql, MYSQL_RES *p_tmp_query_result) { --- 490,504 ---- } ! char *read_string_from_line(char *buf, size_t length) { ! while(TRUE) { ! if(read_line(buf,length)!=NULL) { ! if(strlen(buf)>0) { ! return(buf); ! } ! } ! printf(_("Wrong input! Please try again: :")); ! } ! } ! void dbtool_mysql_query(const char *sql, MYSQL *p_tmp_db_mysql, MYSQL_RES *p_tmp_query_result) { Index: Makefile.am =================================================================== RCS file: /cvsroot/perfparse/_perfparse/db_tools/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile.am 26 Sep 2005 14:36:33 -0000 1.1.1.1 --- Makefile.am 14 Mar 2007 00:05:40 -0000 1.2 *************** *** 12,16 **** PERFPARSE_DB_INCLUDES='-DLOCALSTATEDIR="${localstatedir}"' '-DSYSCONFDIR="$(sysconfdir)"' '-DLOCALEDIR="${datadir}/locale"' ${USE_MYSQL_CFLAGS} ${USE_POSTGRESQL_CFLAGS} ${GLIB_CFLAGS} -I${top_srcdir}/libpp_common -I${top_srcdir} ! PERFPARSE_DB_LDADD=${USE_MYSQL_LIBS} ${USE_POSTGRESQL_LIBS} -L${top_builddir}/libpp_common -lpp_common ${GLIB_LIBS} @LTLIBINTL@ bin_PROGRAMS=${MYSQL_DBTOOLS} ${POSTGRESQL_DBTOOLS} --- 12,16 ---- PERFPARSE_DB_INCLUDES='-DLOCALSTATEDIR="${localstatedir}"' '-DSYSCONFDIR="$(sysconfdir)"' '-DLOCALEDIR="${datadir}/locale"' ${USE_MYSQL_CFLAGS} ${USE_POSTGRESQL_CFLAGS} ${GLIB_CFLAGS} -I${top_srcdir}/libpp_common -I${top_srcdir} ! PERFPARSE_DB_LDADD=${USE_MYSQL_LIBS} ${USE_POSTGRESQL_LIBS} -L${top_builddir}/libpp_common -lpp_common -lncurses ${GLIB_LIBS} @LTLIBINTL@ bin_PROGRAMS=${MYSQL_DBTOOLS} ${POSTGRESQL_DBTOOLS} |