Magellan Linux

Diff of /trunk/mkinitrd-magellan/klibc/usr/dash/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1121 by niro, Sat Sep 1 22:45:15 2007 UTC revision 1122 by niro, Wed Aug 18 21:11:40 2010 UTC
# Line 96  main(int argc, char **argv) Line 96  main(int argc, char **argv)
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();
# Line 148  main(int argc, char **argv) Line 149  main(int argc, char **argv)
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;
# Line 168  state2: Line 169  state2:
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)
# Line 241  cmdloop(int top) Line 243  cmdloop(int top)
243   skip = evalskip;   skip = evalskip;
244   if (skip) {   if (skip) {
245   evalskip = 0;   evalskip = 0;
246   return skip & SKIPEVAL;   break;
247   }   }
248   }   }
249    
# Line 257  cmdloop(int top) Line 259  cmdloop(int top)
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    

Legend:
Removed from v.1121  
changed lines
  Added in v.1122