- Timestamp:
- Apr 21, 2007 8:55:18 PM (18 years ago)
- Location:
- trunk/src/ash-messup
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ash-messup/cd.c
r843 r883 68 68 #include "show.h" 69 69 #include "cd.h" 70 71 STATIC int docd(char *, int); 72 STATIC char *getcomponent(void); 73 STATIC void updatepwd(char *); 74 STATIC void find_curdir(int noerror); 75 76 char *curdir = NULL; /* current working directory */ 77 char *prevdir; /* previous working directory */ 78 STATIC char *cdcomppath; 70 #include "shinstance.h" 71 72 STATIC int docd(shinstance *psh, char *, int); 73 STATIC char *getcomponent(shinstance *psh); 74 STATIC void updatepwd(shinstance *psh, char *); 75 STATIC void find_curdir(shinstance *psh, int noerror); 76 77 /*char *curdir = NULL;*/ /* current working directory */ 78 /*char *prevdir;*/ /* previous working directory */ 79 /*STATIC char *cdcomppath;*/ 79 80 80 81 int 81 cdcmd( int argc, char **argv)82 cdcmd(shinstance *psh, int argc, char **argv) 82 83 { 83 84 const char *dest; … … 85 86 char *p, *d; 86 87 struct stat statb; 87 int print = cdprint; /* set -cdprint to enable */88 89 nextopt( nullstr);88 int print = psh->cdprint; /* set -cdprint to enable */ 89 90 nextopt(psh, nullstr); 90 91 91 92 /* … … 93 94 * it on entry to the shell, but we want 'cd fred; cd -' to work. 94 95 */ 95 getpwd( 1);96 dest = * argptr;96 getpwd(psh, 1); 97 dest = *psh->argptr; 97 98 if (dest == NULL) { 98 dest = bltinlookup( "HOME", 1);99 dest = bltinlookup(psh, "HOME", 1); 99 100 if (dest == NULL) 100 error( "HOME not set");101 error(psh, "HOME not set"); 101 102 } else { 102 if ( argptr[1]) {103 if (psh->argptr[1]) { 103 104 /* Do 'ksh' style substitution */ 104 if (! curdir)105 error( "PWD not set");106 p = strstr( curdir, dest);105 if (!psh->curdir) 106 error(psh, "PWD not set"); 107 p = strstr(psh->curdir, dest); 107 108 if (!p) 108 error( "bad substitution");109 d = stalloc( strlen(curdir) + strlen(argptr[1]) + 1);110 memcpy(d, curdir, p -curdir);111 strcpy(d + (p - curdir),argptr[1]);109 error(psh, "bad substitution"); 110 d = stalloc(psh, strlen(psh->curdir) + strlen(psh->argptr[1]) + 1); 111 memcpy(d, psh->curdir, p - psh->curdir); 112 strcpy(d + (p - psh->curdir), psh->argptr[1]); 112 113 strcat(d, p + strlen(dest)); 113 114 dest = d; … … 117 118 118 119 if (dest[0] == '-' && dest[1] == '\0') { 119 dest = p revdir ? prevdir :curdir;120 dest = psh->prevdir ? psh->prevdir : psh->curdir; 120 121 print = 1; 121 122 } 122 123 if (*dest == '\0') 123 124 dest = "."; 124 if (IS_ROOT(dest) || (path = bltinlookup( "CDPATH", 1)) == NULL)125 if (IS_ROOT(dest) || (path = bltinlookup(psh, "CDPATH", 1)) == NULL) 125 126 path = nullstr; 126 while ((p = padvance( &path, dest)) != NULL) {127 if (s tat(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) {127 while ((p = padvance(psh, &path, dest)) != NULL) { 128 if (shfile_stat(&psh->fdtab, p, &statb) >= 0 && S_ISDIR(statb.st_mode)) { 128 129 if (!print) { 129 130 /* … … 134 135 print = strcmp(p, dest); 135 136 } 136 if (docd(p , print) >= 0)137 if (docd(psh, p, print) >= 0) 137 138 return 0; 138 139 139 140 } 140 141 } 141 error( "can't cd to %s", dest);142 error(psh, "can't cd to %s", dest); 142 143 /* NOTREACHED */ 144 return 1; 143 145 } 144 146 … … 150 152 151 153 STATIC int 152 docd( char *dest, int print)154 docd(shinstance *psh, char *dest, int print) 153 155 { 154 156 char *p; … … 167 169 */ 168 170 badstat = 0; 169 cdcomppath = stalloc(strlen(dest) + 1);170 scopy(dest, cdcomppath);171 psh->cdcomppath = stalloc(psh, strlen(dest) + 1); 172 scopy(dest, psh->cdcomppath); 171 173 STARTSTACKSTR(p); 172 174 if (IS_ROOT(dest)) { 173 175 STPUTC('/', p); 174 cdcomppath++;176 psh->cdcomppath++; 175 177 } 176 178 first = 1; 177 while ((q = getcomponent( )) != NULL) {179 while ((q = getcomponent(psh)) != NULL) { 178 180 if (q[0] == '\0' || (q[0] == '.' && q[1] == '\0')) 179 181 continue; … … 187 189 continue; 188 190 STACKSTRNUL(p); 189 if (( lstat(stackblock(), &statb) < 0)191 if ((shfile_lstat(&psh->fdtab, stackblock(), &statb) < 0) 190 192 || (S_ISLNK(statb.st_mode))) { 191 193 /* print = 1; */ … … 196 198 197 199 INTOFF; 198 if ( chdir(dest) < 0) {200 if (shfile_chdir(&psh->fdtab, dest) < 0) { 199 201 INTON; 200 202 return -1; 201 203 } 202 updatepwd( badstat ? NULL : dest);204 updatepwd(psh, badstat ? NULL : dest); 203 205 INTON; 204 if (print && iflag &&curdir)205 out1fmt( "%s\n",curdir);206 if (print && psh->iflag && psh->curdir) 207 out1fmt(psh, "%s\n", psh->curdir); 206 208 return 0; 207 209 } … … 209 211 210 212 /* 211 * Get the next component of the path name pointed to by cdcomppath.212 * This routine overwrites the string pointed to by cdcomppath.213 * Get the next component of the path name pointed to by psh->cdcomppath. 214 * This routine overwrites the string pointed to by psh->cdcomppath. 213 215 */ 214 216 215 217 STATIC char * 216 getcomponent( )218 getcomponent(shinstance *psh) 217 219 { 218 220 char *p; 219 221 char *start; 220 222 221 if ((p = cdcomppath) == NULL)223 if ((p = psh->cdcomppath) == NULL) 222 224 return NULL; 223 start = cdcomppath;225 start = psh->cdcomppath; 224 226 while (*p != '/' && *p != '\0') 225 227 p++; 226 228 if (*p == '\0') { 227 cdcomppath = NULL;229 psh->cdcomppath = NULL; 228 230 } else { 229 231 *p++ = '\0'; 230 cdcomppath = p;232 psh->cdcomppath = p; 231 233 } 232 234 return start; … … 242 244 243 245 STATIC void 244 updatepwd( char *dir)246 updatepwd(shinstance *psh, char *dir) 245 247 { 246 248 char *new; 247 249 char *p; 248 250 249 hashcd( ); /* update command hash table */251 hashcd(psh); /* update command hash table */ 250 252 251 253 /* … … 254 256 * we couldn't stat(). 255 257 */ 256 if (dir == NULL || curdir == NULL) {257 if (p revdir)258 ckfree(p revdir);258 if (dir == NULL || psh->curdir == NULL) { 259 if (psh->prevdir) 260 ckfree(psh->prevdir); 259 261 INTOFF; 260 p revdir =curdir;261 curdir = NULL;262 getpwd( 1);262 psh->prevdir = psh->curdir; 263 psh->curdir = NULL; 264 getpwd(psh, 1); 263 265 INTON; 264 if ( curdir)265 setvar( "PWD",curdir, VEXPORT);266 if (psh->curdir) 267 setvar(psh, "PWD", psh->curdir, VEXPORT); 266 268 else 267 unsetvar( "PWD", 0);269 unsetvar(psh, "PWD", 0); 268 270 return; 269 271 } 270 cdcomppath = stalloc(strlen(dir) + 1);271 scopy(dir, cdcomppath);272 psh->cdcomppath = stalloc(psh, strlen(dir) + 1); 273 scopy(dir, psh->cdcomppath); 272 274 STARTSTACKSTR(new); 273 275 if (!IS_ROOT(dir)) { 274 p = curdir;276 p = psh->curdir; 275 277 while (*p) 276 278 STPUTC(*p++, new); … … 278 280 STUNPUTC(new); 279 281 } 280 while ((p = getcomponent( )) != NULL) {282 while ((p = getcomponent(psh)) != NULL) { 281 283 if (equal(p, "..")) { 282 284 while (new > stackblock() && (STUNPUTC(new), *new) != '/'); … … 291 293 STACKSTRNUL(new); 292 294 INTOFF; 293 if (p revdir)294 ckfree(p revdir);295 p revdir =curdir;296 curdir = savestr(stackblock());297 setvar( "PWD",curdir, VEXPORT);295 if (psh->prevdir) 296 ckfree(psh->prevdir); 297 psh->prevdir = psh->curdir; 298 psh->curdir = savestr(stackblock()); 299 setvar(psh, "PWD", psh->curdir, VEXPORT); 298 300 INTON; 299 301 } … … 308 310 309 311 int 310 pwdcmd( int argc, char **argv)312 pwdcmd(shinstance *psh, int argc, char **argv) 311 313 { 312 314 int i; 313 315 char opt = 'L'; 314 316 315 while ((i = nextopt( "LP")) != '\0')317 while ((i = nextopt(psh, "LP")) != '\0') 316 318 opt = i; 317 if (* argptr)318 error( "unexpected argument");319 if (*psh->argptr) 320 error(psh, "unexpected argument"); 319 321 320 322 if (opt == 'L') 321 getpwd( 0);323 getpwd(psh, 0); 322 324 else 323 find_curdir( 0);324 325 setvar( "PWD",curdir, VEXPORT);326 out1str( curdir);327 out1c( '\n');325 find_curdir(psh, 0); 326 327 setvar(psh, "PWD", psh->curdir, VEXPORT); 328 out1str(psh, psh->curdir); 329 out1c(psh, '\n'); 328 330 return 0; 329 331 } … … 339 341 */ 340 342 void 341 getpwd( int noerror)343 getpwd(shinstance *psh, int noerror) 342 344 { 343 345 char *pwd; 344 346 struct stat stdot, stpwd; 345 static int first = 1;346 347 if ( curdir)347 /*static int first = 1;*/ 348 349 if (psh->curdir) 348 350 return; 349 351 350 if ( first) {351 first = 0;352 pwd = getenv("PWD");353 if (pwd && IS_ROOT(pwd) && s tat(".", &stdot) != -1 &&354 s tat(pwd, &stpwd) != -1 &&352 if (psh->getpwd_first) { 353 psh->getpwd_first = 0; 354 pwd = sh_getenv(psh, "PWD"); 355 if (pwd && IS_ROOT(pwd) && shfile_stat(&psh->fdtab, ".", &stdot) != -1 && 356 shfile_stat(&psh->fdtab, pwd, &stpwd) != -1 && 355 357 stdot.st_dev == stpwd.st_dev && 356 358 stdot.st_ino == stpwd.st_ino) { 357 curdir = savestr(pwd);359 psh->curdir = savestr(pwd); 358 360 return; 359 361 } 360 362 } 361 363 362 find_curdir( noerror);364 find_curdir(psh, noerror); 363 365 364 366 return; … … 366 368 367 369 STATIC void 368 find_curdir( int noerror)370 find_curdir(shinstance *psh, int noerror) 369 371 { 370 372 int i; … … 383 385 * /bin/pwd. 384 386 */ 385 #if defined(__NetBSD__) || defined(__SVR4) || defined(__INNOTEK_LIBC__)387 #if 1 //defined(__NetBSD__) || defined(__SVR4) || defined(__INNOTEK_LIBC__) 386 388 387 389 for (i = MAXPWD;; i *= 2) { 388 pwd = stalloc( i);389 if ( getcwd(pwd, i) != NULL) {390 curdir = savestr(pwd);390 pwd = stalloc(psh, i); 391 if (shfile_getcwd(&psh->fdtab, pwd, i) != NULL) { 392 psh->curdir = savestr(pwd); 391 393 return; 392 394 } 393 stunalloc(p wd);395 stunalloc(psh, pwd); 394 396 if (errno == ERANGE) 395 397 continue; 396 398 if (!noerror) 397 error( "getcwd() failed: %s", strerror(errno));399 error(psh, "getcwd() failed: %s", strerror(errno)); 398 400 return; 399 401 } … … 405 407 int pip[2]; 406 408 407 pwd = stalloc( MAXPWD);409 pwd = stalloc(psh, MAXPWD); 408 410 INTOFF; 409 411 if (pipe(pip) < 0) … … 442 444 p[-1] = '\0'; 443 445 INTON; 444 curdir = savestr(pwd);446 psh->curdir = savestr(pwd); 445 447 return; 446 448 } -
trunk/src/ash-messup/error.c
r809 r883 61 61 #include "error.h" 62 62 #include "show.h" 63 #include "shinstance.h" 63 64 64 65 … … 67 68 */ 68 69 69 struct jmploc *handler;70 /*struct jmploc *handler; 70 71 int exception; 71 72 volatile int suppressint; 72 73 volatile int intpending; 73 char *commandname; 74 75 76 static void exverror( int, const char *, va_list)77 __attribute__((__noreturn__));74 char *commandname;*/ 75 76 77 static void exverror(shinstance *psh, int, const char *, va_list) 78 /*__attribute__((__noreturn__))*/; 78 79 79 80 /* … … 84 85 85 86 void 86 exraise( int e)87 { 88 if ( handler == NULL)87 exraise(shinstance *psh, int e) 88 { 89 if (psh->handler == NULL) 89 90 abort(); 90 exception = e;91 longjmp( handler->loc, 1);91 psh->exception = e; 92 longjmp(psh->handler->loc, 1); 92 93 } 93 94 … … 104 105 105 106 void 106 onint( void)107 { 108 s igset_t nsigset;109 110 if ( suppressint) {111 intpending = 1;107 onint(shinstance *psh) 108 { 109 sh_sigset_t nsigset; 110 111 if (psh->suppressint) { 112 psh->intpending = 1; 112 113 return; 113 114 } 114 intpending = 0;115 s igemptyset(&nsigset);116 s igprocmask(SIG_SETMASK, &nsigset, NULL);117 if ( rootshell &&iflag)118 exraise( EXINT);115 psh->intpending = 0; 116 sh_sigemptyset(&nsigset); 117 sh_sigprocmask(psh, SIG_SETMASK, &nsigset, NULL); 118 if (psh->rootshell && psh->iflag) 119 exraise(psh, EXINT); 119 120 else { 120 s ignal(SIGINT, SIG_DFL);121 raise(SIGINT);121 sh_signal(psh, SIGINT, SIG_DFL); 122 sh_raise_sigint(psh);/*raise(psh, SIGINT);*/ 122 123 } 123 124 /* NOTREACHED */ … … 125 126 126 127 static void 127 exvwarning( int sv_errno, const char *msg, va_list ap)128 exvwarning(shinstance *psh, int sv_errno, const char *msg, va_list ap) 128 129 { 129 130 /* Partially emulate line buffered output so that: … … 133 134 * both generate sensible text when stdout and stderr are merged. 134 135 */ 135 if ( output.nextc != output.buf &&output.nextc[-1] == '\n')136 flushout(& output);137 if ( commandname)138 outfmt(& errout, "%s: ",commandname);136 if (psh->output.nextc != psh->output.buf && psh->output.nextc[-1] == '\n') 137 flushout(&psh->output); 138 if (psh->commandname) 139 outfmt(&psh->errout, "%s: ", psh->commandname); 139 140 if (msg != NULL) { 140 doformat(& errout, msg, ap);141 doformat(&psh->errout, msg, ap); 141 142 if (sv_errno >= 0) 142 outfmt(& errout, ": ");143 outfmt(&psh->errout, ": "); 143 144 } 144 145 if (sv_errno >= 0) 145 outfmt(& errout, "%s", strerror(sv_errno));146 out2c( '\n');147 flushout(& errout);146 outfmt(&psh->errout, "%s", strerror(sv_errno)); 147 out2c(psh, '\n'); 148 flushout(&psh->errout); 148 149 } 149 150 … … 154 155 */ 155 156 static void 156 exverror( int cond, const char *msg, va_list ap)157 exverror(shinstance *psh, int cond, const char *msg, va_list ap) 157 158 { 158 159 CLEAR_PENDING_INT; … … 168 169 #endif 169 170 if (msg) 170 exvwarning( -1, msg, ap);171 172 output_flushall( );173 exraise( cond);171 exvwarning(psh, -1, msg, ap); 172 173 output_flushall(psh); 174 exraise(psh, cond); 174 175 /* NOTREACHED */ 175 176 } … … 177 178 178 179 void 179 error( const char *msg, ...)180 error(shinstance *psh, const char *msg, ...) 180 181 { 181 182 va_list ap; 182 183 183 184 va_start(ap, msg); 184 exverror( EXERROR, msg, ap);185 exverror(psh, EXERROR, msg, ap); 185 186 /* NOTREACHED */ 186 187 va_end(ap); … … 189 190 190 191 void 191 exerror( int cond, const char *msg, ...)192 exerror(shinstance *psh, int cond, const char *msg, ...) 192 193 { 193 194 va_list ap; 194 195 195 196 va_start(ap, msg); 196 exverror( cond, msg, ap);197 exverror(psh, cond, msg, ap); 197 198 /* NOTREACHED */ 198 199 va_end(ap); … … 204 205 205 206 void 206 sh_exit( int rval)207 { 208 exerrno = rval & 255;209 exraise( EXEXEC);210 } 211 212 void 213 sh_err( int status, const char *fmt, ...)207 sh_exit(shinstance *psh, int rval) 208 { 209 psh->exerrno = rval & 255; 210 exraise(psh, EXEXEC); 211 } 212 213 void 214 sh_err(shinstance *psh, int status, const char *fmt, ...) 214 215 { 215 216 va_list ap; 216 217 217 218 va_start(ap, fmt); 218 exvwarning( errno, fmt, ap);219 va_end(ap); 220 sh_exit( status);221 } 222 223 void 224 sh_verr( int status, const char *fmt, va_list ap)225 { 226 exvwarning( errno, fmt, ap);227 sh_exit( status);228 } 229 230 void 231 sh_errx( int status, const char *fmt, ...)219 exvwarning(psh, errno, fmt, ap); 220 va_end(ap); 221 sh_exit(psh, status); 222 } 223 224 void 225 sh_verr(shinstance *psh, int status, const char *fmt, va_list ap) 226 { 227 exvwarning(psh, errno, fmt, ap); 228 sh_exit(psh, status); 229 } 230 231 void 232 sh_errx(shinstance *psh, int status, const char *fmt, ...) 232 233 { 233 234 va_list ap; 234 235 235 236 va_start(ap, fmt); 236 exvwarning( -1, fmt, ap);237 va_end(ap); 238 sh_exit( status);239 } 240 241 void 242 sh_verrx( int status, const char *fmt, va_list ap)243 { 244 exvwarning( -1, fmt, ap);245 sh_exit( status);246 } 247 248 void 249 sh_warn( const char *fmt, ...)237 exvwarning(psh, -1, fmt, ap); 238 va_end(ap); 239 sh_exit(psh, status); 240 } 241 242 void 243 sh_verrx(shinstance *psh, int status, const char *fmt, va_list ap) 244 { 245 exvwarning(psh, -1, fmt, ap); 246 sh_exit(psh, status); 247 } 248 249 void 250 sh_warn(shinstance *psh, const char *fmt, ...) 250 251 { 251 252 va_list ap; 252 253 253 254 va_start(ap, fmt); 254 exvwarning( errno, fmt, ap);255 va_end(ap); 256 } 257 258 void 259 sh_vwarn( const char *fmt, va_list ap)260 { 261 exvwarning( errno, fmt, ap);262 } 263 264 void 265 sh_warnx( const char *fmt, ...)255 exvwarning(psh, errno, fmt, ap); 256 va_end(ap); 257 } 258 259 void 260 sh_vwarn(shinstance *psh, const char *fmt, va_list ap) 261 { 262 exvwarning(psh, errno, fmt, ap); 263 } 264 265 void 266 sh_warnx(shinstance *psh, const char *fmt, ...) 266 267 { 267 268 va_list ap; 268 269 269 270 va_start(ap, fmt); 270 exvwarning( -1, fmt, ap);271 va_end(ap); 272 } 273 274 void 275 sh_vwarnx( const char *fmt, va_list ap)276 { 277 exvwarning( -1, fmt, ap);271 exvwarning(psh, -1, fmt, ap); 272 va_end(ap); 273 } 274 275 void 276 sh_vwarnx(shinstance *psh, const char *fmt, va_list ap) 277 { 278 exvwarning(psh, -1, fmt, ap); 278 279 } 279 280 … … 357 358 358 359 const char * 359 errmsg( int e, int action)360 errmsg(shinstance *psh, int e, int action) 360 361 { 361 362 struct errname const *ep; 362 static char buf[12];363 /*static char buf[12];*/ 363 364 364 365 for (ep = errormsg ; ep->errcode ; ep++) { … … 366 367 return ep->msg; 367 368 } 368 fmtstr( buf, sizeofbuf, "error %d", e);369 return buf;370 } 369 fmtstr(psh->errmsg_buf, sizeof psh->errmsg_buf, "error %d", e); 370 return psh->errmsg_buf; 371 } -
trunk/src/ash-messup/eval.c
r809 r883 100 100 101 101 102 char *commandname; 102 /*char *commandname;*/ 103 103 struct strlist *cmdenviron; 104 104 int exitstatus; /* exit status of last command */ -
trunk/src/ash-messup/jobs.c
r809 r883 1021 1021 */ 1022 1022 if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT) 1023 raise(SIGINT);1023 sh_raise_sigint(psh);/*raise(SIGINT);*/ 1024 1024 } 1025 1025 #endif -
trunk/src/ash-messup/main.c
r882 r883 118 118 * Create the root shell instance. 119 119 */ 120 psh = create_root_shell(NULL, argc, argv);120 psh = sh_create_root_shell(NULL, argc, argv); 121 121 if (!psh) 122 122 return 2; -
trunk/src/ash-messup/output.c
r809 r883 253 253 strout.fd = BLOCK_OUT; 254 254 strout.flags = 0; 255 strout.psh = NULL; 255 256 doformat(&strout, fmt, ap); 256 257 outc('\0', &strout); -
trunk/src/ash-messup/output.h
r880 r883 69 69 void dprintf(struct shinstance *, const char *, ...) 70 70 __attribute__((__format__(__printf__,2,3))); 71 void fmtstr( struct shinstance *,char *, size_t, const char *, ...)72 __attribute__((__format__(__printf__, 4,5)));71 void fmtstr(char *, size_t, const char *, ...) 72 __attribute__((__format__(__printf__,3,4))); 73 73 void doformat(struct output *, const char *, va_list); 74 74 int xwrite(int, char *, int); -
trunk/src/ash-messup/shfile.h
r882 r883 46 46 { 47 47 shmtx mtx; /**< Mutex protecting any operations on the table and it's handles. */ 48 char *cwd; /**< The current directory for this shell instance. */ 48 49 unsigned size; /**< The size of the table (number of entries). */ 49 50 shfile *tab; /**< Pointer to the table. */ … … 52 53 53 54 int shfile_open(shfdtab *, const char *, unsigned); 54 int shfile_close(shfdtab * pfdtab, unsigned fd);55 int shfile_close(shfdtab *, unsigned); 55 56 57 int shfile_stat(shfdtab *, const char *, struct stat *); 58 int shfile_lstat(shfdtab *, const char *, struct stat *); 59 int shfile_chdir(shfdtab *, const char *); 60 char *shfile_getcwd(shfdtab *, char *, int); 61 56 62 #endif 57 63 -
trunk/src/ash-messup/shinstance.c
r879 r883 37 37 * @returns pointer to root shell on success, NULL on failure. 38 38 */ 39 shinstance * create_root_shell(shinstance *inherit, int argc, char **argv)39 shinstance *sh_create_root_shell(shinstance *inherit, int argc, char **argv) 40 40 { 41 41 shinstance *psh; -
trunk/src/ash-messup/shinstance.h
r882 r883 25 25 */ 26 26 27 #ifndef ___shinstance_h___ 28 #define ___shinstance_h___ 29 27 30 #include "shtypes.h" 28 31 #include "shthread.h" 29 32 #include "shfile.h" 33 34 #include "var.h" 35 30 36 31 37 /** … … 141 147 struct alias *atab[ATABSIZE]; 142 148 149 /* cd.c */ 150 char *curdir; /**< current working directory */ 151 char *prevdir; /**< previous working directory */ 152 char *cdcomppath; 153 int getpwd_first; /**< static in getpwd. (initialized to 1!) */ 154 155 /* error.c */ 156 char errmsg_buf[16]; /**< static in errmsg. (bss) */ 157 143 158 } shinstance; 144 159 145 160 146 extern shinstance *create_root_shell(shinstance *inherit, int argc, char **argv); 161 extern shinstance *sh_create_root_shell(shinstance *inherit, int argc, char **argv); 162 char *sh_getenv(shinstance *, const char *); 147 163 164 /* signals */ 165 #include <signal.h> 166 #ifdef _MSC_VER 167 typedef uint32_t sh_sigset_t; 168 #else 169 typedef sigset_t sh_sigset_t; 170 #endif 171 172 typedef void (*sh_handler)(int); 173 sh_handler sh_signal(shinstance *, int, sh_handler handler); 174 void sh_raise_sigint(shinstance *); 175 void sh_sigemptyset(sh_sigset_t *set); 176 int sh_sigprocmask(shinstance *, int op, sh_sigset_t const *new, sh_sigset_t *old); 177 178 #endif -
trunk/src/ash-messup/shthread.h
r882 r883 28 28 #define ___shthread_h___ 29 29 30 #include <sys/types.h>30 #include "shtypes.h" 31 31 32 32 typedef struct shmtx
Note:
See TracChangeset
for help on using the changeset viewer.