diff options
author | Marc Balmer <mbalmer@cvs.openbsd.org> | 2007-04-19 05:56:46 +0000 |
---|---|---|
committer | Marc Balmer <mbalmer@cvs.openbsd.org> | 2007-04-19 05:56:46 +0000 |
commit | d8945aab26f8ada9470b103c9eba2cbe149eac58 (patch) | |
tree | cab2b03a9efd2987642e782a480ea520e27efd97 /usr.bin/less/lsystem.c | |
parent | 6b2fa77f962940b54f37a1070618e91aacb608e8 (diff) |
Update to less version 382. This removes some code that is licensed under
a non-BSD license and which was not used on OpenBSD. No functional changes.
From Daniel Dickmann <didickman@gmail.com>, ok itojun, millert, ray, matthieu
Diffstat (limited to 'usr.bin/less/lsystem.c')
-rw-r--r-- | usr.bin/less/lsystem.c | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/usr.bin/less/lsystem.c b/usr.bin/less/lsystem.c index 44ec82c58e7..bfb9fe817ff 100644 --- a/usr.bin/less/lsystem.c +++ b/usr.bin/less/lsystem.c @@ -368,143 +368,3 @@ pipe_data(cmd, spos, epos) } #endif - -#ifdef _OSK -/* - * Popen, and Pclose, for OS-9. - * - * Based on code copyright (c) 1988 by Wolfgang Ocker, Puchheim, - * Ulli Dessauer, Germering and - * Reimer Mellin, Muenchen - * (W-Germany) - * - * These functions can be copied and distributed freely for any - * non-commercial purposes. It can only be incorporated into - * commercial software with the written permission of the authors. - * - * TOP-specific code stripped out and adapted for less by M.Gregorie, 1996 - * - * address: Wolfgang Ocker - * Lochhauserstrasse 35a - * D-8039 Puchheim - * West Germany - * - * e-mail: weo@altger.UUCP, ud@altger.UUCP, ram@altger.UUCP - * pyramid!tmpmbx!recco!weo - * pyramid!tmpmbx!nitmar!ud - * pyramid!tmpmbx!ramsys!ram - * - * Martin Gregorie - * 10 Sadlers Mead - * Harlow - * Essex, CM18 6HG - * U.K. - * - * gregorie@logica.com - */ -#include <strings.h> -#include <errno.h> -extern char **environ; -extern char *getenv(); -extern int os9forkc(); -static int pids[_NFILE] = { 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; -/* - * p o p e n - */ -FILE *popen(name, mode) - char *name; - char *mode; -{ - int fd, fd2, fdsav, pid; - static char *argv[] = {NULL, NULL, NULL }; - static char cmd[200]; - static char cmd_path[200]; - char *cp; - char *shell; - FILE *r; - if ((shell = getenv("SHELL")) == NULL) - return(NULL); - cp = name; - while (*cp == ' ') - cp++; - strlcpy(cmd_path, cp, sizeof(cmd_path)); - if (cp = strchr(cmd_path, ' ')) - *cp++ = '\0'; - strlcpy(cmd, "ex ", sizeof(cmd)); - strlcat(cmd, cmd_path, sizeof(cmd)); - if (cp) - { - strlcat(cmd, " ", sizeof(cmd)); - strlcat(cmd, cp, sizeof(cmd)); - } - argv[0] = shell; - argv[1] = cmd; - /* - mode is "r" (stdout) or "w" (stdin) - */ - switch(mode[0]) - { - case 'w': fd = 0; - break; - case 'r': fd = 1; - break; - default: return(NULL); - } - if (fd == 1) - fflush(stdout); - fdsav = dup(fd); - close(fd); - - creat("/pipe", S_IWRITE+S_IREAD); - pid = os9exec(os9forkc, argv[0], argv, environ, 0, 0, 3); - fd2 = dup(fd); - close(fd); - dup(fdsav); - close(fdsav); - if (pid > 0) - { - pids[fd2] = pid; - r = fdopen(fd2, mode); - } - else - { - close(fd2); - r = NULL; - } - return(r); -} - -/* - * p c l o s e - */ -int pclose(fp) - FILE *fp; -{ - unsigned int status; - int pid; - int fd, - i; - fd = fileno(fp); - if (pids[fd] == 0) - return(-1); - fflush(fp); - fclose(fp); - while ((pid = wait(&status)) != -1) - if (pid == pids[fd]) - break; - else - for (i = 0; i < _NFILE; i++) - if (pids[i] == pid) - { - pids[i] = 0; - break; - } - if (pid == -1) - status = -1; - pids[fd] = 0; - return(status); -} -#endif /* _OSK */ |