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 */
struct flags
{
int none;
int export;
int import;
int verify;
int vacuum;
int pretend;
int verbose;
int wipe;
int dupes_ok;
} flag = {YES, NO, NO, NO, NO, NO, NO, NO, NO};
bool none;
bool export;
bool import;
bool verify;
bool vacuum;
bool pretend;
bool verbose;
bool wipe;
bool dupes_ok;
} flag = {true, false, false, false, false, false, false, false, false};
/* *INDENT-ON* */
static int table_has_rows(const char *table);
@ -145,32 +145,32 @@ main(int argc, char *argv[])
print_help(EXIT_SUCCESS);
break;
case 'i':
flag.none = NO;
flag.import = YES;
flag.none = false;
flag.import = true;
break;
case 'e':
flag.none = NO;
flag.export = YES;
flag.none = false;
flag.export = true;
break;
case 'u':
flag.none = NO;
flag.verify = YES;
flag.none = false;
flag.verify = true;
break;
case 's':
flag.none = NO;
flag.vacuum = YES;
flag.none = false;
flag.vacuum = true;
break;
case 'p':
flag.pretend = YES;
flag.pretend = true;
break;
case 'v':
flag.verbose = YES;
flag.verbose = true;
break;
case 'w':
flag.wipe = YES;
flag.wipe = true;
break;
case 'd':
flag.dupes_ok = YES;
flag.dupes_ok = true;
break;
default: /* '?' */
print_help(EXIT_FAILURE);
@ -200,7 +200,7 @@ main(int argc, char *argv[])
fprintf(stdout,
"* charybdis bantool v.%s\n", BT_VERSION);
if(flag.pretend == NO)
if(flag.pretend == false)
{
if(rsdb_init(db_error_cb) == -1)
{
@ -214,7 +214,7 @@ main(int argc, char *argv[])
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++)
fprintf(stdout,
"* WARNING: YOU ARE ABOUT TO WIPE YOUR DATABASE!\n");
@ -226,7 +226,7 @@ main(int argc, char *argv[])
wipe_schema();
}
}
if(flag.verbose && flag.dupes_ok == YES)
if(flag.verbose && flag.dupes_ok == true)
fprintf(stdout, "* Allowing duplicate bans...\n");
/* 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",
etc, bandb_table[i], bandb_suffix[i]);
if(flag.import && flag.pretend == NO)
if(flag.import && flag.pretend == false)
rsdb_transaction(RSDB_TRANS_START);
if(flag.import)
@ -244,7 +244,7 @@ main(int argc, char *argv[])
if(flag.export)
export_config(conf, i);
if(flag.import && flag.pretend == NO)
if(flag.import && flag.pretend == false)
rsdb_transaction(RSDB_TRANS_END);
}
@ -497,9 +497,9 @@ import_config(const char *conf, int id)
else
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]);
rsdb_exec(NULL,

View file

@ -31,19 +31,6 @@
#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 */
#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 show_temp_klines(struct Client *, rb_dlink_list *);
extern int rehash(int);
extern void rehash_bans(int);
extern bool rehash(bool);
extern void rehash_bans(void);
extern int conf_add_server(struct ConfItem *, int);
extern void conf_add_class_to_conf(struct ConfItem *);

View file

@ -290,13 +290,13 @@ check_rehash(void *unused)
*/
if(dorehash)
{
rehash(1);
rehash(true);
dorehash = false;
}
if(dorehashbans)
{
rehash_bans(1);
rehash_bans();
dorehashbans = false;
}
@ -696,7 +696,7 @@ charybdis_main(int argc, char *argv[])
init_bandb();
init_ssld();
rehash_bans(0);
rehash_bans();
initialize_server_capabs(); /* Set up default_server_capabs */
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
* called as a result of the server receiving a HUP signal.
*/
int
rehash(int sig)
bool
rehash(bool sig)
{
if(sig != 0)
if(sig)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Got signal SIGHUP, reloading ircd conf. file");
@ -647,7 +647,7 @@ rehash(int sig)
rehash_authd();
/* 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)
rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info));
@ -655,11 +655,11 @@ rehash(int sig)
rb_strlcpy(me.info, "unknown", sizeof(me.info));
open_logfiles();
return (0);
return false;
}
void
rehash_bans(int sig)
rehash_bans(void)
{
bandb_rehash_bans();
}

View file

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

View file

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