All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky at gmail.com>
To: powertop@lists.01.org
Subject: [Powertop] [PATCH] do not implement get_user_input() in DISABLE_NCURSES builds
Date: Mon, 20 Aug 2012 00:57:34 +0300	[thread overview]
Message-ID: <20120819215734.GA3137@swordfish> (raw)

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

do not implement get_user_input() in DISABLE_NCURSES builds

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>

---

 src/lib.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/lib.cpp b/src/lib.cpp
index 77e49a2..ddb0b5c 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -436,12 +436,16 @@ void process_directory(const char *d_name, callback fn)
 
 int get_user_input(char *buf, unsigned sz)
 {
+	int ret = 0;
+#ifndef DISABLE_NCURSES
 	fflush(stdout);
 	echo();
 	/* Upon successful completion, these functions return OK. Otherwise, they return ERR. */
-	int ret = getnstr(buf, sz);
+	ret = getnstr(buf, sz);
 	noecho();
 	fflush(stdout);
 	/* to distinguish between getnstr error and empty line */
-	return ret || strlen(buf);
+	ret |= strlen(buf);
+#endif
+	return ret;
 }

             reply	other threads:[~2012-08-19 21:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-19 21:57 Sergey Senozhatsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-20  0:40 [Powertop] [PATCH] do not implement get_user_input() in DISABLE_NCURSES builds Arjan van de Ven
2012-08-20  9:49 Sergey Senozhatsky
2012-08-20 15:18 Chris Ferron
2012-08-20 15:21 Arjan van de Ven
2012-08-20 15:31 Sergey Senozhatsky
2012-08-20 15:31 Chris Ferron
2012-08-20 15:34 Arjan van de Ven
2012-08-20 18:17 Chris Ferron
2012-08-20 19:39 Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120819215734.GA3137@swordfish \
    --to=powertop@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.