]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
replace fgetwc with fgetc
authorjNullj <15849761+jNullj@users.noreply.github.com>
Fri, 24 May 2024 19:23:48 +0000 (22:23 +0300)
committerjNullj <15849761+jNullj@users.noreply.github.com>
Fri, 24 May 2024 19:23:48 +0000 (22:23 +0300)
there is no real reason to use fgetwc here as arrow key press is not read as a multi-byte by fgetwc and the logic implemented here also reads the keypress byte by bytes.

term-utils/scriptreplay.c

index 17346daf30bca9f062cf9d45b1280b8a8aa26ab7..0ab64e1762780d38de1d141ea245d8f3c4123a5d 100644 (file)
@@ -31,7 +31,6 @@
 #include <sys/time.h>
 #include <termios.h>
 #include <fcntl.h>
-#include <wchar.h>
 #include <stdbool.h>
 
 #include "c.h"
@@ -323,14 +322,14 @@ main(int argc, char *argv[])
        isterm = setterm(&saved, &saved_flag);
 
        do {
-               switch (fgetwc(stdin)) {
+               switch (fgetc(stdin)) {
                        case ' ':
                                replay_toggle_pause(setup);
                                break;
                        case '\033':
-                               wchar_t first_char = fgetwc(stdin);
+                               int first_char = fgetc(stdin);
                                if (first_char == '[') {
-                                       wchar_t second_char = fgetwc(stdin);
+                                       int second_char = fgetc(stdin);
 
                                        if (second_char == 'A') { /* Up arrow */
                                                divi += 0.1;