diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/9term/9term.c | 3 | ||||
-rw-r--r-- | src/cmd/9term/rcstart.c | 13 | ||||
-rw-r--r-- | src/cmd/9term/term.h | 1 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c index 0fc979db..0c5609bd 100644 --- a/src/cmd/9term/9term.c +++ b/src/cmd/9term/9term.c @@ -59,6 +59,9 @@ threadmain(int argc, char *argv[]) ARGBEGIN{ default: usage(); + case 'l': + loginshell = TRUE; + break; case 'f': fontname = EARGF(usage()); break; diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c index 5b4f48c0..c137b8f8 100644 --- a/src/cmd/9term/rcstart.c +++ b/src/cmd/9term/rcstart.c @@ -3,6 +3,8 @@ #include <libc.h> #include "term.h" +int loginshell; + static void sys(char *buf, int devnull) { @@ -31,7 +33,7 @@ int rcstart(int argc, char **argv, int *pfd, int *tfd) { int fd[2], i, pid; - char *xargv[3]; + char *cmd, *xargv[3]; char slave[256]; int sfd; @@ -44,6 +46,13 @@ rcstart(int argc, char **argv, int *pfd, int *tfd) argv[1] = "-i"; argv[2] = 0; } + cmd = argv[0]; + if(loginshell){ + argv[0] = malloc(strlen(cmd)+2); + strcpy(argv[0]+1, cmd); + argv[0][0] = '-'; + } + /* * fd0 is slave (tty), fd1 is master (pty) */ @@ -85,7 +94,7 @@ rcstart(int argc, char **argv, int *pfd, int *tfd) signal(SIGINT, SIG_DFL); signal(SIGHUP, SIG_DFL); signal(SIGTERM, SIG_DFL); - execvp(argv[0], argv); + execvp(cmd, argv); fprint(2, "exec %s failed: %r\n", argv[0]); _exit(2); break; diff --git a/src/cmd/9term/term.h b/src/cmd/9term/term.h index 272b4847..c8d9926f 100644 --- a/src/cmd/9term/term.h +++ b/src/cmd/9term/term.h @@ -7,3 +7,4 @@ extern int isecho(int); extern int setecho(int, int); extern int noecho; extern int getintr(int); +extern int loginshell; |