Update of /cvsroot/perfparse/_perfparse/db_tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32702/db_tools
Modified Files:
convert.c
Log Message:
small changes
Index: convert.c
===================================================================
RCS file: /cvsroot/perfparse/_perfparse/db_tools/convert.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** convert.c 15 Mar 2007 22:55:07 -0000 1.19
--- convert.c 20 Mar 2007 23:17:38 -0000 1.20
***************
*** 67,70 ****
--- 67,71 ----
char *read_line (char *buf, size_t length);
char *read_string_from_line(char *buf, size_t length, const char* defaultval);
+ int read_int_from_line(int defaultval);
void
***************
*** 240,248 ****
! printf(_("Database Port: "));
! fscanf(stdin,"%d",&iODBport);
!
sODBsocket=malloc(65);
! printf(_("Database Socket: "));
}
--- 241,252 ----
! printw(_("Database Port (defualt: none): "));
! refresh();
! iODBport=read_int_from_line(FALSE);
!
sODBsocket=malloc(65);
! printw(_("Database Socket (default: none): "));
! refresh();
! read_string_from_line(sODBsocket,64,"");
}
***************
*** 517,520 ****
--- 521,550 ----
noecho();
refresh();
+ free(fmtstr);
+ return(buf);
+ }
+
+ int read_int_from_line(int defaultval) {
+ int y,x,my,mx,result;
+ echo();
+ getyx(stdscr,y,x);
+ getmaxyx(stdscr,my,mx);
+
+ if(scanw("%d",&result) == ERR) {
+ if(my==y) {
+ move(y-1,x);
+ } else {
+ move(y,x);
+ }
+ if(defaultval==FALSE) {
+ printw("none");
+ } else {
+ printw("%d\n",defaultval);
+ }
+ result=defaultval;
+ }
+ noecho();
+ refresh();
+ return(result);
}
|