]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/misc-progs/iowrap.c
Kernel: Enabled IPV6 at build and disabled at runtime.
[people/pmueller/ipfire-2.x.git] / src / misc-progs / iowrap.c
CommitLineData
cd1a2927
MT
1/* SmoothWall helper program - iowrap.\r
2 *\r
3 * This program is distributed under the terms of the GNU General Public\r
4 * Licence. See the file COPYING for details.\r
5 *\r
6 * (c) Lawrence Manning, 2001\r
7 * Installer helper for redirecting stdout/stderr to a file/terminal.\r
8 * init calls ash through this program to shove it on a tty.\r
9 * \r
10 * $Id: iowrap.c,v 1.2 2001/11/27 15:20:50 riddles Exp $\r
11 * \r
12 */\r
13\r
14#include <stdio.h>\r
15#include <sys/types.h>\r
16#include <sys/stat.h>\r
17#include <fcntl.h>\r
18#include <unistd.h>\r
19\r
20int main(int argc, char *argv[])\r
21{\r
22 /* Prog takes one argument. A device to run on (like a getty) */\r
23 if (argc >= 2)\r
24 {\r
25 int fd;\r
26 \r
27 if ((fd = open(argv[1], O_RDWR)) == -1)\r
28 {\r
29 printf("Couldn't open device\n");\r
30 return 0;\r
31 }\r
32 dup2(fd, 0);\r
33 dup2(fd, 1);\r
34 dup2(fd, 2);\r
35 /* Now its sending/reading on that device. */\r
36 }\r
37 \r
38 if (argc >= 3) \r
39 execvp(argv[2], &argv[2]);\r
40 else\r
41 printf("No command\n");\r
42\r
43 return 0;\r
44}\r