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:
16
shf.c
16
shf.c
@@ -518,7 +518,23 @@ shf_getse(char *buf, ssize_t bsize, struct shf *shf)
|
||||
shf->rnleft -= ncopy;
|
||||
buf += ncopy;
|
||||
bsize -= ncopy;
|
||||
#ifdef __OS2__
|
||||
if (end && buf > orig_buf + 1 && buf[-2] == '\r') {
|
||||
buf--;
|
||||
bsize++;
|
||||
buf[-1] = '\n';
|
||||
}
|
||||
#endif
|
||||
} while (!end && bsize);
|
||||
#ifdef __OS2__
|
||||
if (!bsize && buf[-1] == '\r') {
|
||||
int c = shf_getc(shf);
|
||||
if (c == '\n')
|
||||
buf[-1] = '\n';
|
||||
else if (c != -1)
|
||||
shf_ungetc(c, shf);
|
||||
}
|
||||
#endif
|
||||
*buf = '\0';
|
||||
return (buf);
|
||||
}
|
||||
|
Reference in New Issue
Block a user