Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/console-tools/setconsole.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/console-tools/setconsole.c
r821 r1770 8 8 */ 9 9 10 #include <sys/ioctl.h> 11 #include <sys/stat.h> 12 #include <sys/types.h> 13 #include <fcntl.h> 14 #include <stdio.h> 15 #include <getopt.h> /* struct option */ 16 17 #include "busybox.h" 10 #include <getopt.h> 11 #include "libbb.h" 18 12 19 13 #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS 20 static const struct option setconsole_long_options[] = { 21 { "reset", 0, NULL, 'r' }, 22 { 0, 0, 0, 0 } 23 }; 14 static const char setconsole_longopts[] ALIGN1 = 15 "reset\0" No_argument "r" 16 ; 24 17 #endif 25 18 26 19 #define OPT_SETCONS_RESET 1 27 20 21 int setconsole_main(int argc, char **argv); 28 22 int setconsole_main(int argc, char **argv) 29 23 { … … 32 26 33 27 #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS 34 bb_applet_long_options = setconsole_long_options;28 applet_long_options = setconsole_longopts; 35 29 #endif 36 flags = bb_getopt_ulflags(argc,argv, "r");30 flags = getopt32(argv, "r"); 37 31 38 32 if (argc - optind > 1) … … 45 39 } else { 46 40 if (flags & OPT_SETCONS_RESET) 47 device = CONSOLE_DEV;41 device = DEV_CONSOLE; 48 42 } 49 43 50 if (-1 == ioctl(bb_xopen(device, O_RDONLY), TIOCCONS)) { 51 bb_perror_msg_and_die("TIOCCONS"); 52 } 44 xioctl(xopen(device, O_RDONLY), TIOCCONS, NULL); 53 45 return EXIT_SUCCESS; 54 46 }
Note:
See TracChangeset
for help on using the changeset viewer.