#include <poll.h>
#include <signal.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <util.h>
-static void sigchld(int);
+static void sigchld(int);
+static void __dead usage(void);
static volatile sig_atomic_t gotsigchld;
int
-main(void)
+main(int argc, char *argv[])
{
char in[BUFSIZ], out[BUFSIZ];
struct pollfd pfd;
size_t nin, nread, nwrite;
int nready, ptyfd;
+ if (argc < 2)
+ usage();
+
nin = 0;
for (;;) {
if (nin == sizeof(in))
if (pid == -1)
err(1, "forkpty");
if (pid == 0) {
- /* Run restricted shell ignoring ~/.profile. */
- execlp("ksh", "ksh", "-r", NULL);
- err(1, "ksh");
+ execvp(argv[1], &argv[1]);
+ err(1, "%s", argv[1]);
}
nread = nwrite = 0;
{
gotsigchld = sig == SIGCHLD;
}
+
+static void __dead
+usage(void)
+{
+ fprintf(stderr, "usage: edit command [args]\n");
+ exit(1);
+}