Changeset 1203 for trunk/src/kash/exec.c
- Timestamp:
- Oct 7, 2007, 3:39:01 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/exec.c
r1202 r1203 86 86 #endif 87 87 88 89 #define CMDTABLESIZE 31 /* should be prime */ 90 #define ARB 1 /* actual size determined at run time */ 91 92 93 94 struct tblentry { 95 struct tblentry *next; /* next entry in hash chain */ 96 union param param; /* definition of builtin function */ 97 short cmdtype; /* index identifying command */ 98 char rehash; /* if set, cd done since entry created */ 99 char cmdname[ARB]; /* name of command */ 100 }; 101 102 103 STATIC struct tblentry *cmdtable[CMDTABLESIZE]; 104 STATIC int builtinloc = -1; /* index in path of %builtin, or -1 */ 105 int exerrno = 0; /* Last exec error */ 106 107 108 STATIC void tryexec(char *, char **, char **, int, int); 109 STATIC void execinterp(char **, char **); 110 STATIC void printentry(struct tblentry *, int); 111 STATIC void clearcmdentry(int); 112 STATIC struct tblentry *cmdlookup(const char *, int); 113 STATIC void delete_cmd_entry(void); 88 #include "shinstance.h" 89 90 //#define CMDTABLESIZE 31 /* should be prime */ 91 //#define ARB 1 /* actual size determined at run time */ 92 // 93 // 94 // 95 //struct tblentry { 96 // struct tblentry *next; /* next entry in hash chain */ 97 // union param param; /* definition of builtin function */ 98 // short cmdtype; /* index identifying command */ 99 // char rehash; /* if set, cd done since entry created */ 100 // char cmdname[ARB]; /* name of command */ 101 //}; 102 // 103 // 104 //STATIC struct tblentry *cmdtable[CMDTABLESIZE]; 105 //STATIC int builtinloc = -1; /* index in path of %builtin, or -1 */ 106 //int exerrno = 0; /* Last exec error */ 107 108 109 STATIC void tryexec(shinstance *, char *, char **, char **, int, int); 110 STATIC void execinterp(shinstance *, char **, char **); 111 STATIC void printentry(shinstance *, struct tblentry *, int); 112 STATIC void clearcmdentry(shinstance *, int); 113 STATIC struct tblentry *cmdlookup(shinstance *, const char *, int); 114 STATIC void delete_cmd_entry(shinstance *); 114 115 #ifdef PC_EXE_EXTS 115 STATIC int stat_pc_exec_exts( char *fullname, struct stat *st, int has_ext);116 STATIC int stat_pc_exec_exts(shinstance *, char *fullname, struct stat *st, int has_ext); 116 117 #endif 117 118 … … 125 126 126 127 void 127 shellexec( char **argv, char **envp, const char *path, int idx, int vforked)128 shellexec(shinstance *psh, char **argv, char **envp, const char *path, int idx, int vforked) 128 129 { 129 130 char *cmdname; 130 131 int e; 131 132 #ifdef PC_EXE_EXTS 132 int has_ext = strlen(argv[0]) - 4;133 int has_ext = (int)strlen(argv[0]) - 4; 133 134 has_ext = has_ext > 0 134 135 && argv[0][has_ext] == '.' … … 148 149 cmdname = stalloc(psh, strlen(argv[0]) + 5); 149 150 strcpy(cmdname, argv[0]); 150 tryexec( cmdname, argv, envp, vforked, has_ext);151 tryexec(psh, cmdname, argv, envp, vforked, has_ext); 151 152 TRACE((psh, "shellexec: cmdname=%s\n", cmdname)); 152 153 stunalloc(psh, cmdname); … … 155 156 e = ENOENT; 156 157 while ((cmdname = padvance(psh, &path, argv[0])) != NULL) { 157 if (--idx < 0 && p athopt == NULL) {158 tryexec( cmdname, argv, envp, vforked, has_ext);158 if (--idx < 0 && psh->pathopt == NULL) { 159 tryexec(psh, cmdname, argv, envp, vforked, has_ext); 159 160 if (errno != ENOENT && errno != ENOTDIR) 160 161 e = errno; … … 167 168 switch (e) { 168 169 case EACCES: 169 exerrno = 126;170 psh->exerrno = 126; 170 171 break; 171 172 case ENOENT: 172 exerrno = 127;173 psh->exerrno = 127; 173 174 break; 174 175 default: 175 exerrno = 2;176 psh->exerrno = 2; 176 177 break; 177 178 } 178 179 TRACE((psh, "shellexec failed for '%s', errno %d, vforked %d, suppressint %d\n", 179 argv[0], e, vforked, suppressint ));180 argv[0], e, vforked, psh->suppressint )); 180 181 exerror(psh, EXEXEC, "%s: %s", argv[0], errmsg(psh, e, E_EXEC)); 181 182 /* NOTREACHED */ … … 184 185 185 186 STATIC void 186 tryexec( char *cmd, char **argv, char **envp, int vforked, int has_ext)187 tryexec(shinstance *psh, char *cmd, char **argv, char **envp, int vforked, int has_ext) 187 188 { 188 189 int e; … … 196 197 struct stat st; 197 198 if (!has_ext) 198 stat_pc_exec_exts( cmd, &st, 0);199 stat_pc_exec_exts(psh, cmd, &st, 0); 199 200 #endif 200 201 #if defined __INNOTEK_LIBC__ && defined EXEC_HASH_BANG_SCRIPT … … 204 205 #ifdef SYSV 205 206 do { 206 execve(cmd, argv, envp);207 sh_execve(psh, cmd, argv, envp); 207 208 } while (errno == EINTR); 208 209 #else 209 execve(cmd, argv, envp);210 sh_execve(psh, cmd, argv, envp); 210 211 #endif 211 212 e = errno; … … 220 221 initshellproc(psh); 221 222 setinputfile(psh, cmd, 0); 222 commandname =arg0 = savestr(argv[0]);223 psh->commandname = psh->arg0 = savestr(argv[0]); 223 224 #ifdef EXEC_HASH_BANG_SCRIPT 224 225 pgetc(psh); pungetc(psh); /* fill up input buffer */ 225 p = p arsenextc;226 if (p arsenleft > 2 && p[0] == '#' && p[1] == '!') {226 p = psh->parsenextc; 227 if (psh->parsenleft > 2 && p[0] == '#' && p[1] == '!') { 227 228 argv[0] = cmd; 228 execinterp( argv, envp);229 execinterp(psh, argv, envp); 229 230 } 230 231 #endif … … 250 251 251 252 STATIC void 252 execinterp( char **argv, char **envp)253 execinterp(shinstance *psh, char **argv, char **envp) 253 254 { 254 255 int n; … … 263 264 char **new; 264 265 265 n = p arsenleft - 2;266 inp = p arsenextc + 2;266 n = psh->parsenleft - 2; 267 inp = psh->parsenextc + 2; 267 268 ap = newargs; 268 269 for (;;) { … … 310 311 while (*ap2++ = *ap++); 311 312 TRACE((psh, "hash bang '%s'\n", new[0])); 312 shellexec(psh, new, envp, pathval( ), 0, 0);313 shellexec(psh, new, envp, pathval(psh), 0, 0); 313 314 /* NOTREACHED */ 314 315 } … … 323 324 * the possible path expansions in sequence. If an option (indicated by 324 325 * a percent sign) appears in the path entry then the global variable 325 * p athopt will be set to point to it; otherwisepathopt will be set to326 * psh->pathopt will be set to point to it; otherwise psh->pathopt will be set to 326 327 * NULL. 327 328 */ 328 329 329 const char *pathopt;330 //const char *pathopt; 330 331 331 332 char * 332 padvance( const char **path, const char *name)333 padvance(shinstance *psh, const char **path, const char *name) 333 334 { 334 335 const char *p; … … 345 346 for (p = start ; *p && *p != ':' && *p != '%' ; p++); 346 347 #endif 347 len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */348 len = (int)(p - start + strlen(name) + 2); /* "2" is for '/' and '\0' */ 348 349 #ifdef PC_EXE_EXTS 349 350 len += 4; /* "4" is for .exe/.com/.cmd/.bat/.btm */ … … 358 359 } 359 360 strcpy(q, name); 360 p athopt = NULL;361 psh->pathopt = NULL; 361 362 if (*p == '%') { 362 p athopt = ++p;363 psh->pathopt = ++p; 363 364 #ifdef PC_PATH_SEP 364 365 while (*p && *p != ';') p++; … … 380 381 381 382 #ifdef PC_EXE_EXTS 382 STATIC int stat_pc_exec_exts( char *fullname, struct stat *st, int has_ext)383 STATIC int stat_pc_exec_exts(shinstance *psh, char *fullname, struct stat *st, int has_ext) 383 384 { 384 385 /* skip the SYSV crap */ 385 if (s tat(fullname, st) >= 0)386 if (shfile_stat(&psh->fdtab, fullname, st) >= 0) 386 387 return 0; 387 388 if (!has_ext && errno == ENOENT) … … 389 390 char *psz = strchr(fullname, '\0'); 390 391 memcpy(psz, ".exe", 5); 391 if (s tat(fullname, st) >= 0)392 if (shfile_stat(&psh->fdtab, fullname, st) >= 0) 392 393 return 0; 393 394 if (errno != ENOENT && errno != ENOTDIR) … … 395 396 396 397 memcpy(psz, ".cmd", 5); 397 if (s tat(fullname, st) >= 0)398 if (shfile_stat(&psh->fdtab, fullname, st) >= 0) 398 399 return 0; 399 400 if (errno != ENOENT && errno != ENOTDIR) … … 401 402 402 403 memcpy(psz, ".bat", 5); 403 if (s tat(fullname, st) >= 0)404 if (shfile_stat(&psh->fdtab, fullname, st) >= 0) 404 405 return 0; 405 406 if (errno != ENOENT && errno != ENOTDIR) … … 407 408 408 409 memcpy(psz, ".com", 5); 409 if (s tat(fullname, st) >= 0)410 if (shfile_stat(&psh->fdtab, fullname, st) >= 0) 410 411 return 0; 411 412 if (errno != ENOENT && errno != ENOTDIR) … … 413 414 414 415 memcpy(psz, ".btm", 5); 415 if (s tat(fullname, st) >= 0)416 if (shfile_stat(&psh->fdtab, fullname, st) >= 0) 416 417 return 0; 417 418 *psz = '\0'; … … 427 428 428 429 int 429 hashcmd( int argc, char **argv)430 hashcmd(shinstance *psh, int argc, char **argv) 430 431 { 431 432 struct tblentry **pp; … … 439 440 while ((c = nextopt(psh, "rv")) != '\0') { 440 441 if (c == 'r') { 441 clearcmdentry( 0);442 clearcmdentry(psh, 0); 442 443 } else if (c == 'v') { 443 444 verbose++; 444 445 } 445 446 } 446 if (* argptr == NULL) {447 for (pp = cmdtable ; pp < &cmdtable[CMDTABLESIZE] ; pp++) {447 if (*psh->argptr == NULL) { 448 for (pp = psh->cmdtable ; pp < &psh->cmdtable[CMDTABLESIZE] ; pp++) { 448 449 for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) { 449 450 if (verbose || cmdp->cmdtype == CMDNORMAL) 450 printentry( cmdp, verbose);451 printentry(psh, cmdp, verbose); 451 452 } 452 453 } 453 454 return 0; 454 455 } 455 while ((name = * argptr) != NULL) {456 if ((cmdp = cmdlookup( name, 0)) != NULL456 while ((name = *psh->argptr) != NULL) { 457 if ((cmdp = cmdlookup(psh, name, 0)) != NULL 457 458 && (cmdp->cmdtype == CMDNORMAL 458 || (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0)))459 delete_cmd_entry( );460 find_command(psh, name, &entry, DO_ERR, pathval( ));459 || (cmdp->cmdtype == CMDBUILTIN && psh->builtinloc >= 0))) 460 delete_cmd_entry(psh); 461 find_command(psh, name, &entry, DO_ERR, pathval(psh)); 461 462 if (verbose) { 462 463 if (entry.cmdtype != CMDUNKNOWN) { /* if no error msg */ 463 cmdp = cmdlookup( name, 0);464 printentry( cmdp, verbose);464 cmdp = cmdlookup(psh, name, 0); 465 printentry(psh, cmdp, verbose); 465 466 } 466 467 output_flushall(psh); 467 468 } 468 argptr++;469 psh->argptr++; 469 470 } 470 471 return 0; … … 473 474 474 475 STATIC void 475 printentry(s truct tblentry *cmdp, int verbose)476 printentry(shinstance *psh, struct tblentry *cmdp, int verbose) 476 477 { 477 478 int idx; … … 482 483 case CMDNORMAL: 483 484 idx = cmdp->param.index; 484 path = pathval( );485 path = pathval(psh); 485 486 do { 486 487 name = padvance(psh, &path, cmdp->cmdname); … … 523 524 524 525 void 525 find_command( char *name, struct cmdentry *entry, int act, const char *path)526 find_command(shinstance *psh, char *name, struct cmdentry *entry, int act, const char *path) 526 527 { 527 528 struct tblentry *cmdp, loc_cmd; … … 531 532 struct stat statb; 532 533 int e; 533 int (*bltin)( int,char **);534 int (*bltin)(shinstance*,int,char **); 534 535 535 536 #ifdef PC_EXE_EXTS 536 int has_ext = strlen(name) - 4;537 int has_ext = (int)(strlen(name) - 4); 537 538 has_ext = has_ext > 0 538 539 && name[has_ext] == '.' … … 550 551 if (strchr(name, '/') != NULL) { 551 552 if (act & DO_ABS) { 552 while (s tat(name, &statb) < 0) {553 while (shfile_stat(&psh->fdtab, name, &statb) < 0) { 553 554 #ifdef SYSV 554 555 if (errno == EINTR) … … 570 571 } 571 572 572 if (path != pathval( ))573 if (path != pathval(psh)) 573 574 act |= DO_ALTPATH; 574 575 … … 577 578 578 579 /* If name is in the table, check answer will be ok */ 579 if ((cmdp = cmdlookup( name, 0)) != NULL) {580 if ((cmdp = cmdlookup(psh, name, 0)) != NULL) { 580 581 do { 581 582 switch (cmdp->cmdtype) { … … 593 594 break; 594 595 case CMDBUILTIN: 595 if ((act & DO_ALTBLTIN) || builtinloc >= 0) {596 if ((act & DO_ALTBLTIN) || psh->builtinloc >= 0) { 596 597 cmdp = NULL; 597 598 continue; … … 606 607 607 608 /* If %builtin not in path, check for builtin next */ 608 if ((act & DO_ALTPATH ? !(act & DO_ALTBLTIN) : builtinloc < 0) &&609 if ((act & DO_ALTPATH ? !(act & DO_ALTBLTIN) : psh->builtinloc < 0) && 609 610 (bltin = find_builtin(psh, name)) != 0) 610 611 goto builtin_success; … … 614 615 if (cmdp) { /* doing a rehash */ 615 616 if (cmdp->cmdtype == CMDBUILTIN) 616 prev = builtinloc;617 prev = psh->builtinloc; 617 618 else 618 619 prev = cmdp->param.index; … … 625 626 stunalloc(psh, fullname); 626 627 idx++; 627 if (p athopt) {628 if (prefix("builtin", p athopt)) {628 if (psh->pathopt) { 629 if (prefix("builtin", psh->pathopt)) { 629 630 if ((bltin = find_builtin(psh, name)) == 0) 630 631 goto loop; 631 632 goto builtin_success; 632 } else if (prefix("func", p athopt)) {633 } else if (prefix("func", psh->pathopt)) { 633 634 /* handled below */ 634 635 } else { … … 645 646 } 646 647 #ifdef PC_EXE_EXTS 647 while (stat_pc_exec_exts( fullname, &statb, has_ext) < 0) {648 while (stat_pc_exec_exts(psh, fullname, &statb, has_ext) < 0) { 648 649 #else 649 while (s tat(fullname, &statb) < 0) {650 while (shfile_stat(&psh->fdtab, fullname, &statb) < 0) { 650 651 #endif 651 652 #ifdef SYSV … … 661 662 if (!S_ISREG(statb.st_mode)) 662 663 goto loop; 663 if (p athopt) { /* this is a %func directory */664 if (psh->pathopt) { /* this is a %func directory */ 664 665 if (act & DO_NOFUNC) 665 666 goto loop; 666 667 stalloc(psh, strlen(fullname) + 1); 667 668 readcmdfile(psh, fullname); 668 if ((cmdp = cmdlookup( name, 0)) == NULL ||669 if ((cmdp = cmdlookup(psh, name, 0)) == NULL || 669 670 cmdp->cmdtype != CMDFUNCTION) 670 671 error(psh, "%s not defined in %s", name, fullname); … … 692 693 cmdp = &loc_cmd; 693 694 } else 694 cmdp = cmdlookup( name, 1);695 cmdp = cmdlookup(psh, name, 1); 695 696 cmdp->cmdtype = CMDNORMAL; 696 697 cmdp->param.index = idx; … … 701 702 /* We failed. If there was an entry for this command, delete it */ 702 703 if (cmdp) 703 delete_cmd_entry( );704 delete_cmd_entry(psh); 704 705 if (act & DO_ERR) 705 706 outfmt(psh->out2, "%s: %s\n", name, errmsg(psh, e, E_EXEC)); … … 712 713 cmdp = &loc_cmd; 713 714 else 714 cmdp = cmdlookup( name, 1);715 cmdp = cmdlookup(psh, name, 1); 715 716 if (cmdp->cmdtype == CMDFUNCTION) 716 717 /* DO_NOFUNC must have been set */ … … 732 733 733 734 int 734 (*find_builtin(name))(int, char **) 735 char *name; 735 (*find_builtin(shinstance *psh, char *name))(shinstance *psh, int, char **) 736 736 { 737 737 const struct builtincmd *bp; … … 745 745 746 746 int 747 (*find_splbltin(name))(int, char **) 748 char *name; 747 (*find_splbltin(shinstance *psh, char *name))(shinstance *psh, int, char **) 749 748 { 750 749 const struct builtincmd *bp; … … 765 764 766 765 void 767 hash_special_builtins( void)766 hash_special_builtins(shinstance *psh) 768 767 { 769 768 const struct builtincmd *bp; … … 771 770 772 771 for (bp = splbltincmd ; bp->name ; bp++) { 773 cmdp = cmdlookup( bp->name, 1);772 cmdp = cmdlookup(psh, bp->name, 1); 774 773 cmdp->cmdtype = CMDSPLBLTIN; 775 774 cmdp->param.bltin = bp->builtin; … … 785 784 786 785 void 787 hashcd( void)786 hashcd(shinstance *psh) 788 787 { 789 788 struct tblentry **pp; 790 789 struct tblentry *cmdp; 791 790 792 for (pp = cmdtable ; pp < &cmdtable[CMDTABLESIZE] ; pp++) {791 for (pp = psh->cmdtable ; pp < &psh->cmdtable[CMDTABLESIZE] ; pp++) { 793 792 for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) { 794 793 if (cmdp->cmdtype == CMDNORMAL 795 || (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0))794 || (cmdp->cmdtype == CMDBUILTIN && psh->builtinloc >= 0)) 796 795 cmdp->rehash = 1; 797 796 } … … 804 803 * Fix command hash table when PATH changed. 805 804 * Called before PATH is changed. The argument is the new value of PATH; 806 * pathval( ) still returns the old value at this point.805 * pathval(psh) still returns the old value at this point. 807 806 * Called with interrupts off. 808 807 */ 809 808 810 809 void 811 changepath( const char *newval)810 changepath(shinstance *psh, const char *newval) 812 811 { 813 812 const char *old, *new; … … 816 815 int bltin; 817 816 818 old = pathval( );817 old = pathval(psh); 819 818 new = newval; 820 819 firstchange = 9999; /* assume no change */ … … 847 846 new++, old++; 848 847 } 849 if ( builtinloc < 0 && bltin >= 0)850 builtinloc = bltin; /* zap builtins */851 if ( builtinloc >= 0 && bltin < 0)848 if (psh->builtinloc < 0 && bltin >= 0) 849 psh->builtinloc = bltin; /* zap builtins */ 850 if (psh->builtinloc >= 0 && bltin < 0) 852 851 firstchange = 0; 853 clearcmdentry( firstchange);854 builtinloc = bltin;852 clearcmdentry(psh, firstchange); 853 psh->builtinloc = bltin; 855 854 } 856 855 … … 862 861 863 862 STATIC void 864 clearcmdentry( int firstchange)863 clearcmdentry(shinstance *psh, int firstchange) 865 864 { 866 865 struct tblentry **tblp; … … 869 868 870 869 INTOFF; 871 for (tblp = cmdtable ; tblp < &cmdtable[CMDTABLESIZE] ; tblp++) {870 for (tblp = psh->cmdtable ; tblp < &psh->cmdtable[CMDTABLESIZE] ; tblp++) { 872 871 pp = tblp; 873 872 while ((cmdp = *pp) != NULL) { … … 875 874 cmdp->param.index >= firstchange) 876 875 || (cmdp->cmdtype == CMDBUILTIN && 877 builtinloc >= firstchange)) {876 psh->builtinloc >= firstchange)) { 878 877 *pp = cmdp->next; 879 878 ckfree(cmdp); … … 905 904 906 905 void 907 deletefuncs( void)906 deletefuncs(shinstance *psh) 908 907 { 909 908 struct tblentry **tblp; … … 912 911 913 912 INTOFF; 914 for (tblp = cmdtable ; tblp < &cmdtable[CMDTABLESIZE] ; tblp++) {913 for (tblp = psh->cmdtable ; tblp < &psh->cmdtable[CMDTABLESIZE] ; tblp++) { 915 914 pp = tblp; 916 915 while ((cmdp = *pp) != NULL) { … … 941 940 942 941 STATIC struct tblentry * 943 cmdlookup( const char *name, int add)942 cmdlookup(shinstance *psh, const char *name, int add) 944 943 { 945 944 int hashval; … … 953 952 hashval += *p++; 954 953 hashval &= 0x7FFF; 955 pp = & cmdtable[hashval % CMDTABLESIZE];954 pp = &psh->cmdtable[hashval % CMDTABLESIZE]; 956 955 for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) { 957 956 if (equal(cmdp->cmdname, name)) … … 978 977 979 978 STATIC void 980 delete_cmd_entry( void)979 delete_cmd_entry(shinstance *psh) 981 980 { 982 981 struct tblentry *cmdp; … … 993 992 #ifdef notdef 994 993 void 995 getcmdentry( char *name, struct cmdentry *entry)996 { 997 struct tblentry *cmdp = cmdlookup( name, 0);994 getcmdentry(shinstance *psh, char *name, struct cmdentry *entry) 995 { 996 struct tblentry *cmdp = cmdlookup(psh, name, 0); 998 997 999 998 if (cmdp) { … … 1014 1013 1015 1014 STATIC void 1016 addcmdentry( char *name, struct cmdentry *entry)1015 addcmdentry(shinstance *psh, char *name, struct cmdentry *entry) 1017 1016 { 1018 1017 struct tblentry *cmdp; 1019 1018 1020 1019 INTOFF; 1021 cmdp = cmdlookup( name, 1);1020 cmdp = cmdlookup(psh, name, 1); 1022 1021 if (cmdp->cmdtype != CMDSPLBLTIN) { 1023 1022 if (cmdp->cmdtype == CMDFUNCTION) { … … 1036 1035 1037 1036 void 1038 defun( char *name, union node *func)1037 defun(shinstance *psh,char *name, union node *func) 1039 1038 { 1040 1039 struct cmdentry entry; … … 1053 1052 1054 1053 int 1055 unsetfunc( char *name)1054 unsetfunc(shinstance *psh, char *name) 1056 1055 { 1057 1056 struct tblentry *cmdp; 1058 1057 1059 if ((cmdp = cmdlookup( name, 0)) != NULL &&1058 if ((cmdp = cmdlookup(psh, name, 0)) != NULL && 1060 1059 cmdp->cmdtype == CMDFUNCTION) { 1061 1060 freefunc(cmdp->param.func); 1062 delete_cmd_entry( );1061 delete_cmd_entry(psh); 1063 1062 return (0); 1064 1063 } … … 1072 1071 1073 1072 int 1074 typecmd( int argc, char **argv)1073 typecmd(shinstance *psh, int argc, char **argv) 1075 1074 { 1076 1075 struct cmdentry entry; … … 1096 1095 error(psh, "cannot specify -p with -v or -V"); 1097 1096 1098 while ((arg = * argptr++)) {1097 while ((arg = *psh->argptr++)) { 1099 1098 if (!v_flag) 1100 1099 out1str(psh, arg); … … 1121 1120 1122 1121 /* Then check if it is a tracked alias */ 1123 if ((cmdp = cmdlookup( arg, 0)) != NULL) {1122 if ((cmdp = cmdlookup(psh, arg, 0)) != NULL) { 1124 1123 entry.cmdtype = cmdp->cmdtype; 1125 1124 entry.u = cmdp->param; 1126 1125 } else { 1127 1126 /* Finally use brute force */ 1128 find_command(psh, arg, &entry, DO_ABS, pathval( ));1127 find_command(psh, arg, &entry, DO_ABS, pathval(psh)); 1129 1128 } 1130 1129 … … 1132 1131 case CMDNORMAL: { 1133 1132 if (strchr(arg, '/') == NULL) { 1134 const char *path = pathval( );1133 const char *path = pathval(psh); 1135 1134 char *name; 1136 1135 int j = entry.u.index;
Note:
See TracChangeset
for help on using the changeset viewer.