source: MondoRescue/branches/2.2.5/mindi-busybox/console-tools/deallocvt.c@ 1765

Last change on this file since 1765 was 1765, checked in by Bruno Cornec, 17 years ago

Update to busybox 1.7.2

File size: 868 bytes
RevLine 
[821]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 *
[1765]8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
[821]9 */
10
11/* no options, no getopt */
12
[1765]13#include "libbb.h"
[821]14
15/* From <linux/vt.h> */
16enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
17
[1765]18int deallocvt_main(int argc, char **argv);
19int deallocvt_main(int argc, char **argv)
[821]20{
21 /* num = 0 deallocate all unused consoles */
22 int num = 0;
23
24 switch (argc) {
[1765]25 case 2:
26 num = xatou_range(argv[1], 1, 63);
[821]27 /* Fallthrough */
[1765]28 case 1:
29 break;
30 default:
31 bb_show_usage();
[821]32 }
33
[1765]34 /* double cast suppresses "cast to ptr from int of different size */
35 xioctl(get_console_fd(), VT_DISALLOCATE, (void *)(ptrdiff_t)num);
[821]36 return EXIT_SUCCESS;
37}
Note: See TracBrowser for help on using the repository browser.