96 |
volatile int state; |
volatile int state; |
97 |
struct jmploc jmploc; |
struct jmploc jmploc; |
98 |
struct stackmark smark; |
struct stackmark smark; |
99 |
|
int login; |
100 |
|
|
101 |
#ifdef __GLIBC__ |
#ifdef __GLIBC__ |
102 |
dash_errno = __errno_location(); |
dash_errno = __errno_location(); |
149 |
rootpid = getpid(); |
rootpid = getpid(); |
150 |
init(); |
init(); |
151 |
setstackmark(&smark); |
setstackmark(&smark); |
152 |
procargs(argc, argv); |
login = procargs(argc, argv); |
153 |
if (argv[0] && argv[0][0] == '-') { |
if (login) { |
154 |
state = 1; |
state = 1; |
155 |
read_profile("/etc/profile"); |
read_profile("/etc/profile"); |
156 |
state1: |
state1: |
157 |
state = 2; |
state = 2; |
158 |
read_profile(".profile"); |
read_profile("$HOME/.profile"); |
159 |
} |
} |
160 |
state2: |
state2: |
161 |
state = 3; |
state = 3; |
169 |
read_profile(shinit); |
read_profile(shinit); |
170 |
} |
} |
171 |
} |
} |
172 |
|
popstackmark(&smark); |
173 |
state3: |
state3: |
174 |
state = 4; |
state = 4; |
175 |
if (minusc) |
if (minusc) |
243 |
skip = evalskip; |
skip = evalskip; |
244 |
if (skip) { |
if (skip) { |
245 |
evalskip = 0; |
evalskip = 0; |
246 |
return skip & SKIPEVAL; |
break; |
247 |
} |
} |
248 |
} |
} |
249 |
|
|
259 |
STATIC void |
STATIC void |
260 |
read_profile(const char *name) |
read_profile(const char *name) |
261 |
{ |
{ |
262 |
int skip; |
name = expandstr(name); |
|
|
|
263 |
if (setinputfile(name, INPUT_PUSH_FILE | INPUT_NOFILE_OK) < 0) |
if (setinputfile(name, INPUT_PUSH_FILE | INPUT_NOFILE_OK) < 0) |
264 |
return; |
return; |
265 |
|
|
266 |
skip = cmdloop(0); |
cmdloop(0); |
267 |
popfile(); |
popfile(); |
|
|
|
|
if (skip) |
|
|
exitshell(); |
|
268 |
} |
} |
269 |
|
|
270 |
|
|