summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-04-11 15:21:51 +0200
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-04-11 15:21:51 +0200
commiteedd4b036bdd5f9d488ff011b7e6947ca1edf312 (patch)
treeb88be43b5e39f216f9d1e5749be4250a0d8ca55c /src/main.c
parentd5969cabc44375026d97f7f3d92e019782cdc331 (diff)
downloadpianobar-eedd4b036bdd5f9d488ff011b7e6947ca1edf312.tar.gz
pianobar-eedd4b036bdd5f9d488ff011b7e6947ca1edf312.tar.bz2
pianobar-eedd4b036bdd5f9d488ff011b7e6947ca1edf312.zip
Read data from fifo
You may change your current station or add shared stations via fifo now
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c
index ec2b052..03dd137 100644
--- a/src/main.c
+++ b/src/main.c
@@ -106,13 +106,13 @@ int main (int argc, char **argv) {
if (settings.username == NULL) {
char nameBuf[100];
BarUiMsg (MSG_QUESTION, "Username: ");
- BarReadlineStr (nameBuf, sizeof (nameBuf), 0);
+ BarReadlineStr (nameBuf, sizeof (nameBuf), 0, stdin);
settings.username = strdup (nameBuf);
}
if (settings.password == NULL) {
char passBuf[100];
BarUiMsg (MSG_QUESTION, "Password: ");
- BarReadlineStr (passBuf, sizeof (passBuf), 1);
+ BarReadlineStr (passBuf, sizeof (passBuf), 1, stdin);
settings.password = strdup (passBuf);
BarUiMsg (MSG_NONE, "\n");
}
@@ -155,7 +155,7 @@ int main (int argc, char **argv) {
}
/* no autostart? ask the user */
if (curStation == NULL) {
- curStation = BarUiSelectStation (&ph, "Select station: ");
+ curStation = BarUiSelectStation (&ph, "Select station: ", stdin);
}
if (curStation != NULL) {
BarUiPrintStation (curStation);
@@ -250,19 +250,20 @@ int main (int argc, char **argv) {
/* in the meantime: wait for user actions;
* 1000ms == 1s => refresh time display every second */
if (poll (polls, pollsLen, 1000) > 0) {
+ FILE *curFd = NULL;
+
if (polls[0].revents & POLLIN) {
- buf = fgetc (stdin);
+ curFd = stdin;
} else if (polls[1].revents & POLLIN) {
- buf = fgetc (ctlFd);
+ curFd = ctlFd;
}
+ buf = fgetc (curFd);
curShortcut = settings.keys;
- /* don't show what the user enters here, we could disable
- * echoing too... */
- BarUiMsg (MSG_NONE, "\r");
+
while (curShortcut != NULL) {
if (curShortcut->key == buf) {
curShortcut->cmd (&ph, &player, &settings, &curSong,
- &curStation, &doQuit);
+ &curStation, &doQuit, curFd);
break;
}
curShortcut = curShortcut->next;