[hackers] [wmii] [wikeyname] Prompt the user for a key if isatty(1). || Kris Maglione

From: <hg_AT_suckless.org>
Date: Wed, 16 Jun 2010 22:35:38 +0000 (UTC)

changeset: 2730:43d000b40964
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Wed Jun 16 18:35:32 2010 -0400
files: cmd/x11/wikeyname.c
description:
[wikeyname] Prompt the user for a key if isatty(1).

diff -r 5c26a61a3296 -r 43d000b40964 cmd/x11/wikeyname.c
--- a/cmd/x11/wikeyname.c Wed Jun 16 18:32:09 2010 -0400
+++ b/cmd/x11/wikeyname.c Wed Jun 16 18:35:32 2010 -0400
@@ -5,6 +5,7 @@
 #include <stuff/x.h>
 #include <fmt.h>
 #include <locale.h>
+#include <unistd.h>
 
 static const char version[] = "wikeyname-"VERSION", "COPYRIGHT"\n";
 
@@ -38,8 +39,10 @@
         if(!grabkeyboard(&scr.root))
                 fatal("can't grab keyboard\n");
 
+ if(isatty(1))
+ lprint(2, "Please press a key...\n");
         event_loop();
- print("%s\n", keyname);
+ lprint(1, "%s\n", keyname);
 
         XCloseDisplay(display);
         return 0;
Received on Wed Jun 16 2010 - 22:35:38 UTC

This archive was generated by hypermail 2.2.0 : Wed Jun 16 2010 - 22:36:04 UTC