Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28709
Modified Files:
xdb.c xdb.h xlisten.c
Log Message:
Added changing databases from the command line.
Index: xdb.h
===================================================================
RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** xdb.h 24 May 2005 21:50:42 -0000 1.3
--- xdb.h 17 Jun 2005 22:09:49 -0000 1.4
***************
*** 23,26 ****
--- 23,27 ----
char *xdb_get_table ();
void xdb_set_table (char *table);
+ void xdb_set_dbname (char *table);
int xdb_table_exists (char *table);
Index: xdb.c
===================================================================
RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** xdb.c 24 May 2005 21:50:42 -0000 1.3
--- xdb.c 17 Jun 2005 22:09:49 -0000 1.4
***************
*** 16,22 ****
static char *g_server = "localhost"; //!< Postgres server IP or hostname
static char *g_port = "5432"; //!< Postgres server port
! static char *g_user = "tele"; //!< Postgres server user
! static char *g_passwd = "tiny"; //!< Postgres server password
! static char *g_dbname = "task"; //!< Postgres database to use
static char *g_table = ""; //!< Postgres table to use
--- 16,22 ----
static char *g_server = "localhost"; //!< Postgres server IP or hostname
static char *g_port = "5432"; //!< Postgres server port
! static char *g_user = "firebug"; //!< Postgres server user
! static char *g_passwd = "soedlufr"; //!< Postgres server password
! static char *g_dbname = "firebug"; //!< Postgres database to use
static char *g_table = ""; //!< Postgres table to use
***************
*** 24,27 ****
--- 24,40 ----
void xdb_set_table(char *table) { g_table = table; }
+ void
+ xdb_set_dbname(char *dbname) {
+
+ int errno;
+ char command[256];
+ char * statement = "create database %s template firebug";
+ sprintf(command,statement,dbname);
+ errno = xdb_execute(command);
+ }
+
+
+
+
PGconn *xdb_exit(PGconn *conn)
{
Index: xlisten.c
===================================================================
RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xlisten.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** xlisten.c 24 May 2005 21:50:42 -0000 1.3
--- xlisten.c 17 Jun 2005 22:09:49 -0000 1.4
***************
*** 78,82 ****
g_params.flat = 0; /* default to no params set */
! xpacket_initialize();
while (argc) {
--- 78,82 ----
g_params.flat = 0; /* default to no params set */
!
while (argc) {
***************
*** 158,162 ****
g_params.bits.log_cooked = 1;
if (argv[argc][2] == '=') {
! xdb_set_table(argv[argc]+3);
}
break;
--- 158,165 ----
g_params.bits.log_cooked = 1;
if (argv[argc][2] == '=') {
! //xdb_set_table(argv[argc]+3);
! xdb_set_dbname(argv[argc]+3);
! printf("dbname=%s\n",argv[argc]+3);
! //exit(0);
}
break;
***************
*** 316,319 ****
--- 319,323 ----
parse_args(argc, argv);
+ xpacket_initialize();
while (1) {
***************
*** 348,351 ****
--- 352,357 ----
if (g_params.bits.display_cooked) xpacket_print_cooked(buffer);
}
+
+
}
|