fixed bug with enviorment variable configuration

This commit is contained in:
Rachel Lambda Samuelsson 2021-01-28 17:06:07 +01:00
parent 8e84f1224b
commit 568b4ca250

View File

@ -24,10 +24,10 @@
/* mpd globals */
struct mpd_connection* connection = 0;
int mpd_fd = 0;
char* mpd_db_dir = 0;
char* mpd_host = 0;
unsigned mpd_port = 0;
unsigned mpd_timeout = 0;
char* mpd_db_dir;
char* mpd_host;
unsigned mpd_port;
unsigned mpd_timeout;
/* x globals */
Display* xdisplay;
@ -272,8 +272,12 @@ int main(int argc, char** argv) {
/* get args from environment */
mpd_db_dir = getenv("MPDART_DIR");
mpd_host = getenv("MPDART_HOST");
mpd_port = getenv("MPDART_PORT");
mpd_timeout = getenv("MPDART_TIMEOUT");
char* port = getenv("MPDART_PORT");
mpd_port = port ? atoi(port) : 0;
char* timeout = getenv("MPDART_TIMEOUT");
mpd_timeout = timeout ? atoi(timeout) : 0;
/* parse args */
while (*++argv) {