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
6a16e08f
Commit
6a16e08f
authored
May 31, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --stdout and make --no-daemon by default output to log files
git-svn-id:
https://svn.musicpd.org/mpd/trunk@1267
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
1a5b04e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
27 deletions
+28
-27
TODO
TODO
+5
-15
main.c
src/main.c
+23
-12
No files found.
TODO
View file @
6a16e08f
...
...
@@ -7,25 +7,15 @@
e) ensure URL's are all ASCII, and properly %'d! check rfc's
for legal characters
2)
have --no-daemon still output to log files, and add option --no-log-fil
es
2)
ACK error cod
es
3) resampling audio for compatibility, and better gapless/crossfading
a) use resampling from oggenc (is it fast enough for realtime?)
3) cleanup main()
4) when writing combined interface for all decodes to use, be sure to add a
common function and abstrct dealing with DecoderControl * and put
cycleLogFiles in there, so we cycleLogFiles while decoding, not just when
decoding has stopped.
4) handle '\n' in filenames
5)
ACK error code
s
5)
compute average replaygain to use for non-replaygain song
s
6) cleanup main()
7) handle '\n' in filenames
8) compute average replaygain to use for non-replaygain songs
9) change default port to 6600
6) change default port to 6600
Post-1.0
...
...
src/main.c
View file @
6a16e08f
...
...
@@ -60,6 +60,7 @@ typedef struct _Options {
char
*
usr
;
char
*
dbFile
;
int
daemon
;
int
stdOutput
;
int
createDB
;
int
onlyCreateDB
;
int
onlyUpdateDB
;
...
...
@@ -76,6 +77,7 @@ void usage(char * argv[]) {
ERROR
(
"options:
\n
"
);
ERROR
(
" --help this usage statement
\n
"
);
ERROR
(
" --no-daemon don't detach from console
\n
"
);
ERROR
(
" --stdout print msgs to stdout and stderr
\n
"
);
ERROR
(
" --create-db force (re)creation database
\n
"
);
ERROR
(
" --only-create-db create database and exit
\n
"
);
ERROR
(
" --only-update-db create database and exit
\n
"
);
...
...
@@ -116,6 +118,7 @@ void parseOptions(int argc, char ** argv, Options * options) {
options
->
usr
=
NULL
;
options
->
daemon
=
1
;
options
->
stdOutput
=
0
;
options
->
createDB
=
0
;
options
->
onlyCreateDB
=
0
;
options
->
onlyUpdateDB
=
0
;
...
...
@@ -133,6 +136,10 @@ void parseOptions(int argc, char ** argv, Options * options) {
options
->
daemon
=
0
;
argcLeft
--
;
}
else
if
(
strcmp
(
argv
[
i
],
"--stdout"
)
==
0
)
{
options
->
stdOutput
=
1
;
argcLeft
--
;
}
else
if
(
strcmp
(
argv
[
i
],
"--create-db"
)
==
0
)
{
options
->
createDB
=
1
;
argcLeft
--
;
...
...
@@ -382,6 +389,22 @@ int main(int argc, char * argv[]) {
exit
(
EXIT_FAILURE
);
}
fflush
(
NULL
);
pid
=
fork
();
if
(
pid
>
0
)
_exit
(
EXIT_SUCCESS
);
else
if
(
pid
<
0
)
{
ERROR
(
"problems fork'ing for daemon!
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
if
(
options
.
stdOutput
)
{
fclose
(
out
);
fclose
(
err
);
}
else
{
fflush
(
NULL
);
if
(
dup2
(
fileno
(
out
),
STDOUT_FILENO
)
<
0
)
{
myfprintf
(
err
,
"problems dup2 stdout : %s
\n
"
,
strerror
(
errno
));
...
...
@@ -395,18 +418,6 @@ int main(int argc, char * argv[]) {
}
myfprintfStdLogMode
(
out
,
err
,
options
.
logFile
,
options
.
errorFile
);
fflush
(
NULL
);
pid
=
fork
();
if
(
pid
>
0
)
_exit
(
EXIT_SUCCESS
);
else
if
(
pid
<
0
)
{
ERROR
(
"problems fork'ing for daemon!
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
else
{
fclose
(
out
);
fclose
(
err
);
}
/* lets redirect stdin to dev null as a work around for libao bug */
...
...
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