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>
This commit is contained in:
Lukas Fleischer 2011-07-02 09:55:01 +02:00
parent 2f8a425756
commit b0b994896c
2 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -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);
}