Add --login support. This is the bash way of starting a shell that should
parse the profile files.
This commit is contained in:
parent
8187bb4394
commit
64f70cc755
13
shell/ash.c
13
shell/ash.c
@ -7441,6 +7441,8 @@ static short profile_buf[16384];
|
|||||||
extern int etext();
|
extern int etext();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int isloginsh = 0;
|
||||||
|
|
||||||
static void read_profile (const char *);
|
static void read_profile (const char *);
|
||||||
static void cmdloop (int);
|
static void cmdloop (int);
|
||||||
static void options (int);
|
static void options (int);
|
||||||
@ -7526,7 +7528,9 @@ ash_main(int argc, char **argv)
|
|||||||
init();
|
init();
|
||||||
setstackmark(&smark);
|
setstackmark(&smark);
|
||||||
procargs(argc, argv);
|
procargs(argc, argv);
|
||||||
if (argv[0] && argv[0][0] == '-') {
|
if (argv[0] && argv[0][0] == '-')
|
||||||
|
isloginsh = 1;
|
||||||
|
if (isloginsh) {
|
||||||
state = 1;
|
state = 1;
|
||||||
read_profile("/etc/profile");
|
read_profile("/etc/profile");
|
||||||
state1:
|
state1:
|
||||||
@ -8828,7 +8832,6 @@ nodexstrdup(const char *s)
|
|||||||
static int getopts (char *, char *, char **, int *, int *);
|
static int getopts (char *, char *, char **, int *, int *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process the shell command line arguments.
|
* Process the shell command line arguments.
|
||||||
*/
|
*/
|
||||||
@ -8950,6 +8953,10 @@ options(int cmdline)
|
|||||||
minus_o(*argptr, val);
|
minus_o(*argptr, val);
|
||||||
if (*argptr)
|
if (*argptr)
|
||||||
argptr++;
|
argptr++;
|
||||||
|
} else if (cmdline && (c == '-')) { // long options
|
||||||
|
if ( strcmp ( p, "login" ) == 0 )
|
||||||
|
isloginsh = 1;
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
setoption(c, val);
|
setoption(c, val);
|
||||||
}
|
}
|
||||||
@ -12435,7 +12442,7 @@ findvar(struct var **vpp, const char *name)
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
|
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
|
||||||
* This file contains code for the times builtin.
|
* This file contains code for the times builtin.
|
||||||
* $Id: ash.c,v 1.49 2002/04/26 23:39:48 andersen Exp $
|
* $Id: ash.c,v 1.50 2002/05/14 23:22:06 sandman Exp $
|
||||||
*/
|
*/
|
||||||
static int timescmd (int argc, char **argv)
|
static int timescmd (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user