Read in text mode in a needed place only

Converting CR+LF to LF in blocking_read() which is a underlying read
function, may affect to the functions which do not perform line-based
operation.

    modified:   funcs.c
    modified:   main.c
    modified:   misc.c
    modified:   os2.c
    modified:   shf.c
This commit is contained in:
KO Myung-Hun
2016-12-17 17:04:37 +09:00
parent 18ff277047
commit 20dbf6b45b
5 changed files with 31 additions and 11 deletions

12
funcs.c
View File

@ -1975,6 +1975,9 @@ c_read(const char **wp)
#define c_read_opts "Aad:N:n:prst:u,"
#else
#define c_read_opts "Aad:N:n:prsu,"
#endif
#ifdef __OS2__
int saved_mode;
#endif
while ((c = ksh_getopt(wp, &builtin_opt, c_read_opts)) != -1)
@ -2104,7 +2107,13 @@ c_read(const char **wp)
}
#endif
#ifdef __OS2__
saved_mode = setmode(fd, O_TEXT);
#endif
if ((bytesread = blocking_read(fd, xp, bytesleft)) == (size_t)-1) {
#ifdef __OS2__
setmode(fd, saved_mode);
#endif
if (errno == EINTR) {
/* check whether the signal would normally kill */
if (!fatal_trap_check()) {
@ -2119,6 +2128,9 @@ c_read(const char **wp)
rv = 2;
goto c_read_out;
}
#ifdef __OS2__
setmode(fd, saved_mode);
#endif
switch (readmode) {
case READALL: