• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching refs:tp

62 	struct tbl *tp = NULL;  in execute()  local
146 tp = findcom(ap[0], FC_BI|FC_FUNC); in execute()
162 if (iosetup(*iowp, tp) < 0) { in execute()
168 if (tp && tp->type == CSHELL && in execute()
169 (tp->flag & SPEC_BI)) in execute()
178 rv = comexec(t, tp, (const char **)ap, flags, xerrok); in execute()
496 comexec(struct op *t, struct tbl * volatile tp, const char **ap, in comexec() argument
542 while (tp && tp->type == CSHELL) { in comexec()
545 if (tp->val.f == c_builtin) { in comexec()
548 tp = NULL; in comexec()
551 if ((tp = findcom(cp, FC_BI)) == NULL) in comexec()
553 if (tp->type == CSHELL && (tp->val.f == c_cat in comexec()
555 || tp->val.f == c_printf in comexec()
560 } else if (tp->val.f == c_exec) { in comexec()
580 } else if (tp->val.f == c_command) { in comexec()
615 } else if (tp->val.f == c_cat) { in comexec()
625 tp = ext_cat; in comexec()
629 } else if (tp->val.f == c_printf) { in comexec()
635 tp = ext_printf; in comexec()
638 } else if (tp->val.f == c_trap) { in comexec()
643 tp = findcom(ap[0], fcflags & (FC_BI|FC_FUNC)); in comexec()
648 if (!resetspec && (!ap[0] || (tp && (tp->flag & KEEPASN)))) in comexec()
654 if (!resetspec && tp && tp->type == CFUNC && in comexec()
655 !(tp->flag & FKSH)) in comexec()
704 } else if (!tp) { in comexec()
710 tp = findcom(cp, fcflags); in comexec()
713 switch (tp->type) { in comexec()
718 rv = call_builtin(tp, (const char **)ap, null, resetspec); in comexec()
719 if (resetspec && tp->val.f == c_shift) { in comexec()
731 if (!(tp->flag & ISSET)) { in comexec()
734 if (!tp->u.fpath) { in comexec()
735 rv = (tp->u2.errnov == ENOENT) ? 127 : 126; in comexec()
738 cstrerror(tp->u2.errnov)); in comexec()
741 if (include(tp->u.fpath, 0, NULL, false) < 0) { in comexec()
744 tp = findcom(Tcat, FC_BI); in comexec()
750 tp = findcom(Tprintf, FC_BI); in comexec()
756 tp->u.fpath, cstrerror(errno)); in comexec()
769 "function not defined by", tp->u.fpath); in comexec()
773 tp = ftp; in comexec()
781 if (tp->flag & FKSH) in comexec()
793 if (tp->flag & FKSH) { in comexec()
802 ((tp->flag & TRACE) ? 1 : 0), false); in comexec()
803 old_inuse = tp->flag & FINUSE; in comexec()
804 tp->flag |= FINUSE; in comexec()
808 execute(tp->val.t, flags & XERROK, NULL); in comexec()
815 if (tp->flag & FKSH) { in comexec()
822 tp->flag = (tp->flag & ~FINUSE) | old_inuse; in comexec()
828 if ((tp->flag & (FDELETE|FINUSE)) == FDELETE) { in comexec()
829 if (tp->flag & ALLOC) { in comexec()
830 tp->flag &= ~ALLOC; in comexec()
831 tfree(tp->val.t, tp->areap); in comexec()
833 tp->flag = 0; in comexec()
858 if (!(tp->flag&ISSET)) { in comexec()
859 if (tp->u2.errnov == ENOENT) { in comexec()
865 cstrerror(tp->u2.errnov)); in comexec()
873 tp->val.s, KSH_RETURN_ERROR); in comexec()
879 texec.str = tp->val.s; in comexec()
909 scriptexec(struct op *tp, const char **ap) in scriptexec() argument
924 *tp->args-- = tp->str; in scriptexec()
927 if ((fd = binopen2(tp->str, O_RDONLY)) >= 0) { in scriptexec()
985 *tp->args-- = (char *)cp; in scriptexec()
991 errorf("%s: not executable: %d-bit ELF file", tp->str, in scriptexec()
1006 errorf("%s: not executable: magic %04X", tp->str, m); in scriptexec()
1011 args.ro = tp->args; in scriptexec()
1018 errorf("%s: %s: %s", tp->str, sh, cstrerror(errno)); in scriptexec()
1024 struct tbl *tp; in shcomexec() local
1026 tp = ktsearch(&builtins, *wp, hash(*wp)); in shcomexec()
1027 return (call_builtin(tp, wp, "shcomexec", false)); in shcomexec()
1038 struct tbl *tp = NULL; in findfunc() local
1041 tp = ktsearch(&l->funs, name, h); in findfunc()
1042 if (tp) in findfunc()
1045 tp = ktenter(&l->funs, name, h); in findfunc()
1046 tp->flag = DEFINED; in findfunc()
1047 tp->type = CFUNC; in findfunc()
1048 tp->val.t = NULL; in findfunc()
1052 return (tp); in findfunc()
1063 struct tbl *tp; in define() local
1069 tp = findfunc(name, nhash, true); in define()
1071 if (tp->flag & ISSET) in define()
1077 if (tp->flag & FINUSE) { in define()
1078 tp->name[0] = '\0'; in define()
1080 tp->flag &= ~DEFINED; in define()
1081 tp->flag |= FDELETE; in define()
1086 if (tp->flag & ALLOC) { in define()
1087 tp->flag &= ~(ISSET|ALLOC); in define()
1088 tfree(tp->val.t, tp->areap); in define()
1093 ktdelete(tp); in define()
1097 tp->val.t = tcopy(t->left, tp->areap); in define()
1098 tp->flag |= (ISSET|ALLOC); in define()
1100 tp->flag |= FKSH; in define()
1111 struct tbl *tp; in builtin() local
1127 tp = ktenter(&builtins, name, hash(name)); in builtin()
1128 tp->flag = flag; in builtin()
1129 tp->type = CSHELL; in builtin()
1130 tp->val.f = func; in builtin()
1144 struct tbl *tp = NULL, *tbi; in findcom() local
1163 tp = tbi; in findcom()
1164 if (!tp && (flags & FC_FUNC)) { in findcom()
1165 tp = findfunc(name, h, false); in findcom()
1166 if (tp && !(tp->flag & ISSET)) { in findcom()
1168 tp->u.fpath = NULL; in findcom()
1169 tp->u2.errnov = ENOENT; in findcom()
1171 tp->u.fpath = search_path(name, fpath, R_OK, in findcom()
1172 &tp->u2.errnov); in findcom()
1175 if (!tp && (flags & FC_NORMBI) && tbi) in findcom()
1176 tp = tbi; in findcom()
1177 if (!tp && (flags & FC_PATH) && !(flags & FC_DEFPATH)) { in findcom()
1178 tp = ktsearch(&taliases, name, h); in findcom()
1179 if (tp && (tp->flag & ISSET) && in findcom()
1180 ksh_access(tp->val.s, X_OK) != 0) { in findcom()
1181 if (tp->flag & ALLOC) { in findcom()
1182 tp->flag &= ~ALLOC; in findcom()
1183 afree(tp->val.s, APERM); in findcom()
1185 tp->flag &= ~ISSET; in findcom()
1190 if ((!tp || (tp->type == CTALIAS && !(tp->flag&ISSET))) && in findcom()
1192 if (!tp) { in findcom()
1194 tp = ktenter(&taliases, name, h); in findcom()
1195 tp->type = CTALIAS; in findcom()
1197 tp = &temp; in findcom()
1198 tp->type = CEXEC; in findcom()
1201 tp->flag = DEFINED; in findcom()
1205 X_OK, &tp->u2.errnov); in findcom()
1207 strdupx(tp->val.s, npath.ro, APERM); in findcom()
1210 tp->flag |= ISSET|ALLOC; in findcom()
1214 &tp->u2.errnov)) != NULL) { in findcom()
1221 tp = &temp; in findcom()
1222 tp->type = CFUNC; in findcom()
1224 tp->flag = DEFINED; in findcom()
1225 tp->u.fpath = npath.ro; in findcom()
1228 return (tp); in findcom()
1238 struct tbl *tp; in flushcom() local
1241 for (ktwalk(&ts, &taliases); (tp = ktnext(&ts)) != NULL; ) in flushcom()
1242 if ((tp->flag&ISSET) && (all || !mksh_abspath(tp->val.s))) { in flushcom()
1243 if (tp->flag&ALLOC) { in flushcom()
1244 tp->flag &= ~(ALLOC|ISSET); in flushcom()
1245 afree(tp->val.s, APERM); in flushcom()
1247 tp->flag &= ~ISSET; in flushcom()
1336 call_builtin(struct tbl *tp, const char **wp, const char *where, bool resetspec) in call_builtin() argument
1340 if (!tp) in call_builtin()
1345 ((tp->flag & SPEC_BI) || (Flag(FPOSIX) && (tp->flag & KEEPASN)))); in call_builtin()
1349 rv = (*tp->val.f)(wp); in call_builtin()
1361 iosetup(struct ioword *iop, struct tbl *tp) in iosetup() argument
1520 else if (tp && tp->type == CSHELL && tp->val.f == c_exec) { in iosetup()