1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-06-27 15:13:15 +00:00

cleanup: formatting

This commit is contained in:
jcorporation 2018-07-15 23:51:36 +01:00
parent ed2277ddc2
commit 9b71a5e6ae
2 changed files with 7 additions and 8 deletions

View File

@ -80,7 +80,7 @@ void callback_mympd(struct mg_connection *nc, const struct mg_str msg)
case MPD_API_SET_SETTINGS:
json_scanf(msg.p, msg.len, "{ data: { notificationWeb: %d, notificationPage: %d} }", &state.a, &state.b);
char tmpfile[200];
snprintf(tmpfile,200,"%s.tmp",mpd.statefile);
snprintf(tmpfile,200,"%s.tmp", mpd.statefile);
json_fprintf(tmpfile, "{ notificationWeb: %d, notificationPage: %d}", state.a, state.b);
rename(tmpfile,mpd.statefile);

View File

@ -121,7 +121,7 @@ int main(int argc, char **argv) {
strcpy(mpd.host, "127.0.0.1");
streamport = 8000;
strcpy(coverimage, "folder.jpg");
mpd.statefile="/var/lib/mympd/mympd.state";
mpd.statefile = "/var/lib/mympd/mympd.state";
struct mg_bind_opts bind_opts;
const char *err;
bool ssl = false;
@ -192,7 +192,7 @@ int main(int argc, char **argv) {
case 'v':
fprintf(stdout, "myMPD %d.%d.%d\n"
"Copyright (C) 2018 Juergen Mang <mail@jcgames.de>\n"
"Built " __DATE__ " "__TIME__ "\n",
"Built " __DATE__ " "__TIME__"\n",
MYMPD_VERSION_MAJOR, MYMPD_VERSION_MINOR, MYMPD_VERSION_PATCH);
return EXIT_SUCCESS;
break;
@ -229,7 +229,7 @@ int main(int argc, char **argv) {
snprintf(s_redirect, 200, "https://%s:%s/", hostname, sslport);
nc_http = mg_bind(&mgr, webport, ev_handler_http);
if (nc_http == NULL) {
fprintf(stderr, "Error starting server on port %s", webport );
fprintf(stderr, "Error starting server on port %s\n", webport );
return EXIT_FAILURE;
}
memset(&bind_opts, 0, sizeof(bind_opts));
@ -245,7 +245,7 @@ int main(int argc, char **argv) {
else {
nc = mg_bind(&mgr, webport, ev_handler);
if (nc == NULL) {
fprintf(stderr, "Error starting server on port %s", webport );
fprintf(stderr, "Error starting server on port %s\n", webport );
return EXIT_FAILURE;
}
}
@ -257,7 +257,7 @@ int main(int argc, char **argv) {
printf("Unknown user\n");
return EXIT_FAILURE;
} else if (setgid(pw->pw_gid) != 0) {
printf("setgid() failed");
printf("setgid() failed\n");
return EXIT_FAILURE;
} else if (setuid(pw->pw_uid) != 0) {
printf("setuid() failed\n");
@ -285,8 +285,7 @@ int main(int argc, char **argv) {
while (s_signal_received == 0) {
mg_mgr_poll(&mgr, 200);
current_timer = time(NULL);
if(current_timer - last_timer)
{
if (current_timer - last_timer) {
last_timer = current_timer;
mympd_poll(&mgr);
}