summaryrefslogtreecommitdiff
path: root/usr.bin/less/lsystem.c
diff options
context:
space:
mode:
authorAlexandr Shadchin <shadchin@cvs.openbsd.org>2011-09-16 18:12:10 +0000
committerAlexandr Shadchin <shadchin@cvs.openbsd.org>2011-09-16 18:12:10 +0000
commit00ca0ae1e02785b8e3a17a927d3bd3a7d1d4930f (patch)
treeeef6a7bbb153bb50173090055013f1f648d63801 /usr.bin/less/lsystem.c
parent04892254e3fb39e77520f4d6a8d29ae06772a2bb (diff)
Merge in less 444 plus local changes
ok nicm@
Diffstat (limited to 'usr.bin/less/lsystem.c')
-rw-r--r--usr.bin/less/lsystem.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/less/lsystem.c b/usr.bin/less/lsystem.c
index bfb9fe817ff..0d9a980b1a3 100644
--- a/usr.bin/less/lsystem.c
+++ b/usr.bin/less/lsystem.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2002 Mark Nudelman
+ * Copyright (C) 1984-2011 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.
@@ -49,7 +49,7 @@ lsystem(cmd, donemsg)
register char *p;
#endif
IFILE save_ifile;
-#if MSDOS_COMPILER
+#if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C
char cwd[FILENAME_MAX+1];
#endif
@@ -68,6 +68,10 @@ lsystem(cmd, donemsg)
}
#if MSDOS_COMPILER
+#if MSDOS_COMPILER==WIN32C
+ if (*cmd == '\0')
+ cmd = getenv("COMSPEC");
+#else
/*
* Working directory is global on MSDOS.
* The child might change the working directory, so we
@@ -77,6 +81,7 @@ lsystem(cmd, donemsg)
*/
getcwd(cwd, FILENAME_MAX);
#endif
+#endif
/*
* Close the current input file.
@@ -135,8 +140,7 @@ lsystem(cmd, donemsg)
{
size_t len = strlen(shell) + strlen(esccmd) + 5;
p = (char *) ecalloc(len, sizeof(char));
- snprintf(p, len, "%s %s %s", shell,
- shell_coption(), esccmd);
+ SNPRINTF3(p, len, "%s %s %s", shell, shell_coption(), esccmd);
free(esccmd);
}
}
@@ -193,7 +197,7 @@ lsystem(cmd, donemsg)
init();
screen_trashed = 1;
-#if MSDOS_COMPILER
+#if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C
/*
* Restore the previous directory (possibly
* changed by the child program we just ran).