File: vesablank.c

package info (click to toggle)
vlock 2.2.2-5
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 488 kB
  • ctags: 324
  • sloc: ansic: 2,950; sh: 873; makefile: 236
file content (35 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download | duplicates (7)
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
/* vesablank.c -- a console blanking plugin for vlock,
 *                the VT locking program for linux
 *
 * This program is copyright (C) 2007 Frank Benkstein, and is free
 * software which is freely distributable under the terms of the
 * GNU General Public License version 2, included as the file COPYING in this
 * distribution.  It is NOT public domain software, and any
 * redistribution not permitted by the GNU General Public License is
 * expressly forbidden without prior written permission from
 * the author.
 *
 */

#include <stdio.h>
#include <unistd.h>

#include <sys/ioctl.h>
#include <linux/tiocl.h>

#include "vlock_plugin.h"

const char *depends[] = { "all", NULL };
const char *conflicts[] = { "blank", NULL };

bool vlock_save(void __attribute__ ((__unused__)) ** ctx)
{
  char arg[] = { TIOCL_SETVESABLANK, 2 };
  return ioctl(STDIN_FILENO, TIOCLINUX, arg) == 0;
}

bool vlock_save_abort(void __attribute__ ((__unused__)) ** ctx)
{
  char arg[] = { TIOCL_SETVESABLANK, 0 };
  return ioctl(STDIN_FILENO, TIOCLINUX, arg) == 0;
}