aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-10-22 10:30:53 +0000
committerEric Andersen <andersen@codepoet.org>2003-10-22 10:30:53 +0000
commit28672dd3b9ff9d27c771f011089e38a2928aded7 (patch)
tree41bb057f64ce5c7fcb32ec0274284bf093759adc
parent9ef6c93090359bc13eab29450b21c573d09ec5bb (diff)
downloadbusybox-w32-28672dd3b9ff9d27c771f011089e38a2928aded7.tar.gz
busybox-w32-28672dd3b9ff9d27c771f011089e38a2928aded7.tar.bz2
busybox-w32-28672dd3b9ff9d27c771f011089e38a2928aded7.zip
Patch from Arthur Othieno for docs/style-guide.txt conformance.
-rw-r--r--console-tools/chvt.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/console-tools/chvt.c b/console-tools/chvt.c
index 11e1078b7..4da0d6399 100644
--- a/console-tools/chvt.c
+++ b/console-tools/chvt.c
@@ -1,11 +1,25 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * chvt.c - aeb - 940227 - Change virtual terminal 3 * Mini chvt implementation for busybox
4 * 4 *
5 * busyboxed by Erik Andersen 5 * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6 */ 20 */
7 21
8/* getopt not needed */ 22/* no options, no getopt */
9 23
10#include <stdio.h> 24#include <stdio.h>
11#include <stdlib.h> 25#include <stdlib.h>
@@ -22,14 +36,18 @@ int chvt_main(int argc, char **argv)
22{ 36{
23 int fd, num; 37 int fd, num;
24 38
25 if ((argc != 2) || (**(argv + 1) == '-')) 39 if ((argc != 2) || (**(argv + 1) == '-')) {
26 bb_show_usage(); 40 bb_show_usage();
41 }
42
27 fd = get_console_fd(); 43 fd = get_console_fd();
28 num = atoi(argv[1]); 44 num = atoi(argv[1]);
29 if (ioctl(fd, VT_ACTIVATE, num)) 45 if (ioctl(fd, VT_ACTIVATE, num)) {
30 bb_perror_msg_and_die("VT_ACTIVATE"); 46 bb_perror_msg_and_die("VT_ACTIVATE");
31 if (ioctl(fd, VT_WAITACTIVE, num)) 47 }
48 if (ioctl(fd, VT_WAITACTIVE, num)) {
32 bb_perror_msg_and_die("VT_WAITACTIVE"); 49 bb_perror_msg_and_die("VT_WAITACTIVE");
50 }
33 return EXIT_SUCCESS; 51 return EXIT_SUCCESS;
34} 52}
35 53