From 3fc7c90630748582192145972ff25f771b7c2ae2 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Sun, 3 Aug 2014 01:31:33 -0400 Subject: [PATCH] stderr redirect doesn't work as intended, add invalid command message when no sound --- src/execute.c | 8 +++++--- src/settings.c | 2 -- src/settings.h | 2 ++ src/toxic.c | 6 ------ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/execute.c b/src/execute.c index f44fcfe..1580e42 100644 --- a/src/execute.c +++ b/src/execute.c @@ -168,7 +168,9 @@ void execute(WINDOW *w, ToxWindow *self, Tox *m, const char *input, int mode) if (do_command(w, self, m, num_args, GLOBAL_NUM_COMMANDS, global_commands, args) == 0) return; - /* Just play sound instead */ - /*line_info_add(self, NULL, NULL, NULL, "Invalid command.", SYS_MSG, 0, 0);*/ - sound_notify(self, error, 0, NULL); +#ifdef _SOUND_NOTIFY + sound_notify(self, error, 0, NULL); +#else + line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Invalid command."); +#endif } diff --git a/src/settings.c b/src/settings.c index d0b520c..bb5d73b 100644 --- a/src/settings.c +++ b/src/settings.c @@ -41,8 +41,6 @@ #define PACKAGE_DATADIR "." #endif -#define NO_SOUND "silent" - const struct _ui_strings { const char* self; const char* timestamps; diff --git a/src/settings.h b/src/settings.h index 13e3092..0ffbe21 100644 --- a/src/settings.h +++ b/src/settings.h @@ -23,6 +23,8 @@ #ifndef _settings_h #define _settings_h +#define NO_SOUND "silent" + /* holds user setting values */ struct user_settings { int autolog; /* boolean */ diff --git a/src/toxic.c b/src/toxic.c index 19d90e2..6c0e50e 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -705,12 +705,6 @@ int main(int argc, char *argv[]) useconds_t msleepval = 40000; uint64_t loopcount = 0; - - /* Redirect stdout to /dev/null - * NOTE: Might not be best solution - */ - freopen("/dev/null", "w", stderr); - while (true) { update_unix_time(); do_toxic(m, prompt);