SILC_LOG_DEBUG(("Allocating hash table with %d entries (%s)",
count, auto_rehash ? "auto rehash" : "no auto rehash"));
- t = silc_hash_table_alloc(0, hash_entry, NULL,
+ t = silc_hash_table_alloc(NULL, 0, hash_entry, NULL,
hash_compare, NULL,
hash_destructor, NULL, auto_rehash);
int main(int argc, char **argv)
{
SilcBool success = FALSE;
+ SilcGetOptStruct op = SILC_GETOPT_INIT;
+ int opt;
int i;
- if (argc > 1 && !strcmp(argv[1], "-d")) {
- silc_log_debug(TRUE);
- silc_log_debug_hexdump(TRUE);
- silc_log_quick(TRUE);
- silc_log_set_debug_string("*table*");
- }
-
- if (argc > 1 && !strcmp(argv[1], "-D")) {
- silc_log_debug(TRUE);
- dump = TRUE;
- silc_log_set_debug_string("*table*");
+ while ((opt = silc_getopt(argc, argv, "de::D", &op)) != -1) {
+ switch (opt) {
+ case 'd':
+ silc_log_debug(TRUE);
+ silc_log_debug_hexdump(TRUE);
+ silc_log_quick(TRUE);
+ silc_log_set_debug_string("*table*,*errno*");
+ break;
+
+ case 'D':
+ silc_log_debug(TRUE);
+ dump = TRUE;
+ silc_log_set_debug_string("*table*,*errno*");
+ break;
+
+ case 'e':
+ silc_log_debug(TRUE);
+ fprintf(stderr, "%s\n", op.opt_arg);
+ if (op.opt_arg) {
+ dump = TRUE;
+ silc_log_set_debug_string(op.opt_arg);
+ }
+ break;
+
+ default:
+ exit(1);
+ break;
+ }
}
if (!alloc_table())