different login shell
This commit is contained in:
parent
8a6837e8c0
commit
5bd21066c5
3 changed files with 15 additions and 2 deletions
|
|
@ -59,6 +59,9 @@ threadmain(int argc, char *argv[])
|
||||||
ARGBEGIN{
|
ARGBEGIN{
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
case 'l':
|
||||||
|
loginshell = TRUE;
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
fontname = EARGF(usage());
|
fontname = EARGF(usage());
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
|
||||||
|
int loginshell;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sys(char *buf, int devnull)
|
sys(char *buf, int devnull)
|
||||||
{
|
{
|
||||||
|
|
@ -31,7 +33,7 @@ int
|
||||||
rcstart(int argc, char **argv, int *pfd, int *tfd)
|
rcstart(int argc, char **argv, int *pfd, int *tfd)
|
||||||
{
|
{
|
||||||
int fd[2], i, pid;
|
int fd[2], i, pid;
|
||||||
char *xargv[3];
|
char *cmd, *xargv[3];
|
||||||
char slave[256];
|
char slave[256];
|
||||||
int sfd;
|
int sfd;
|
||||||
|
|
||||||
|
|
@ -44,6 +46,13 @@ rcstart(int argc, char **argv, int *pfd, int *tfd)
|
||||||
argv[1] = "-i";
|
argv[1] = "-i";
|
||||||
argv[2] = 0;
|
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)
|
* 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(SIGINT, SIG_DFL);
|
||||||
signal(SIGHUP, SIG_DFL);
|
signal(SIGHUP, SIG_DFL);
|
||||||
signal(SIGTERM, SIG_DFL);
|
signal(SIGTERM, SIG_DFL);
|
||||||
execvp(argv[0], argv);
|
execvp(cmd, argv);
|
||||||
fprint(2, "exec %s failed: %r\n", argv[0]);
|
fprint(2, "exec %s failed: %r\n", argv[0]);
|
||||||
_exit(2);
|
_exit(2);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,4 @@ extern int isecho(int);
|
||||||
extern int setecho(int, int);
|
extern int setecho(int, int);
|
||||||
extern int noecho;
|
extern int noecho;
|
||||||
extern int getintr(int);
|
extern int getintr(int);
|
||||||
|
extern int loginshell;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue