1 | .\" A man page for getkey(1). -*- nroff -*- |
---|
2 | .\" |
---|
3 | .\" Copyright (C) 2006 Red Hat, Inc. All rights reserved. |
---|
4 | .\" |
---|
5 | .\" This copyrighted material is made available to anyone wishing to use, |
---|
6 | .\" modify, copy, or redistribute it subject to the terms and conditions of the |
---|
7 | .\" GNU General Public License v.2. |
---|
8 | .\" |
---|
9 | .\" This program is distributed in the hope that it will be useful, but WITHOUT |
---|
10 | .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
11 | .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
12 | .\" more details. |
---|
13 | .\" |
---|
14 | .\" You should have received a copy of the GNU General Public License along |
---|
15 | .\" with this program; if not, write to the Free Software Foundation, Inc., |
---|
16 | .\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
17 | .\" |
---|
18 | .\" Author: Miloslav Trmac <mitr@redhat.com> |
---|
19 | .TH getkey 1 "Jan 2006" |
---|
20 | |
---|
21 | .SH NAME |
---|
22 | getkey \- wait until a key is pressed |
---|
23 | |
---|
24 | .SH SYNOPSIS |
---|
25 | \fBgetkey\fR [\fIOPTION\fR]... [\fIKEYS\fR] |
---|
26 | |
---|
27 | .SH DESCRIPTION |
---|
28 | .B getkey |
---|
29 | waits until one of |
---|
30 | .I KEYS |
---|
31 | is pressed. |
---|
32 | If |
---|
33 | .I KEYS |
---|
34 | are not specified, any key is accepted. |
---|
35 | .I KEYS |
---|
36 | are matched case-insensitive. |
---|
37 | |
---|
38 | .SH EXIT STATUS |
---|
39 | .B getkey |
---|
40 | exits with status 0 if one of the expected keys is pressed. |
---|
41 | If invalid arguments are specified, |
---|
42 | .B getkey |
---|
43 | exits with status 255. |
---|
44 | If |
---|
45 | .B getkey |
---|
46 | is interrupted or the wait times out, |
---|
47 | .B getkey |
---|
48 | exits with other non-zero status. |
---|
49 | |
---|
50 | .SH OPTIONS |
---|
51 | .TP |
---|
52 | \fB\-c\fR, \fB\-\-wait\fR \fISECONDS\fR |
---|
53 | Wait only for |
---|
54 | .I SECONDS |
---|
55 | seconds. |
---|
56 | The default is 0, which means to wait without a time limit. |
---|
57 | |
---|
58 | .TP |
---|
59 | \fB\-i\fR, \fB\-\-ignore\-control\-chars\fR |
---|
60 | Don't treat Ctrl+C and Ctrl+D specially. |
---|
61 | When this option is not specified, these characters interrupt \fBgetkey\fR. |
---|
62 | |
---|
63 | .TP |
---|
64 | \fB\-m\fR, \fB\-\-message\fR \fIMESSAGE\fR |
---|
65 | Display |
---|
66 | .I MESSAGE |
---|
67 | while waiting. |
---|
68 | The message is used as a format string in |
---|
69 | .BR sprintf (3), |
---|
70 | with a single argument, the number of seconds left. |
---|
71 | Typical usage is therefore |
---|
72 | \fB"Press a key within %d seconds to ..."\fR. |
---|
73 | If |
---|
74 | .I MESSAGE |
---|
75 | contains other format string directives, the behavior is undefined and |
---|
76 | .B getkey |
---|
77 | may crash. |
---|
78 | |
---|
79 | If there is no time limit specified, |
---|
80 | the number of seconds left is reported as 0. |
---|