Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (17 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/console-tools/deallocvt.c

    r821 r1765  
    66 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
    77 *
    8  * This program is free software; you can redistribute it and/or modify
    9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  *
    18  * You should have received a copy of the GNU General Public License
    19  * along with this program; if not, write to the Free Software
    20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
    219 */
    2210
    2311/* no options, no getopt */
    2412
    25 #include <stdlib.h>
    26 #include <stdio.h>
    27 #include <fcntl.h>
    28 #include <sys/types.h>
    29 #include <sys/ioctl.h>
    30 #include "busybox.h"
     13#include "libbb.h"
    3114
    3215/* From <linux/vt.h> */
    3316enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
    3417
    35 int deallocvt_main(int argc, char *argv[])
     18int deallocvt_main(int argc, char **argv);
     19int deallocvt_main(int argc, char **argv)
    3620{
    3721    /* num = 0 deallocate all unused consoles */
     
    3923
    4024    switch (argc) {
    41         case 2:
    42             if ((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0) {
    43                 bb_error_msg_and_die("0: illegal VT number");
    44             }
     25    case 2:
     26        num = xatou_range(argv[1], 1, 63);
    4527        /* Fallthrough */
    46         case 1:
    47             break;
    48         default:
    49             bb_show_usage();
     28    case 1:
     29        break;
     30    default:
     31        bb_show_usage();
    5032    }
    5133
    52     if (-1 == ioctl(get_console_fd(), VT_DISALLOCATE, num)) {
    53         bb_perror_msg_and_die("VT_DISALLOCATE");
    54     }
     34    /* double cast suppresses "cast to ptr from int of different size */
     35    xioctl(get_console_fd(), VT_DISALLOCATE, (void *)(ptrdiff_t)num);
    5536    return EXIT_SUCCESS;
    5637}
Note: See TracChangeset for help on using the changeset viewer.