aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2012-07-17 20:36:36 -0400
committerJeff Garzik <jgarzik@redhat.com>2012-07-17 20:36:36 -0400
commitca6941f8bae368fc6b66292bfc017a12a8abd9d1 (patch)
tree5a1110f7df0fda6794f78c3c44b321ed9ae096a4
parentc192b4cf8bb8715dd4c5e4058f5638fc5c4a81d1 (diff)
downloadrng-tools-ca6941f8bae368fc6b66292bfc017a12a8abd9d1.tar.gz
rng-tools-ca6941f8bae368fc6b66292bfc017a12a8abd9d1.tar.xz
rng-tools-ca6941f8bae368fc6b66292bfc017a12a8abd9d1.zip
Prefer 'bool' to 'int', for boolean values
-rw-r--r--rngd.c22
-rw-r--r--rngd.h10
2 files changed, 16 insertions, 16 deletions
diff --git a/rngd.c b/rngd.c
index 5875671..f83c562 100644
--- a/rngd.c
+++ b/rngd.c
@@ -58,7 +58,7 @@
*/
/* Background/daemon mode */
-int am_daemon; /* Nonzero if we went daemon */
+bool am_daemon; /* True if we went daemon */
bool server_running = true; /* set to false, to stop daemon */
@@ -113,10 +113,10 @@ static struct arguments default_arguments = {
.poll_timeout = 60,
.random_step = 64,
.fill_watermark = 2048,
- .daemon = 1,
- .enable_tpm = 1,
- .quiet = 0,
- .verbose = 0,
+ .daemon = true,
+ .enable_tpm = true,
+ .quiet = false,
+ .verbose = false,
};
struct arguments *arguments = &default_arguments;
@@ -159,10 +159,10 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
}
case 'f':
- arguments->daemon = 0;
+ arguments->daemon = false;
break;
case 'b':
- arguments->daemon = 1;
+ arguments->daemon = true;
break;
case 's':
if (sscanf(arg, "%i", &arguments->random_step) == 0)
@@ -177,17 +177,17 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
break;
}
case 'q':
- arguments->quiet = 1;
+ arguments->quiet = true;
break;
case 'v':
- arguments->verbose = 1;
+ arguments->verbose = true;
break;
case 'n': {
int n;
if ((sscanf(arg,"%i", &n) == 0) || ((n | 1)!=1))
argp_usage(state);
else
- arguments->enable_tpm = 0;
+ arguments->enable_tpm = false;
break;
}
@@ -324,7 +324,7 @@ int main(int argc, char **argv)
init_kernel_rng(arguments->random_name);
if (arguments->daemon) {
- am_daemon = 1;
+ am_daemon = true;
if (daemon(0, 0) < 0) {
if(!arguments->quiet)
diff --git a/rngd.h b/rngd.h
index 074bcd6..3ac495f 100644
--- a/rngd.h
+++ b/rngd.h
@@ -46,10 +46,10 @@ struct arguments {
int fill_watermark;
double poll_timeout;
- int quiet;
- int verbose;
- int daemon;
- int enable_tpm;
+ bool quiet;
+ bool verbose;
+ bool daemon;
+ bool enable_tpm;
};
extern struct arguments *arguments;
@@ -67,7 +67,7 @@ struct rng {
};
/* Background/daemon mode */
-extern int am_daemon; /* Nonzero if we went daemon */
+extern bool am_daemon; /* True if we went daemon */
/*