Last change
on this file since 3799 was 3232, checked in by Bruno Cornec, 11 years ago |
- Update mindi-busybox to 1.21.1
|
File size:
1.0 KB
|
Line | |
---|
1 | /* vi: set sw=4 ts=4: */
|
---|
2 | /*
|
---|
3 | * Disallocate virtual terminal(s)
|
---|
4 | *
|
---|
5 | * Copyright (C) 2003 by Tito Ragusa <farmatito@tiscali.it>
|
---|
6 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
---|
7 | *
|
---|
8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
9 | */
|
---|
10 |
|
---|
11 | /* no options, no getopt */
|
---|
12 |
|
---|
13 | //usage:#define deallocvt_trivial_usage
|
---|
14 | //usage: "[N]"
|
---|
15 | //usage:#define deallocvt_full_usage "\n\n"
|
---|
16 | //usage: "Deallocate unused virtual terminal /dev/ttyN"
|
---|
17 |
|
---|
18 | #include "libbb.h"
|
---|
19 |
|
---|
20 | /* From <linux/vt.h> */
|
---|
21 | enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
|
---|
22 |
|
---|
23 | int deallocvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
24 | int deallocvt_main(int argc UNUSED_PARAM, char **argv)
|
---|
25 | {
|
---|
26 | /* num = 0 deallocate all unused consoles */
|
---|
27 | int num = 0;
|
---|
28 |
|
---|
29 | if (argv[1]) {
|
---|
30 | if (argv[2])
|
---|
31 | bb_show_usage();
|
---|
32 | num = xatou_range(argv[1], 1, 63);
|
---|
33 | }
|
---|
34 |
|
---|
35 | /* double cast suppresses "cast to ptr from int of different size" */
|
---|
36 | xioctl(get_console_fd_or_die(), VT_DISALLOCATE, (void *)(ptrdiff_t)num);
|
---|
37 | return EXIT_SUCCESS;
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.