Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Looks like "zpty -r" is adding 0x0d characters...



    Hi all :)

    ZSH_VERSION is 4.2.5

    If I get the output of a program using "zpty -r", the newlines
(that should be 0x0a here, in my Linux box) are converted to
0x0d+0x0a. For example:

# This is dump.c, used to produce "./dump"
#include <stdio.h>

int main (void) {

    printf("This is the first line\n");
    printf("This is the second line\n");
    printf("This is the third line\n");
    return 0 ;
}

    $ ./dump | od -tx1 -Ax
000000 54 68 69 73 20 69 73 20 74 68 65 20 66 69 72 73
000010 74 20 6c 69 6e 65 0a 54 68 69 73 20 69 73 20 74
000020 68 65 20 73 65 63 6f 6e 64 20 6c 69 6e 65 0a 54
000030 68 69 73 20 69 73 20 74 68 65 20 74 68 69 72 64
000040 20 6c 69 6e 65 0a
000046

    $ zpty dump ./dump
    $ zpty -r dump line "*third line"
    $ zpty -d dump
    $ print -rn -- "$line" | od -tx1 -Ax
000000 54 68 69 73 20 69 73 20 74 68 65 20 66 69 72 73
000010 74 20 6c 69 6e 65 0d 0a 54 68 69 73 20 69 73 20
000020 74 68 65 20 73 65 63 6f 6e 64 20 6c 69 6e 65 0d
000030 0a 54 68 69 73 20 69 73 20 74 68 65 20 74 68 69
000040 72 64 20 6c 69 6e 65
000047

    As you can see, the second output has all 0x0a characters
converted to 0x0d 0x0a. The missing 0x0a at the end of the second
output is because I ignore it with the pattern I'm using with "zpty
-r".

    Is this an intended behaviour? Can this be happening because
something in my rc files? Am I doing anything wrong? Am I misusing
the zpty module? I just want to know if I must perform a substitution
on the parameter I've read to get rid of the \C-M characters.

    Thanks a lot in advance :) Feel free to ask for more information.

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...



Messages sorted by: Reverse Date, Date, Thread, Author