diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-05-29 18:51:53 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-05-29 18:51:53 +0200 |
commit | a6c521fecd91867c6e184106f4e63445d1cb158a (patch) | |
tree | 15151d4f86de5567c366a35434daee62021525b1 | |
parent | 83bfec016bd1a0c50f2d34822ecd1be4a2c8a4c6 (diff) | |
download | pianobar-windows-a6c521fecd91867c6e184106f4e63445d1cb158a.tar.gz pianobar-windows-a6c521fecd91867c6e184106f4e63445d1cb158a.tar.bz2 pianobar-windows-a6c521fecd91867c6e184106f4e63445d1cb158a.zip |
Re-enable terminal echoing on exit
-rw-r--r-- | src/main.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -33,6 +33,8 @@ THE SOFTWARE. #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +/* tcset/getattr () */ +#include <termios.h> /* last.fm scrobbling library */ #include <wardrobe.h> @@ -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; } |