aboutsummaryrefslogtreecommitdiff
path: root/contrib/less/lsystem.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/less/lsystem.c')
-rw-r--r--contrib/less/lsystem.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/contrib/less/lsystem.c b/contrib/less/lsystem.c
index 5e51c06d0aa5..5c67526e1030 100644
--- a/contrib/less/lsystem.c
+++ b/contrib/less/lsystem.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2020 Mark Nudelman
+ * Copyright (C) 1984-2021 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -97,7 +97,7 @@ lsystem(cmd, donemsg)
* De-initialize the terminal and take out of raw mode.
*/
deinit();
- flush(); /* Make sure the deinit chars get out */
+ flush(); /* Make sure the deinit chars get out */
raw_mode(0);
#if MSDOS_COMPILER==WIN32C
close_getchr();
@@ -116,11 +116,13 @@ lsystem(cmd, donemsg)
*/
inp = dup(0);
close(0);
+#if !MSDOS_COMPILER
#if OS2
/* The __open() system call translates "/dev/tty" to "con". */
- if (__open("/dev/tty", OPEN_READ) < 0)
+ if (__open(tty_device(), OPEN_READ) < 0)
#else
- if (open("/dev/tty", OPEN_READ) < 0)
+ if (open(tty_device(), OPEN_READ) < 0)
+#endif
#endif
dup(inp);
#endif
@@ -169,7 +171,7 @@ lsystem(cmd, donemsg)
* also makes trouble with some DPMI servers).
*/
__djgpp_exception_toggle();
- system(cmd);
+ system(cmd);
__djgpp_exception_toggle();
#else
system(cmd);
@@ -274,14 +276,14 @@ pipe_mark(c, cmd)
tpos = ch_zero();
bpos = position(BOTTOM);
- if (c == '.')
- return (pipe_data(cmd, tpos, bpos));
- else if (mpos <= tpos)
- return (pipe_data(cmd, mpos, bpos));
- else if (bpos == NULL_POSITION)
- return (pipe_data(cmd, tpos, bpos));
- else
- return (pipe_data(cmd, tpos, mpos));
+ if (c == '.')
+ return (pipe_data(cmd, tpos, bpos));
+ else if (mpos <= tpos)
+ return (pipe_data(cmd, mpos, bpos));
+ else if (bpos == NULL_POSITION)
+ return (pipe_data(cmd, tpos, bpos));
+ else
+ return (pipe_data(cmd, tpos, mpos));
}
/*
@@ -346,14 +348,14 @@ pipe_data(cmd, spos, epos)
/*
* Finish up the last line.
*/
- while (c != '\n' && c != EOI )
- {
- c = ch_forw_get();
- if (c == EOI)
- break;
- if (putc(c, f) == EOF)
- break;
- }
+ while (c != '\n' && c != EOI )
+ {
+ c = ch_forw_get();
+ if (c == EOI)
+ break;
+ if (putc(c, f) == EOF)
+ break;
+ }
pclose(f);