aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-03-23 19:17:20 +0000
committerKalle Wallin <kaw@linux.se>2004-03-23 19:17:20 +0000
commitc7444417a1ed04aee6144ca4754ed758dcb0c208 (patch)
tree2fe65f61cc4590bc6f5bc38e2bc3e95c7e609362 /main.c
parent2adb895c7853727adc57eae84229969203bf5731 (diff)
downloadmpd-c7444417a1ed04aee6144ca4754ed758dcb0c208.tar.gz
mpd-c7444417a1ed04aee6144ca4754ed758dcb0c208.tar.xz
mpd-c7444417a1ed04aee6144ca4754ed758dcb0c208.zip
Use screen_status_printf() instead of screen_status_message().
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@418 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'main.c')
-rw-r--r--main.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/main.c b/main.c
index 0a4405112..7bd80c5dd 100644
--- a/main.c
+++ b/main.c
@@ -1,8 +1,3 @@
-/*
- * $Id: main.c,v 1.5 2004/03/16 14:34:49 kalle Exp $
- *
- */
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -17,10 +12,9 @@
#include "command.h"
#include "screen.h"
-#define BUFSIZE 256
-
static mpd_client_t *mpc = NULL;
+
void
exit_and_cleanup(void)
{
@@ -42,7 +36,7 @@ catch_sigint( int sig )
}
int
-main(int argc, char *argv[])
+main(int argc, const char *argv[])
{
options_t *options;
struct sigaction act;
@@ -96,6 +90,7 @@ main(int argc, char *argv[])
if( mpc_error(mpc) )
exit(EXIT_FAILURE);
+ /* initialize curses */
screen_init();
counter=0;
@@ -103,16 +98,14 @@ main(int argc, char *argv[])
while( connected || options->reconnect )
{
command_t cmd;
- char buf[BUFSIZE];
-
+
if( connected && counter==0 )
{
mpc_update(mpc);
if( mpc_error(mpc) )
{
connected=0;
- snprintf(buf, BUFSIZE, "Lost connection to %s", options->host);
- screen_status_message(mpc, buf);
+ screen_status_printf("Lost connection to %s", options->host);
mpd_closeConnection(mpc->connection);
mpc->connection = NULL;
}
@@ -133,14 +126,11 @@ main(int argc, char *argv[])
else if( options->reconnect )
{
sleep(3);
- snprintf(buf, BUFSIZE,
- "Connecting to %s... [Press Ctrl-C to abort]",
- options->host);
- screen_status_message(mpc, buf);
+ screen_status_printf("Connecting to %s... [Press Ctrl-C to abort]",
+ options->host);
if( mpc_reconnect(mpc, options->host, options->port) == 0 )
{
- snprintf(buf, BUFSIZE, "Connected to %s!", options->host);
- screen_status_message(mpc, buf);
+ screen_status_printf("Connected to %s!", options->host);
connected=1;
counter=0;
}