From b0b994896c22c0a55ef196bd186b42c7b189fadc Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <calcurse@cryptocrack.de>
Date: Sat, 2 Jul 2011 09:55:01 +0200
Subject: Add press_any_key() function

Displays "Press any key to continue..." in shell terminal mode and waits
for a key stroke.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
---
 src/calcurse.h |  1 +
 src/utils.c    | 12 ++++++++++++
 2 files changed, 13 insertions(+)

(limited to 'src')

diff --git a/src/calcurse.h b/src/calcurse.h
index 5c5c6d6..45c01e5 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -882,6 +882,7 @@ void         psleep (unsigned);
 int          fork_exec (int *, int *, const char *, char *const *);
 int          shell_exec (int *, int *, char *);
 int          child_wait (int *, int *, int);
+void         press_any_key (void);
 
 /* vars.c */
 extern int               col, row;
diff --git a/src/utils.c b/src/utils.c
index 5f19db0..a39b7df 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -813,3 +813,15 @@ child_wait (int *pfdin, int *pfdout, int pid)
   waitpid (pid, &stat, 0);
   return stat;
 }
+
+/* Display "Press any key to continue..." and wait for a key press. */
+void
+press_any_key (void)
+{
+  fflush (stdout);
+  fputs (_("Press any key to continue..."), stdout);
+  fflush (stdout);
+  fgetc (stdin);
+  fflush (stdin);
+  fputs ("\r\n", stdout);
+}
-- 
cgit v1.2.3-70-g09d2