aboutsummaryrefslogtreecommitdiffstats
path: root/src/getkey.1
blob: f6c116160e8a6803c6fb15607cd3dc0cc002a742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
.\" A man page for getkey(1). -*- nroff -*-
.\"
.\" Copyright (C) 2006 Red Hat, Inc. All rights reserved.
.\"
.\" This copyrighted material is made available to anyone wishing to use,
.\" modify, copy, or redistribute it subject to the terms and conditions of the
.\" GNU General Public License v.2.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 
.\" more details.
.\"
.\" You should have received a copy of the GNU General Public License along
.\" with this program; if not, write to the Free Software Foundation, Inc.,
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
.\" Author: Miloslav Trmac <mitr@redhat.com>
.TH getkey 1 "Jan 2006"

.SH NAME
getkey \- wait until a key is pressed

.SH SYNOPSIS
\fBgetkey\fR [\fIOPTION\fR]... [\fIKEYS\fR]

.SH DESCRIPTION
.B getkey
waits until one of
.I KEYS
is pressed.
If
.I KEYS
are not specified, any key is accepted.
.I KEYS
are matched case-insensitive.

.SH EXIT STATUS
.B getkey
exits with status 0 if one of the expected keys is pressed.
If invalid arguments are specified,
.B getkey
exits with status 255.
If
.B getkey
is interrupted or the wait times out,
.B getkey
exits with other non-zero status.

.SH OPTIONS
.TP
\fB\-c\fR, \fB\-\-wait\fR \fISECONDS\fR
Wait only for
.I SECONDS
seconds.
The default is 0, which means to wait without a time limit.

.TP
\fB\-i\fR, \fB\-\-ignore\-control\-chars\fR
Don't treat Ctrl+C and Ctrl+D specially.
When this option is not specified, these characters interrupt \fBgetkey\fR.

.TP
\fB\-m\fR, \fB\-\-message\fR \fIMESSAGE\fR
Display
.I MESSAGE
while waiting.
The message is used as a format string in
.BR sprintf (3),
with a single argument, the number of seconds left.
Typical usage is therefore
\fB"Press a key within %d seconds to ..."\fR.
If
.I MESSAGE
contains other format string directives, the behavior is undefined and
.B getkey
may crash.

If there is no time limit specified,
the number of seconds left is reported as 0.