X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=console-tools%2Fdeallocvt.c;h=15cd0c9b9a76b3087f795887f0f869485b2a6b6e;hb=6aabfd5e30087bb0ffdb6404aa6d650014de2dc0;hp=a5b5a03f01d1e8185bd5a00dc8c202e18f513401;hpb=a1b35c4512dfb37227bfcb244d717119d39899ae;p=oweals%2Fbusybox.git diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index a5b5a03f0..15cd0c9b9 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c @@ -3,43 +3,41 @@ * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s) * Renamed deallocvt. */ -#include "internal.h" #include #include #include #include #include +#include "busybox.h" /* From */ -#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ +static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */ int deallocvt_main(int argc, char *argv[]) { int fd, num, i; - if ((argc > 2) || ((argv == 2) && (**(argv + 1) == '-'))) - usage(deallocvt_usage); + //if ((argc > 2) || ((argv == 2) && (**(argv + 1) == '-'))) + if (argc > 2) + show_usage(); fd = get_console_fd("/dev/console"); if (argc == 1) { /* deallocate all unused consoles */ - if (ioctl(fd, VT_DISALLOCATE, 0)) { - perror("VT_DISALLOCATE"); - exit( FALSE); - } - } else + if (ioctl(fd, VT_DISALLOCATE, 0)) + perror_msg_and_die("VT_DISALLOCATE"); + } else { for (i = 1; i < argc; i++) { num = atoi(argv[i]); if (num == 0) - errorMsg("0: illegal VT number\n"); + error_msg("0: illegal VT number"); else if (num == 1) - errorMsg("VT 1 cannot be deallocated\n"); - else if (ioctl(fd, VT_DISALLOCATE, num)) { - perror("VT_DISALLOCATE"); - errorMsg("could not deallocate console %d\n", num); - exit( FALSE); - } + error_msg("VT 1 cannot be deallocated"); + else if (ioctl(fd, VT_DISALLOCATE, num)) + perror_msg_and_die("VT_DISALLOCATE"); } - return( TRUE); + } + + return EXIT_SUCCESS; }