Send YES/NO to Davy Jones's Locker.

This commit is contained in:
Elizabeth Myers 2016-03-23 08:52:32 -05:00
parent bd43a44469
commit ab31d2b07e
7 changed files with 42 additions and 55 deletions

View file

@ -93,16 +93,16 @@ struct counter
/* flags set by command line options */ /* flags set by command line options */
struct flags struct flags
{ {
int none; bool none;
int export; bool export;
int import; bool import;
int verify; bool verify;
int vacuum; bool vacuum;
int pretend; bool pretend;
int verbose; bool verbose;
int wipe; bool wipe;
int dupes_ok; bool dupes_ok;
} flag = {YES, NO, NO, NO, NO, NO, NO, NO, NO}; } flag = {true, false, false, false, false, false, false, false, false};
/* *INDENT-ON* */ /* *INDENT-ON* */
static int table_has_rows(const char *table); static int table_has_rows(const char *table);
@ -145,32 +145,32 @@ main(int argc, char *argv[])
print_help(EXIT_SUCCESS); print_help(EXIT_SUCCESS);
break; break;
case 'i': case 'i':
flag.none = NO; flag.none = false;
flag.import = YES; flag.import = true;
break; break;
case 'e': case 'e':
flag.none = NO; flag.none = false;
flag.export = YES; flag.export = true;
break; break;
case 'u': case 'u':
flag.none = NO; flag.none = false;
flag.verify = YES; flag.verify = true;
break; break;
case 's': case 's':
flag.none = NO; flag.none = false;
flag.vacuum = YES; flag.vacuum = true;
break; break;
case 'p': case 'p':
flag.pretend = YES; flag.pretend = true;
break; break;
case 'v': case 'v':
flag.verbose = YES; flag.verbose = true;
break; break;
case 'w': case 'w':
flag.wipe = YES; flag.wipe = true;
break; break;
case 'd': case 'd':
flag.dupes_ok = YES; flag.dupes_ok = true;
break; break;
default: /* '?' */ default: /* '?' */
print_help(EXIT_FAILURE); print_help(EXIT_FAILURE);
@ -200,7 +200,7 @@ main(int argc, char *argv[])
fprintf(stdout, fprintf(stdout,
"* charybdis bantool v.%s\n", BT_VERSION); "* charybdis bantool v.%s\n", BT_VERSION);
if(flag.pretend == NO) if(flag.pretend == false)
{ {
if(rsdb_init(db_error_cb) == -1) if(rsdb_init(db_error_cb) == -1)
{ {
@ -214,7 +214,7 @@ main(int argc, char *argv[])
if(flag.import && flag.wipe) if(flag.import && flag.wipe)
{ {
flag.dupes_ok = YES; /* dont check for dupes if we are wiping the db clean */ flag.dupes_ok = true; /* dont check for dupes if we are wiping the db clean */
for(i = 0; i < 3; i++) for(i = 0; i < 3; i++)
fprintf(stdout, fprintf(stdout,
"* WARNING: YOU ARE ABOUT TO WIPE YOUR DATABASE!\n"); "* WARNING: YOU ARE ABOUT TO WIPE YOUR DATABASE!\n");
@ -226,7 +226,7 @@ main(int argc, char *argv[])
wipe_schema(); wipe_schema();
} }
} }
if(flag.verbose && flag.dupes_ok == YES) if(flag.verbose && flag.dupes_ok == true)
fprintf(stdout, "* Allowing duplicate bans...\n"); fprintf(stdout, "* Allowing duplicate bans...\n");
/* checking for our files to import or export */ /* checking for our files to import or export */
@ -235,7 +235,7 @@ main(int argc, char *argv[])
snprintf(conf, sizeof(conf), "%s/%s.conf%s", snprintf(conf, sizeof(conf), "%s/%s.conf%s",
etc, bandb_table[i], bandb_suffix[i]); etc, bandb_table[i], bandb_suffix[i]);
if(flag.import && flag.pretend == NO) if(flag.import && flag.pretend == false)
rsdb_transaction(RSDB_TRANS_START); rsdb_transaction(RSDB_TRANS_START);
if(flag.import) if(flag.import)
@ -244,7 +244,7 @@ main(int argc, char *argv[])
if(flag.export) if(flag.export)
export_config(conf, i); export_config(conf, i);
if(flag.import && flag.pretend == NO) if(flag.import && flag.pretend == false)
rsdb_transaction(RSDB_TRANS_END); rsdb_transaction(RSDB_TRANS_END);
} }
@ -497,9 +497,9 @@ import_config(const char *conf, int id)
else else
snprintf(newreason, sizeof(newreason), "%s", f_reason); snprintf(newreason, sizeof(newreason), "%s", f_reason);
if(flag.pretend == NO) if(flag.pretend == false)
{ {
if(flag.dupes_ok == NO) if(flag.dupes_ok == false)
drop_dupes(f_mask1, f_mask2, bandb_table[id]); drop_dupes(f_mask1, f_mask2, bandb_table[id]);
rsdb_exec(NULL, rsdb_exec(NULL,

View file

@ -31,19 +31,6 @@
#endif #endif
/* Blah. I use these a lot. -Dianora */
#ifdef YES
#undef YES
#endif
#define YES 1
#ifdef NO
#undef NO
#endif
#define NO 0
/* Just blindly define our own MIN/MAX macro */ /* Just blindly define our own MIN/MAX macro */
#define IRCD_MAX(a, b) ((a) > (b) ? (a) : (b)) #define IRCD_MAX(a, b) ((a) > (b) ? (a) : (b))

View file

@ -373,8 +373,8 @@ extern void add_temp_dline(struct ConfItem *);
extern void report_temp_klines(struct Client *); extern void report_temp_klines(struct Client *);
extern void show_temp_klines(struct Client *, rb_dlink_list *); extern void show_temp_klines(struct Client *, rb_dlink_list *);
extern int rehash(int); extern bool rehash(bool);
extern void rehash_bans(int); extern void rehash_bans(void);
extern int conf_add_server(struct ConfItem *, int); extern int conf_add_server(struct ConfItem *, int);
extern void conf_add_class_to_conf(struct ConfItem *); extern void conf_add_class_to_conf(struct ConfItem *);

View file

@ -290,13 +290,13 @@ check_rehash(void *unused)
*/ */
if(dorehash) if(dorehash)
{ {
rehash(1); rehash(true);
dorehash = false; dorehash = false;
} }
if(dorehashbans) if(dorehashbans)
{ {
rehash_bans(1); rehash_bans();
dorehashbans = false; dorehashbans = false;
} }
@ -696,7 +696,7 @@ charybdis_main(int argc, char *argv[])
init_bandb(); init_bandb();
init_ssld(); init_ssld();
rehash_bans(0); rehash_bans();
initialize_server_capabs(); /* Set up default_server_capabs */ initialize_server_capabs(); /* Set up default_server_capabs */
initialize_global_set_options(); initialize_global_set_options();

View file

@ -636,10 +636,10 @@ attach_conf(struct Client *client_p, struct ConfItem *aconf)
* as a result of an operator issuing this command, else assume it has been * as a result of an operator issuing this command, else assume it has been
* called as a result of the server receiving a HUP signal. * called as a result of the server receiving a HUP signal.
*/ */
int bool
rehash(int sig) rehash(bool sig)
{ {
if(sig != 0) if(sig)
{ {
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Got signal SIGHUP, reloading ircd conf. file"); "Got signal SIGHUP, reloading ircd conf. file");
@ -647,7 +647,7 @@ rehash(int sig)
rehash_authd(); rehash_authd();
/* don't close listeners until we know we can go ahead with the rehash */ /* don't close listeners until we know we can go ahead with the rehash */
read_conf_files(NO); read_conf_files(false);
if(ServerInfo.description != NULL) if(ServerInfo.description != NULL)
rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info)); rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info));
@ -655,11 +655,11 @@ rehash(int sig)
rb_strlcpy(me.info, "unknown", sizeof(me.info)); rb_strlcpy(me.info, "unknown", sizeof(me.info));
open_logfiles(); open_logfiles();
return (0); return false;
} }
void void
rehash_bans(int sig) rehash_bans(void)
{ {
bandb_rehash_bans(); bandb_rehash_bans();
} }

View file

@ -196,7 +196,7 @@ find_shared_conf(const char *username, const char *host,
} }
} }
return NO; return false;
} }
void void

View file

@ -73,7 +73,7 @@ rehash_bans_loc(struct Client *source_p)
if (!MyConnect(source_p)) if (!MyConnect(source_p))
remote_rehash_oper_p = source_p; remote_rehash_oper_p = source_p;
rehash_bans(0); rehash_bans();
} }
static void static void