blob: ea3e7c04857259b06aea2714cb697b6a06c32d4b [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Eric Andersen0460ff21999-10-25 23:32:44 +00002/*
Eric Andersen28672dd2003-10-22 10:30:53 +00003 * Mini chvt implementation for busybox
Eric Andersen0460ff21999-10-25 23:32:44 +00004 *
Eric Andersenc7bda1c2004-03-15 08:29:22 +00005 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
Eric Andersen28672dd2003-10-22 10:30:53 +00006 *
Bernhard Reutner-Fischerb1629b12006-05-19 19:29:19 +00007 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Eric Andersen0460ff21999-10-25 23:32:44 +00008 */
Mark Whitley827e45c2001-03-09 23:59:51 +00009
Denis Vlasenkob6adbf12007-05-26 19:00:18 +000010#include "libbb.h"
Eric Andersenbd22ed82000-07-08 18:55:24 +000011
Denis Vlasenko9b49a5e2007-10-11 10:05:36 +000012int chvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Erik Andersene49d5ec2000-02-08 19:58:47 +000013int chvt_main(int argc, char **argv)
Eric Andersen0460ff21999-10-25 23:32:44 +000014{
Bernhard Reutner-Fischerae4342c2008-05-19 08:18:50 +000015 int num;
Eric Andersen0460ff21999-10-25 23:32:44 +000016
Glenn L McGrath6a786312004-01-14 07:34:37 +000017 if (argc != 2) {
Manuel Novoa III cad53642003-03-19 09:13:01 +000018 bb_show_usage();
Eric Andersen28672dd2003-10-22 10:30:53 +000019 }
20
Denis Vlasenko6ee023c2007-08-23 10:52:52 +000021 num = xatou_range(argv[1], 1, 63);
Denis Vlasenko968dbf92007-10-29 19:52:21 +000022 /* double cast suppresses "cast to ptr from int of different size" */
Bernhard Reutner-Fischerae4342c2008-05-19 08:18:50 +000023 console_make_active(get_console_fd(), num);
Matt Kraai3e856ce2000-12-01 02:55:13 +000024 return EXIT_SUCCESS;
Eric Andersen0460ff21999-10-25 23:32:44 +000025}