1 | /* |
---|
2 | This file is part of MutekP. |
---|
3 | |
---|
4 | MutekP is free software; you can redistribute it and/or modify it |
---|
5 | under the terms of the GNU General Public License as published by |
---|
6 | the Free Software Foundation; either version 2 of the License, or |
---|
7 | (at your option) any later version. |
---|
8 | |
---|
9 | MutekP is distributed in the hope that it will be useful, but |
---|
10 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
12 | General Public License for more details. |
---|
13 | |
---|
14 | You should have received a copy of the GNU General Public License |
---|
15 | along with MutekP; if not, write to the Free Software Foundation, |
---|
16 | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
17 | |
---|
18 | UPMC / LIP6 / SOC (c) 2008 |
---|
19 | Copyright Ghassan Almaless <ghassan.almaless@gmail.com> |
---|
20 | */ |
---|
21 | |
---|
22 | #include <kminiShell.h> |
---|
23 | #include <system.h> |
---|
24 | #include <device.h> |
---|
25 | |
---|
26 | error_t ksh_set_tty_func(void *param) |
---|
27 | { |
---|
28 | ms_args_t *args ; |
---|
29 | sint_t id = -1; |
---|
30 | |
---|
31 | args = (ms_args_t *) param; |
---|
32 | |
---|
33 | if(args->argc == 2) |
---|
34 | id = atoi(args->argv[1]); |
---|
35 | |
---|
36 | if(id == -1) |
---|
37 | { |
---|
38 | ksh_print("%s: Unknown TTY id\n", __FUNCTION__); |
---|
39 | return EINVAL; |
---|
40 | } |
---|
41 | |
---|
42 | if((id >= TTY_DEV_NR) || (ttys_tbl[id] == NULL)) |
---|
43 | { |
---|
44 | ksh_print("%s: Invalid TTY id: %d\n", __FUNCTION__, id); |
---|
45 | return EINVAL; |
---|
46 | } |
---|
47 | |
---|
48 | ksh_tty.id = id; |
---|
49 | return 0; |
---|
50 | } |
---|