From a6c521fecd91867c6e184106f4e63445d1cb158a Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 29 May 2009 18:51:53 +0200 Subject: Re-enable terminal echoing on exit --- src/main.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 8409583..8965bb9 100644 --- a/src/main.c +++ b/src/main.c @@ -33,6 +33,8 @@ THE SOFTWARE. #include #include #include +/* tcset/getattr () */ +#include /* last.fm scrobbling library */ #include @@ -75,11 +77,15 @@ int main (int argc, char **argv) { nfds_t pollsLen = 0; char buf = '\0'; BarKeyShortcut_t *curShortcut = NULL; + /* terminal attributes _before_ we started messing around with ~ECHO */ + struct termios termOrig; BarUiMsg (MSG_NONE, "Welcome to " PACKAGE "!\n"); - /* init some things */ + /* save terminal attributes, before disabling echoing */ + tcgetattr (fileno (stdin), &termOrig); BarTermSetEcho (0); + /* init some things */ xmlInitParser (); ao_initialize (); PianoInit (&ph); @@ -124,7 +130,9 @@ int main (int argc, char **argv) { /* setup control connection */ if (settings.controlProxy != NULL) { char tmpPath[2]; - WaitressSplitUrl (settings.controlProxy, ph.waith.proxyHost, sizeof (ph.waith.proxyHost), ph.waith.proxyPort, sizeof (ph.waith.proxyPort), tmpPath, sizeof (tmpPath)); + WaitressSplitUrl (settings.controlProxy, ph.waith.proxyHost, + sizeof (ph.waith.proxyHost), ph.waith.proxyPort, + sizeof (ph.waith.proxyPort), tmpPath, sizeof (tmpPath)); } BarTermSetBuffer (0); @@ -296,5 +304,8 @@ int main (int argc, char **argv) { xmlCleanupParser (); BarSettingsDestroy (&settings); + /* restore terminal attributes, zsh doesn't need this, bash does... */ + tcsetattr (fileno (stdin), TCSANOW, &termOrig); + return 0; } -- cgit v1.2.3