Last change
on this file since 3642 was 3232, checked in by Bruno Cornec, 11 years ago |
- Update mindi-busybox to 1.21.1
|
-
Property svn:eol-style
set to
native
|
File size:
922 bytes
|
Line | |
---|
1 | /* vi: set sw=4 ts=4: */
|
---|
2 | /*
|
---|
3 | * Mini fgconsole implementation for busybox
|
---|
4 | *
|
---|
5 | * Copyright (C) 2010 by Grigory Batalov <bga@altlinux.org>
|
---|
6 | *
|
---|
7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
8 | */
|
---|
9 |
|
---|
10 | //usage:#define fgconsole_trivial_usage
|
---|
11 | //usage: ""
|
---|
12 | //usage:#define fgconsole_full_usage "\n\n"
|
---|
13 | //usage: "Get active console"
|
---|
14 |
|
---|
15 | #include "libbb.h"
|
---|
16 |
|
---|
17 | /* From <linux/vt.h> */
|
---|
18 | struct vt_stat {
|
---|
19 | unsigned short v_active; /* active vt */
|
---|
20 | unsigned short v_signal; /* signal to send */
|
---|
21 | unsigned short v_state; /* vt bitmask */
|
---|
22 | };
|
---|
23 | enum { VT_GETSTATE = 0x5603 }; /* get global vt state info */
|
---|
24 |
|
---|
25 | int fgconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
26 | int fgconsole_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
---|
27 | {
|
---|
28 | struct vt_stat vtstat;
|
---|
29 |
|
---|
30 | vtstat.v_active = 0;
|
---|
31 | xioctl(get_console_fd_or_die(), VT_GETSTATE, &vtstat);
|
---|
32 | printf("%d\n", vtstat.v_active);
|
---|
33 |
|
---|
34 | return EXIT_SUCCESS;
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.