use new MKSH_WITH_TEXTMODE for several of the #ifdefs

This commit is contained in:
mirabilos 2017-04-02 16:41:01 +02:00
parent 7fb9d283c5
commit a6619d1ef2
5 changed files with 10 additions and 10 deletions

4
eval.c
View File

@ -880,11 +880,11 @@ expand(
--newlines;
} else {
while ((c = shf_getc(x.u.shf)) == 0 ||
#ifdef __OS2__
#ifdef MKSH_WITH_TEXTMODE
c == '\r' ||
#endif
c == '\n') {
#ifdef __OS2__
#ifdef MKSH_WITH_TEXTMODE
if (c == '\r') {
c = shf_getc(x.u.shf);
switch (c) {

2
exec.c
View File

@ -889,7 +889,7 @@ scriptexec(struct op *tp, const char **ap)
unsigned short m;
ssize_t n;
#ifdef __OS2__
#if defined(__OS2__) && defined(MKSH_WITH_TEXTMODE)
setmode(fd, O_TEXT);
#endif
/* read first couple of octets from file */

View File

@ -1969,7 +1969,7 @@ c_read(const char **wp)
#else
#define c_read_opts "Aad:N:n:prsu,"
#endif
#ifdef __OS2__
#if defined(__OS2__) && defined(MKSH_WITH_TEXTMODE)
int saved_mode;
#endif
@ -2100,11 +2100,11 @@ c_read(const char **wp)
}
#endif
#ifdef __OS2__
#if defined(__OS2__) && defined(MKSH_WITH_TEXTMODE)
saved_mode = setmode(fd, O_TEXT);
#endif
if ((bytesread = blocking_read(fd, xp, bytesleft)) == (size_t)-1) {
#ifdef __OS2__
#if defined(__OS2__) && defined(MKSH_WITH_TEXTMODE)
setmode(fd, saved_mode);
#endif
if (errno == EINTR) {
@ -2121,7 +2121,7 @@ c_read(const char **wp)
rv = 2;
goto c_read_out;
}
#ifdef __OS2__
#if defined(__OS2__) && defined(MKSH_WITH_TEXTMODE)
setmode(fd, saved_mode);
#endif

2
sh.h
View File

@ -2463,7 +2463,7 @@ extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
!mksh_cdirsep(mksh_sdirsep_s[2])) ? \
(mksh_sdirsep_s + 1) : strpbrk(mksh_sdirsep_s, "/\\"))); \
})
#define mksh_vdirsep(s) (mksh_sdirsep((s)) != NULL)
#define mksh_vdirsep(s) (mksh_sdirsep((s)) != NULL)
#else
#define mksh_abspath(s) ((s)[0] == '/')
#define mksh_cdirsep(c) ((c) == '/')

4
shf.c
View File

@ -518,7 +518,7 @@ shf_getse(char *buf, ssize_t bsize, struct shf *shf)
shf->rnleft -= ncopy;
buf += ncopy;
bsize -= ncopy;
#ifdef __OS2__
#ifdef MKSH_WITH_TEXTMODE
if (end && buf > orig_buf + 1 && buf[-2] == '\r') {
buf--;
bsize++;
@ -526,7 +526,7 @@ shf_getse(char *buf, ssize_t bsize, struct shf *shf)
}
#endif
} while (!end && bsize);
#ifdef __OS2__
#ifdef MKSH_WITH_TEXTMODE
if (!bsize && buf[-1] == '\r') {
int c = shf_getc(shf);
if (c == '\n')