vconsole-setup.c | vconsole-setup.c | |||
---|---|---|---|---|
skipping to change at line 241 | skipping to change at line 241 | |||
struct unimapinit adv = { 0, 0, 0 }; | struct unimapinit adv = { 0, 0, 0 }; | |||
ioctl(vcfd, PIO_UNIMAPCLR, &adv); | ioctl(vcfd, PIO_UNIMAPCLR, &adv); | |||
ioctl(vcfd, PIO_UNIMAP, &unimapd); | ioctl(vcfd, PIO_UNIMAP, &unimapd); | |||
} | } | |||
} | } | |||
} | } | |||
int main(int argc, char **argv) { | int main(int argc, char **argv) { | |||
const char *vc; | const char *vc; | |||
char *vc_keymap = NULL; | _cleanup_free_ char | |||
char *vc_keymap_toggle = NULL; | *vc_keymap = NULL, *vc_keymap_toggle = NULL, | |||
char *vc_font = NULL; | *vc_font = NULL, *vc_font_map = NULL, *vc_font_unimap = NUL | |||
char *vc_font_map = NULL; | L; | |||
char *vc_font_unimap = NULL; | _cleanup_close_ int fd = -1; | |||
int fd = -1; | ||||
bool utf8; | bool utf8; | |||
pid_t font_pid = 0, keymap_pid = 0; | pid_t font_pid = 0, keymap_pid = 0; | |||
bool font_copy = false; | bool font_copy = false; | |||
int r = EXIT_FAILURE; | int r = EXIT_FAILURE; | |||
log_set_target(LOG_TARGET_AUTO); | log_set_target(LOG_TARGET_AUTO); | |||
log_parse_environment(); | log_parse_environment(); | |||
log_open(); | log_open(); | |||
umask(0022); | umask(0022); | |||
skipping to change at line 268 | skipping to change at line 266 | |||
if (argv[1]) | if (argv[1]) | |||
vc = argv[1]; | vc = argv[1]; | |||
else { | else { | |||
vc = "/dev/tty0"; | vc = "/dev/tty0"; | |||
font_copy = true; | font_copy = true; | |||
} | } | |||
fd = open_terminal(vc, O_RDWR|O_CLOEXEC); | fd = open_terminal(vc, O_RDWR|O_CLOEXEC); | |||
if (fd < 0) { | if (fd < 0) { | |||
log_error("Failed to open %s: %m", vc); | log_error("Failed to open %s: %m", vc); | |||
goto finish; | return EXIT_FAILURE; | |||
} | } | |||
if (!is_vconsole(fd)) { | if (!is_vconsole(fd)) { | |||
log_error("Device %s is not a virtual console.", vc); | log_error("Device %s is not a virtual console.", vc); | |||
goto finish; | return EXIT_FAILURE; | |||
} | } | |||
utf8 = is_locale_utf8(); | utf8 = is_locale_utf8(); | |||
r = parse_env_file("/etc/vconsole.conf", NEWLINE, | r = parse_env_file("/etc/vconsole.conf", NEWLINE, | |||
"KEYMAP", &vc_keymap, | "KEYMAP", &vc_keymap, | |||
"KEYMAP_TOGGLE", &vc_keymap_toggle, | "KEYMAP_TOGGLE", &vc_keymap_toggle, | |||
"FONT", &vc_font, | "FONT", &vc_font, | |||
"FONT_MAP", &vc_font_map, | "FONT_MAP", &vc_font_map, | |||
"FONT_UNIMAP", &vc_font_unimap, | "FONT_UNIMAP", &vc_font_unimap, | |||
skipping to change at line 308 | skipping to change at line 306 | |||
if (r < 0 && r != -ENOENT) | if (r < 0 && r != -ENOENT) | |||
log_warning("Failed to read /proc/cmdline: %s", str error(-r)); | log_warning("Failed to read /proc/cmdline: %s", str error(-r)); | |||
} | } | |||
if (utf8) | if (utf8) | |||
enable_utf8(fd); | enable_utf8(fd); | |||
else | else | |||
disable_utf8(fd); | disable_utf8(fd); | |||
r = EXIT_FAILURE; | r = font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid); | |||
if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) | if (r < 0) { | |||
>= 0 && | log_error("Failed to start " KBD_SETFONT ": %s", strerror(- | |||
font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) | r)); | |||
>= 0) | return EXIT_FAILURE; | |||
r = EXIT_SUCCESS; | } | |||
finish: | ||||
if (keymap_pid > 0) | ||||
wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid); | ||||
if (font_pid > 0) { | if (font_pid > 0) | |||
wait_for_terminate_and_warn(KBD_SETFONT, font_pid); | wait_for_terminate_and_warn(KBD_SETFONT, font_pid); | |||
if (font_copy) | ||||
font_copy_to_all_vcs(fd); | r = keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) | |||
; | ||||
if (r < 0) { | ||||
log_error("Failed to start " KBD_LOADKEYS ": %s", strerror( | ||||
-r)); | ||||
return EXIT_FAILURE; | ||||
} | } | |||
free(vc_keymap); | if (keymap_pid > 0) | |||
free(vc_font); | wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid); | |||
free(vc_font_map); | ||||
free(vc_font_unimap); | ||||
safe_close(fd); | /* Only copy the font when we started setfont successfully */ | |||
if (font_copy && font_pid > 0) | ||||
font_copy_to_all_vcs(fd); | ||||
return r; | return EXIT_SUCCESS; | |||
} | } | |||
End of changes. 9 change blocks. | ||||
27 lines changed or deleted | 27 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |