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:
parent
2f8a425756
commit
b0b994896c
@ -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;
|
||||
|
12
src/utils.c
12
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user