/*
* Mini chvt implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
{
int fd, num;
- if ((argc != 2) || (**(argv + 1) == '-')) {
+ if (argc != 2) {
bb_show_usage();
}
fd = get_console_fd();
- num = atoi(argv[1]);
- if (ioctl(fd, VT_ACTIVATE, num)) {
- bb_perror_msg_and_die("VT_ACTIVATE");
- }
- if (ioctl(fd, VT_WAITACTIVE, num)) {
- bb_perror_msg_and_die("VT_WAITACTIVE");
+ num = bb_xgetlarg(argv[1], 10, 0, INT_MAX);
+ if((-1 == ioctl(fd, VT_ACTIVATE, num)) ||
+ (-1 == ioctl(fd, VT_WAITACTIVE, num))) {
+ bb_perror_msg_and_die("ioctl");
}
return EXIT_SUCCESS;
}