diff options
| author | Robert Griebl <griebl@gmx.de> | 2002-05-14 23:22:06 +0000 |
|---|---|---|
| committer | Robert Griebl <griebl@gmx.de> | 2002-05-14 23:22:06 +0000 |
| commit | 64f70cc755b89c29aa03dc9555a1df37de17bcfd (patch) | |
| tree | 7a634c76d24c21638cdc9757858cd8803b620ad5 /shell | |
| parent | 8187bb4394709fd091d487f562ac6c6b5286abc7 (diff) | |
| download | busybox-w32-64f70cc755b89c29aa03dc9555a1df37de17bcfd.tar.gz busybox-w32-64f70cc755b89c29aa03dc9555a1df37de17bcfd.tar.bz2 busybox-w32-64f70cc755b89c29aa03dc9555a1df37de17bcfd.zip | |
Add --login support. This is the bash way of starting a shell that should
parse the profile files.
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index 99d5e7d74..f3b641d53 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -7441,6 +7441,8 @@ static short profile_buf[16384]; | |||
| 7441 | extern int etext(); | 7441 | extern int etext(); |
| 7442 | #endif | 7442 | #endif |
| 7443 | 7443 | ||
| 7444 | static int isloginsh = 0; | ||
| 7445 | |||
| 7444 | static void read_profile (const char *); | 7446 | static void read_profile (const char *); |
| 7445 | static void cmdloop (int); | 7447 | static void cmdloop (int); |
| 7446 | static void options (int); | 7448 | static void options (int); |
| @@ -7526,7 +7528,9 @@ ash_main(int argc, char **argv) | |||
| 7526 | init(); | 7528 | init(); |
| 7527 | setstackmark(&smark); | 7529 | setstackmark(&smark); |
| 7528 | procargs(argc, argv); | 7530 | procargs(argc, argv); |
| 7529 | if (argv[0] && argv[0][0] == '-') { | 7531 | if (argv[0] && argv[0][0] == '-') |
| 7532 | isloginsh = 1; | ||
| 7533 | if (isloginsh) { | ||
| 7530 | state = 1; | 7534 | state = 1; |
| 7531 | read_profile("/etc/profile"); | 7535 | read_profile("/etc/profile"); |
| 7532 | state1: | 7536 | state1: |
| @@ -8828,7 +8832,6 @@ nodexstrdup(const char *s) | |||
| 8828 | static int getopts (char *, char *, char **, int *, int *); | 8832 | static int getopts (char *, char *, char **, int *, int *); |
| 8829 | #endif | 8833 | #endif |
| 8830 | 8834 | ||
| 8831 | |||
| 8832 | /* | 8835 | /* |
| 8833 | * Process the shell command line arguments. | 8836 | * Process the shell command line arguments. |
| 8834 | */ | 8837 | */ |
| @@ -8950,6 +8953,10 @@ options(int cmdline) | |||
| 8950 | minus_o(*argptr, val); | 8953 | minus_o(*argptr, val); |
| 8951 | if (*argptr) | 8954 | if (*argptr) |
| 8952 | argptr++; | 8955 | argptr++; |
| 8956 | } else if (cmdline && (c == '-')) { // long options | ||
| 8957 | if ( strcmp ( p, "login" ) == 0 ) | ||
| 8958 | isloginsh = 1; | ||
| 8959 | break; | ||
| 8953 | } else { | 8960 | } else { |
| 8954 | setoption(c, val); | 8961 | setoption(c, val); |
| 8955 | } | 8962 | } |
| @@ -12435,7 +12442,7 @@ findvar(struct var **vpp, const char *name) | |||
| 12435 | /* | 12442 | /* |
| 12436 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> | 12443 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> |
| 12437 | * This file contains code for the times builtin. | 12444 | * This file contains code for the times builtin. |
| 12438 | * $Id: ash.c,v 1.49 2002/04/26 23:39:48 andersen Exp $ | 12445 | * $Id: ash.c,v 1.50 2002/05/14 23:22:06 sandman Exp $ |
| 12439 | */ | 12446 | */ |
| 12440 | static int timescmd (int argc, char **argv) | 12447 | static int timescmd (int argc, char **argv) |
| 12441 | { | 12448 | { |
