- Timestamp:
- Apr 21, 2007 8:47:37 AM (18 years ago)
- Location:
- trunk/src/ash-messup
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ash-messup/Makefile.kmk
r868 r881 102 102 # Use the pregenerated code. 103 103 # 104 kmk_ash_DEPS := Ä104 kmk_ash_DEPS := 105 105 106 106 define def_copy_generated … … 111 111 endef 112 112 113 $(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\ 114 $(eval $(def_copy_generated))) 113 #$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\ 114 #$(eval $(def_copy_generated))) 115 116 kmk_ash_INCS += generated 115 117 116 118 include $(PATH_KBUILD)/footer.kmk -
trunk/src/ash-messup/error.h
r879 r881 86 86 #define INTOFF psh->suppressint++ 87 87 #define INTON { if (--psh->suppressint == 0 && psh->intpending) onint(psh); } 88 #define FORCEINTON { suppressint = 0; if (psh->intpending) onint(psh);}88 #define FORCEINTON {psh->suppressint = 0; if (psh->intpending) onint(psh);} 89 89 #define CLEAR_PENDING_INT psh->intpending = 0 90 90 #define int_pending() psh->intpending -
trunk/src/ash-messup/main.c
r880 r881 78 78 #include "exec.h" 79 79 #include "cd.h" 80 #include "shinstance.h" 80 81 81 82 #define PROFILE 0 … … 86 87 STATIC union node *prevcmd; 87 88 88 STATIC void read_profile( const char *);89 STATIC char *find_dot_file( char *);89 STATIC void read_profile(struct shinstance *, const char *); 90 STATIC char *find_dot_file(struct shinstance *, char *); 90 91 int main(int, char **); 91 92 int shell_main(shinstance *, int, char **); … … 121 122 return 2; 122 123 shthread_set_shell(psh); 123 return shell_main(psh, argc );124 return shell_main(psh, argc, argv); 124 125 } 125 126 … … 144 145 psh->rootshell = 1; 145 146 psh->minusc = NULL; 146 psh->state = 3;147 state = 3; 147 148 break; 148 149 … … 160 161 161 162 if (psh->exception != EXSHELLPROC) { 162 if (state == 0 || iflag == 0 || ! psh->rootshell)163 exitshell(psh, exitstatus);163 if (state == 0 || psh->iflag == 0 || ! psh->rootshell) 164 exitshell(psh, psh->exitstatus); 164 165 } 165 166 reset(psh); … … 170 171 ) { 171 172 out2c(psh, '\n'); 172 flushout(& errout);173 flushout(&psh->errout); 173 174 } 174 175 popstackmark(psh, &smark); … … 232 233 evalstring(psh, psh->minusc, 0); 233 234 234 if (psh->sflag || minusc == NULL) {235 if (psh->sflag || psh->minusc == NULL) { 235 236 state4: /* XXX ??? - why isn't this before the "if" statement */ 236 237 cmdloop(psh, 1); … … 238 239 exitshell(psh, psh->exitstatus); 239 240 /* NOTREACHED */ 241 return 1; 240 242 } 241 243 … … 343 345 setinputfd(psh, fd, 1); 344 346 else 345 error( "Can't open %s", name);347 error(psh, "Can't open %s", name); 346 348 INTON; 347 349 cmdloop(psh, 0); … … 380 382 381 383 /* not found in the PATH */ 382 error( "%s: not found", basename);384 error(psh, "%s: not found", basename); 383 385 /* NOTREACHED */ 386 return NULL; 384 387 } 385 388 … … 412 415 if (argc > 1) 413 416 psh->exitstatus = number(argv[1]); 414 exitshell(psh, exitstatus);417 exitshell(psh, psh->exitstatus); 415 418 /* NOTREACHED */ 419 return 1; 416 420 } 417 421 -
trunk/src/ash-messup/shinstance.h
r880 r881 27 27 #include "shtypes.h" 28 28 #include "shthread.h" 29 30 /** 31 * One file. 32 */ 33 typedef struct shfile 34 { 35 int fd; /**< The shell file descriptor number. */ 36 int flags; /**< Open flags. */ 37 intptr_t native; /**< The native file descriptor number. */ 38 } shfile; 39 40 /** 41 * The file descriptor table for a shell. 42 */ 43 typedef struct shfdtab 44 { 45 shmtx mtx; /**< Mutex protecting any operations on the table and it's handles. */ 46 unsigned size; /**< The size of the table (number of entries). */ 47 shfile *tab; /**< Pointer to the table. */ 48 } shfdtab; 29 #include "shfile.h" 49 30 50 31 /** … … 155 136 156 137 /* builtins.h */ 157 const char *commandname;158 138 159 139 } shinstance; -
trunk/src/ash-messup/shthread.h
r879 r881 27 27 28 28 #include <sys/types.h> 29 struct shmtx; 30 typedef unsigned long shthread; 29 30 typedef struct shmtx 31 { 32 char b[64]; 33 } shmtx; 34 35 typedef uintptr_t shtid; 36 37 void shthread_set_shell(struct shinstance *); 38 struct shinstance *shthread_get_shell(void); -
trunk/src/ash-messup/shtypes.h
r879 r881 32 32 33 33 #ifdef _MSC_VER 34 #include <io.h> /* intptr_t and uintptr_t */ 34 35 typedef signed char int8_t; 35 36 typedef unsigned char uint8_t; … … 40 41 typedef _int64 int64_t; 41 42 typedef unsigned _int64 uint64_t; 42 # if defined(__X86__) || defined(_X86_) || defined(_M_IX86)43 typedef signed long intptr_t;44 typedef unsigned long uintptr_t;45 # else46 typedef int64_t intptr_t;47 typedef uint64_t uintptr_t;48 # endif49 43 50 44 #define INT16_C(c) (c) … … 79 73 #endif 80 74 75 struct shinstance; 76 typedef struct shinstance shinstance; 77 81 78 #endif 82 79 -
trunk/src/ash-messup/trap.h
r879 r881 42 42 void ignoresig(struct shinstance *, int, int); 43 43 void onsig(struct shinstance *, int); 44 void dotrap(struct shinstance * , void);44 void dotrap(struct shinstance *); 45 45 void setinteractive(struct shinstance *, int); 46 46 void exitshell(struct shinstance *, int) __attribute__((__noreturn__)); -
trunk/src/ash-messup/win/mscfakes.h
r785 r881 112 112 #define fchown(fd,uid,gid) 0 113 113 #define fchmod(fd, mode) 0 /** @todo implement fchmod! */ 114 #define geteuid() 0115 114 #define lstat(path, s) stat(path, s) 116 115 #define lchmod(path, mod) chmod(path, mod) -
trunk/src/ash-messup/win/unistd.h
r819 r881 6 6 long _sysconf(int); 7 7 pid_t fork(void); 8 pid_t getpid(void); 8 #define getpid _getpid 9 9 10 uid_t getuid(void); 11 uid_t geteuid(void); 12 gid_t getgid(void); 13 gid_t getegid(void); 14
Note:
See TracChangeset
for help on using the changeset viewer.