Update of /cvsroot/perfparse/_perfparse/db_tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30579/db_tools
Modified Files:
convert.c
Log Message:
more ncurses
Index: convert.c
===================================================================
RCS file: /cvsroot/perfparse/_perfparse/db_tools/convert.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** convert.c 15 Mar 2007 00:01:58 -0000 1.18
--- convert.c 15 Mar 2007 22:55:07 -0000 1.19
***************
*** 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
--- 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, const char* defaultval);
void
***************
*** 221,246 ****
printw(_("Database Host (default: localhost): "));
refresh();
! echo();
! getyx(stdscr,y,x);
! if(scanw("%s64",sODBhost) == ERR) {
! move(y,x);
! printw("localhost\n");
! sprintf(sODBhost,"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: "));
--- 221,242 ----
printw(_("Database Host (default: localhost): "));
refresh();
! read_string_from_line(sODBhost,64,"localhost");
sODBuser=malloc(65);
! printw(_("Database User (default: root): "));
! refresh();
! read_string_from_line(sODBuser,64,"root");
!
sODBpass=malloc(65);
! printw(_("Database Password: "));
! refresh();
! read_string_from_line(sODBpass,64,"");
sODBdatabase=malloc(65);
! printw(_("Database Name (default: perfparse): "));
! refresh();
! read_string_from_line(sODBdatabase,64,"perfparse");
!
printf(_("Database Port: "));
***************
*** 249,253 ****
sODBsocket=malloc(65);
printf(_("Database Socket: "));
! read_string_from_line(sODBsocket,64);
}
--- 245,249 ----
sODBsocket=malloc(65);
printf(_("Database Socket: "));
!
}
***************
*** 497,509 ****
}
! 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: :"));
! }
}
--- 493,520 ----
}
! char *read_string_from_line(char *buf, size_t length, const char* defaultval) {
! char *fmtstr;
! int y,x,my,mx;
! if(length > 1000000) { // just to be safe
! strncpy(buf,defaultval,length);
! return(buf);
! }
! fmtstr=malloc(10);
! sprintf(fmtstr,"%%s%d",length);
! echo();
! getyx(stdscr,y,x);
! getmaxyx(stdscr,my,mx);
!
! if(scanw(fmtstr,buf) == ERR) {
! if(my==y) {
! move(y-1,x);
! } else {
! move(y,x);
}
! printw("%s\n",defaultval);
! strncpy(buf,defaultval,length);
! }
! noecho();
! refresh();
}
|