Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
357712c8
Commit
357712c8
authored
Dec 27, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmdline: use gboolean instead of int
Prepare for the migration to the GLib option parser, which uses gboolean for flags.
parent
786bb8cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
cmdline.c
src/cmdline.c
+9
-11
cmdline.h
src/cmdline.h
+6
-4
No files found.
src/cmdline.c
View file @
357712c8
...
...
@@ -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
();
...
...
src/cmdline.h
View file @
357712c8
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment