aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-27 19:35:30 +0100
committerMax Kellermann <max@duempel.org>2008-12-27 19:35:30 +0100
commit357712c8f31ad93e6888568dbe9ea06cf93bdd8e (patch)
treeed536cf920b945a4aa82cd7d102d51d1494a8796
parent786bb8cc33e4a9dc20cb7f1eb50beff6cddc5590 (diff)
downloadmpd-357712c8f31ad93e6888568dbe9ea06cf93bdd8e.tar.gz
mpd-357712c8f31ad93e6888568dbe9ea06cf93bdd8e.tar.xz
mpd-357712c8f31ad93e6888568dbe9ea06cf93bdd8e.zip
cmdline: use gboolean instead of int
Prepare for the migration to the GLib option parser, which uses gboolean for flags.
Diffstat (limited to '')
-rw-r--r--src/cmdline.c20
-rw-r--r--src/cmdline.h10
2 files changed, 15 insertions, 15 deletions
diff --git a/src/cmdline.c b/src/cmdline.c
index 418274636..20c62f53c 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -27,8 +27,6 @@
#include "archive_list.h"
#endif
-#include <glib.h>
-
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -88,11 +86,11 @@ void parseOptions(int argc, char **argv, Options *options)
{
int argcLeft = argc;
- options->verbose = 0;
- options->daemon = 1;
- options->stdOutput = 0;
+ options->kill = false;
+ options->daemon = true;
+ options->stdOutput = false;
+ options->verbose = false;
options->createDB = 0;
- options->kill = 0;
if (argc > 1) {
int i = 1;
@@ -102,16 +100,16 @@ void parseOptions(int argc, char **argv, Options *options)
usage(argv);
exit(EXIT_SUCCESS);
} else if (strcmp(argv[i], "--kill") == 0) {
- options->kill++;
+ options->kill = true;
argcLeft--;
} else if (strcmp(argv[i], "--no-daemon") == 0) {
- options->daemon = 0;
+ options->daemon = false;
argcLeft--;
} else if (strcmp(argv[i], "--stdout") == 0) {
- options->stdOutput = 1;
+ options->stdOutput = true;
argcLeft--;
} else if (strcmp(argv[i], "--create-db") == 0) {
- options->stdOutput = 1;
+ options->stdOutput = true;
options->createDB = 1;
argcLeft--;
} else if (strcmp(argv[i], "--no-create-db") ==
@@ -119,7 +117,7 @@ void parseOptions(int argc, char **argv, Options *options)
options->createDB = -1;
argcLeft--;
} else if (strcmp(argv[i], "--verbose") == 0) {
- options->verbose = 1;
+ options->verbose = true;
argcLeft--;
} else if (strcmp(argv[i], "--version") == 0) {
version();
diff --git a/src/cmdline.h b/src/cmdline.h
index 22b24901b..295cdec81 100644
--- a/src/cmdline.h
+++ b/src/cmdline.h
@@ -19,12 +19,14 @@
#ifndef CMDLINE_H
#define CMDLINE_H
+#include <glib.h>
+
typedef struct _Options {
- int kill;
- int daemon;
- int stdOutput;
+ gboolean kill;
+ gboolean daemon;
+ gboolean stdOutput;
+ gboolean verbose;
int createDB;
- int verbose;
} Options;
void parseOptions(int argc, char **argv, Options *options);