[ldapvi] [PATCH v2 3/2] Handle pager commands with arguments

Anders Kaseorg andersk at MIT.EDU
Wed Dec 15 00:26:48 CET 2010


This handles PAGER in the same way the last commit handled EDITOR.

Signed-off-by: Anders Kaseorg <andersk at mit.edu>
---
 ldapvi/misc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ldapvi/misc.c b/ldapvi/misc.c
index 2e3a1f5..307e1ed 100644
--- a/ldapvi/misc.c
+++ b/ldapvi/misc.c
@@ -215,7 +215,8 @@ view(char *pathname)
 	case -1:
 		syserr();
 	case 0:
-		execlp(pg, pg, pathname, (char *) NULL);
+		execl("/bin/sh", "sh", "-c", "exec $0 \"$@\"", pg,
+		      pathname, (char *) NULL);
 		syserr();
 	}
 
@@ -247,7 +248,7 @@ pipeview(int *fd)
 		close(fds[1]);
 		dup2(fds[0], 0);
 		close(fds[0]);
-		execlp(pg, pg, (char *) NULL);
+		execl("/bin/sh", "sh", "-c", "exec $0", pg, (char *) NULL);
 		syserr();
 	}
 
-- 
1.7.3.3




More information about the ldapvi mailing list