]> git.ipfire.org Git - pakfire.git/commitdiff
pty: Remove code that maps CRNL to NL
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 24 Mar 2025 16:12:11 +0000 (16:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 24 Mar 2025 16:12:11 +0000 (16:12 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/pty.c

index 59c0f6620dcc27e7b1fa94d198645e1ad9927b83..b830f84b2a0f3347ffdfaacce11141cfd677b315 100644 (file)
@@ -56,7 +56,6 @@ struct pakfire_pty_stdio {
                PAKFIRE_PTY_READY_TO_READ  = (1 << 0),
                PAKFIRE_PTY_READY_TO_WRITE = (1 << 1),
                PAKFIRE_PTY_HANGUP         = (1 << 2),
-               PAKFIRE_PTY_MAP_CRNL       = (1 << 3),
        } io;
 
        // Event Source
@@ -300,33 +299,6 @@ static int pakfire_pty_done(struct pakfire_pty* pty, int code) {
        return 0;
 }
 
-/*
-       Maps any CRNL in the buffer to just NL
-*/
-static void pakfire_pty_map_crnl(struct pakfire_pty_stdio* stdio) {
-       char* cr = NULL;
-
-       // Walk through the entire buffer...
-       for (char* p = stdio->buffer; p <= stdio->buffer + stdio->buffered; p++) {
-               switch (*p) {
-                       // Remember the position of the last CR
-                       case '\r':
-                               cr = p;
-                               continue;
-
-                       // Check if have have found a NL
-                       case '\n':
-                               // CR is only set if the previous character was CR
-                               if (cr)
-                                       memmove(cr, p, stdio->buffered-- - (cr - stdio->buffer));
-                               break;
-               }
-
-               // Reset
-               cr = NULL;
-       }
-}
-
 /*
        Reads as much data as possible into the buffer
 */
@@ -352,10 +324,6 @@ static int pakfire_pty_fill_buffer(struct pakfire_pty* pty, int fd, struct pakfi
 static int pakfire_pty_drain_buffer(struct pakfire_pty* pty, int fd, struct pakfire_pty_stdio* stdio) {
        ssize_t bytes_written = 0;
 
-       // Map any CRNL to just NL
-       if (stdio->io & PAKFIRE_PTY_MAP_CRNL)
-               pakfire_pty_map_crnl(stdio);
-
        // Write to the file descriptor
        bytes_written = write(fd, stdio->buffer, stdio->buffered);