~ubuntu-branches/ubuntu/maverick/vlock/maverick

« back to all changes in this revision

Viewing changes to src/prompt.h

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt
  • Date: 2008-06-17 17:13:25 UTC
  • mfrom: (1.1.2 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080617171325-ic8yy6tol0165i96
Tags: 2.2.2-3
* Don't try to chgrp to "vlock" during build time (Closes: #486665)
* Bump standards version (No changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* prompt.h -- header file for the prompt routines for vlock,
 
2
 *             the VT locking program for linux
 
3
 *
 
4
 * This program is copyright (C) 2007 Frank Benkstein, and is free
 
5
 * software which is freely distributable under the terms of the
 
6
 * GNU General Public License version 2, included as the file COPYING in this
 
7
 * distribution.  It is NOT public domain software, and any
 
8
 * redistribution not permitted by the GNU General Public License is
 
9
 * expressly forbidden without prior written permission from
 
10
 * the author.
 
11
 *
 
12
 *
 
13
 * The prompt functions (prompt and prompt_echo_off) were
 
14
 * inspired by/copied from openpam's openpam_ttyconv.c:
 
15
 *
 
16
 * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
 
17
 *
 
18
 * Redistribution and use in source and binary forms, with or without
 
19
 * modification, are permitted provided that the following conditions
 
20
 * are met:
 
21
 * 1. Redistributions of source code must retain the above copyright
 
22
 *    notice, this list of conditions and the following disclaimer.
 
23
 * 2. Redistributions in binary form must reproduce the above copyright
 
24
 *    notice, this list of conditions and the following disclaimer in the
 
25
 *    documentation and/or other materials provided with the distribution.
 
26
 * 3. The name of the author may not be used to endorse or promote
 
27
 *    products derived from this software without specific prior written
 
28
 *    permission.
 
29
 *
 
30
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 
31
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
32
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
33
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 
34
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
35
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 
36
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
37
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
38
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 
39
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
40
 * SUCH DAMAGE.
 
41
 *
 
42
 */
 
43
 
 
44
/* Prompt for a string with the given message.  The string is returned if
 
45
 * successfully read, otherwise NULL.  The caller is responsible for freeing
 
46
 * the resulting buffer.  If no string is read after the given timeout this
 
47
 * prompt() returns NULL.  A timeout of NULL means no timeout, i.e. wait forever.
 
48
 */
 
49
char *prompt(const char *msg, const struct timespec *timeout);
 
50
 
 
51
/* Same as prompt() above, except that characters entered are not echoed. */
 
52
char *prompt_echo_off(const char *msg, const struct timespec *timeout);
 
53
 
 
54
/* Read a single character from the stdin.  If the timeout is reached
 
55
 * 0 is returned. */
 
56
char read_character(struct timespec *timeout);
 
57
 
 
58
/* Wait for any of the characters in the given character set to be read from
 
59
 * stdin.  If charset is NULL wait for any character.  Returns 0 when the
 
60
 * timeout occurs. */
 
61
char wait_for_character(const char *charset, struct timespec *timeout);