{"ServerDesc", {{PARAM_STRING, 0, &ServerDesc}}},
{"ServerName", {{PARAM_STRING, 0, &ServerName}}},
{"MysqlServer", {{PARAM_STRING, 0, &MysqlServer}}},
- {"MysqlPort", {{PARAM_PORT, 0, &MysqlPort}}},
+ {"MysqlPort", {{PARAM_POSINT, 0, &MysqlPort}}},
{"MysqlDatabase", {{PARAM_STRING, 0, &MysqlDatabase}}},
{"MysqlUser", {{PARAM_STRING, 0, &MysqlUser}}},
{"MysqlPassword", {{PARAM_STRING, 0, &MysqlPassword}}},
mysql_close(myptr);
/* connecting to MySQL */
myptr = mysql_init(NULL);
- if (!mysql_real_connect
- (myptr, MysqlServer, MysqlUser, MysqlPassword, MysqlDatabase, *MysqlPort,
- NULL, 0))
+
+
+ if (mysql_real_connect
+ (myptr, MysqlServer, MysqlUser, MysqlPassword, MysqlDatabase, MysqlPort,
+ NULL, 0) == NULL)
fatal("Failed to connect to database : %s\n", mysql_error(myptr));
/* Cleaning up the database */
char *ch1, *ch2;
int opt = 0;
int opt_index = 0;
+ int config = 0;
static struct option thales_options[] =
{
/* record start time */
start_time = time(NULL);
- opt = getopt_long(argc, argv, "chvVd",
+ opt = getopt_long(argc, argv, "c:hvVd",
thales_options, &opt_index);
while(opt != EOF)
{
exit(EXIT_FAILURE);
}
+
+ config = 1;
break;
case 'd':
usage();
}
- opt = getopt_long(argc, argv, "hvVc:",
+ opt = getopt_long(argc, argv, "hvVdc:",
thales_options, &opt_index);
}
+ if(config == 0)
+ {
+ fprintf(stderr, "Error: no configuration file loaded!\n");
+ exit(EXIT_FAILURE);
+ }
/* Open logfile, and complain if we didn't. */