1 /* vlock.h -- main header file for vlock, the VT locking program for linux
3 * This program is copyright (C) 2007 Frank Benkstein, and is free
4 * software which is freely distributable under the terms of the
5 * GNU General Public License version 2, included as the file COPYING in this
6 * distribution. It is NOT public domain software, and any
7 * redistribution not permitted by the GNU General Public License is
8 * expressly forbidden without prior written permission from
13 /* name of the virtual console device */
15 #define CONSOLE "/dev/ttyv0"
17 #define CONSOLE "/dev/tty0"
19 /* template for the device of a given virtual console */
21 #define VTNAME "/dev/ttyv%x"
23 #define VTNAME "/dev/tty%d"
26 /* magic characters to clear the current terminal */
27 #define CLEAR_SCREEN "\033[H\033[J"
29 /* hard coded paths */
30 #define VLOCK_ALL PREFIX "/sbin/vlock-all"
31 #define VLOCK_CURRENT PREFIX "/sbin/vlock-current"
32 #define VLOCK_NEW PREFIX "/sbin/vlock-new"
34 /* Try to authenticate the user. When the user is successfully authenticated
35 * this function returns 1. When the authentication fails for whatever reason
36 * the function returns 0. The timeout is passed to the prompt functions below
39 int auth(const char *user
, const struct timespec
*timeout
);
41 /* Prompt for a string with the given message. The string is returned if
42 * successfully read, otherwise NULL. The caller is responsible for freeing
43 * the resulting buffer. If no string is read after the given timeout this
44 * prompt() returns NULL. A timeout of NULL means no timeout, i.e. wait forever.
46 char *prompt(const char *msg
, const struct timespec
*timeout
);
48 /* Same as prompt() above, except that characters entered are not echoed. */
49 char *prompt_echo_off(const char *msg
, const struct timespec
*timeout
);