• Home
  • Raw
  • Download

Lines Matching +full:ot +full:- +full:core +full:- +full:dump

5 /*-
13 * is granted to deal in this work without restriction, including un-
45 * use killpg if < -1 since -1 does special things
46 * for some non-killpg-endowed kills
48 #define mksh_kill(p,s) ((p) < -1 ? killpg(-(p), (s)) : kill((p), (s)))
50 /* cross fingers and hope kill is killpg-endowed */
90 * A leading ^ means declaration utility, - forwarder.
180 /* 0*/ {"-a", TO_FILAXST },
181 {"-b", TO_FILBDEV },
182 {"-c", TO_FILCDEV },
183 {"-d", TO_FILID },
184 {"-e", TO_FILEXST },
185 {"-f", TO_FILREG },
186 {"-G", TO_FILGID },
187 {"-g", TO_FILSETG },
188 {"-H", TO_FILCDF },
189 {"-h", TO_FILSYM },
190 {"-k", TO_FILSTCK },
191 {"-L", TO_FILSYM },
192 /*12*/ {"-n", TO_STNZE },
193 {"-O", TO_FILUID },
194 /*14*/ {"-o", TO_OPTION },
195 {"-p", TO_FILFIFO },
196 /*16*/ {"-r", TO_FILRD },
197 {"-S", TO_FILSOCK },
198 {"-s", TO_FILGZ },
199 {"-t", TO_FILTT },
200 /*20*/ {"-u", TO_FILSETU },
201 {"-v", TO_ISSET },
202 {"-w", TO_FILWR },
203 /*23*/ {"-x", TO_FILEX },
204 {"-z", TO_STZER },
214 {"-eq", TO_INTEQ },
215 {"-ne", TO_INTNE },
216 {"-gt", TO_INTGT },
217 {"-ge", TO_INTGE },
218 {"-lt", TO_INTLT },
219 {"-le", TO_INTLE },
220 {"-ef", TO_FILEQ },
221 {"-nt", TO_FILNT },
222 {"-ot", TO_FILOT },
244 while ((optc = ksh_getopt(wp, &builtin_opt, "LP")) != -1) in c_pwd()
339 /*- in c_print()
341 * recognise -Een if they appear in arguments with in c_print()
342 * no illegal options; e.g. echo -nq outputs '-nq' in c_print()
345 /* MidnightBSD /bin/sh needs -e supported but off */ in c_print()
350 /* otherwise compromise on -e enabled by default */ in c_print()
355 if ((s = *wp) && *s++ == '-' && *s) { in c_print()
383 while ((c = ksh_getopt(wp, &builtin_opt, opts)) != -1) in c_print()
424 bi_errorf("-u%s: %s", s, emsg); in c_print()
433 /* treat a lone "-" like "--" */ in c_print()
478 if (c == -1) { in c_print()
486 --s; in c_print()
494 po.ts[utf_wctomb(po.ts, c - 0x100)] = 0; in c_print()
524 while (w--) in c_print()
527 w = co.shf->wp - co.shf->buf; in c_print()
529 memcpy(xp, co.shf->buf, w); in c_print()
540 histsave(&source->line, Xstring(xs, xp), HIST_STORE, false); in c_print()
547 * to just check that the co-process is alive which is in c_print()
575 len -= nwritten; in c_print()
594 --s_ptr; in s_put()
603 while ((optc = ksh_getopt(wp, &builtin_opt, Tpv)) != -1) in c_whence()
620 /* note: command without -vV is dealt with in comexec() */
627 while ((optc = ksh_getopt(wp, &builtin_opt, TpVv)) != -1) in c_command()
662 if (tp && !(tp->flag & ISSET)) in do_whence()
668 switch (tp->type) { in do_whence()
676 switch (tp->type) { in do_whence()
680 (tp->flag & SPEC_BI) ? "special " : "", in do_whence()
686 if (tp->flag & EXPORT) in do_whence()
688 if (tp->flag & TRACE) in do_whence()
690 if (!(tp->flag & ISSET)) { in do_whence()
692 if (tp->u.fpath) in do_whence()
694 tp->u.fpath); in do_whence()
701 if (tp->flag & ISSET) { in do_whence()
704 if (tp->type == CTALIAS) in do_whence()
706 (tp->flag & EXPORT) ? in do_whence()
710 if (!mksh_abspath(tp->val.s)) { in do_whence()
714 size_t clen = strlen(tp->val.s) + 1; in do_whence()
718 if (mksh_cdirsep(xp[xlen - 1])) in do_whence()
719 --xlen; in do_whence()
721 memcpy(xp + xlen, tp->val.s, clen); in do_whence()
726 shf_puts(tp->val.s, shl_stdout); in do_whence()
740 (tp->flag & EXPORT) ? "exported " : "", in do_whence()
744 print_value_quoted(shl_stdout, tp->val.s); in do_whence()
752 bi_errorf(Tunexpected_type, id, Tcommand, tp->type); in do_whence()
767 case ORD('-'): in valid_alias_name()
792 while ((optc = ksh_getopt(wp, &builtin_opt, "dprtUx")) != -1) { in c_alias()
793 prefix = builtin_opt.info & GI_PLUS ? '+' : '-'; in c_alias()
797 t = NULL; /* fix "alias -dt" */ in c_alias()
840 /* "hash -r" means reset all the tracked aliases.. */ in c_alias()
843 Tunalias, "-ta", NULL in c_alias()
847 shprintf("%s: -r flag can only be used with -t" in c_alias()
859 if ((ap->flag & (ISSET|xflag)) == (ISSET|xflag)) { in c_alias()
862 print_value_quoted(shl_stdout, ap->name); in c_alias()
865 print_value_quoted(shl_stdout, ap->val.s); in c_alias()
878 strndupx(xalias, alias, val++ - alias, ATEMP); in c_alias()
889 if (ap != NULL && (ap->flag&ISSET)) { in c_alias()
892 print_value_quoted(shl_stdout, ap->name); in c_alias()
895 print_value_quoted(shl_stdout, ap->val.s); in c_alias()
905 ap->type = tflag ? CTALIAS : CALIAS; in c_alias()
908 if (ap->flag&ALLOC) { in c_alias()
909 ap->flag &= ~(ALLOC|ISSET); in c_alias()
910 afree(ap->val.s, APERM); in c_alias()
912 /* ignore values for -t (AT&T ksh does this) */ in c_alias()
917 strdupx(ap->val.s, newval, APERM); in c_alias()
918 ap->flag |= ALLOC|ISSET; in c_alias()
920 ap->flag &= ~ISSET; in c_alias()
922 ap->flag |= DEFINED; in c_alias()
924 ap->flag &= ~xflag; in c_alias()
926 ap->flag |= xflag; in c_alias()
941 while ((optc = ksh_getopt(wp, &builtin_opt, "adt")) != -1) in c_unalias()
948 /* fix "unalias -dt" */ in c_unalias()
973 if (ap->flag&ALLOC) { in c_unalias()
974 ap->flag &= ~(ALLOC|ISSET); in c_unalias()
975 afree(ap->val.s, APERM); in c_unalias()
977 ap->flag &= ~(DEFINED|ISSET|EXPORT); in c_unalias()
984 if (ap->flag&ALLOC) { in c_unalias()
985 ap->flag &= ~(ALLOC|ISSET); in c_unalias()
986 afree(ap->val.s, APERM); in c_unalias()
988 ap->flag &= ~(DEFINED|ISSET|EXPORT); in c_unalias()
1020 while ((optc = ksh_getopt(wp, &builtin_opt, "lpnz")) != -1) in c_jobs()
1033 nflag = -1; in c_jobs()
1082 ki->num_width, i, in kill_fmt_entry()
1083 ki->name_width, sigtraps[i].name, in kill_fmt_entry()
1095 /* assume old style options if -digits or -UPPERCASE */ in c_kill()
1096 if ((p = wp[1]) && *p == '-' && ctype(p[1], C_DIGIT | C_UPPER)) { in c_kill()
1101 i = (wp[2] && strcmp(wp[2], "--") == 0) ? 3 : 2; in c_kill()
1105 while ((optc = ksh_getopt(wp, &builtin_opt, "ls:")) != -1) in c_kill()
1125 shf_puts("usage:\tkill [-s signame | -signum | -signame]" in c_kill()
1127 "\tkill -l [exit_status ...]\n", shl_out); in c_kill()
1140 n -= 128; in c_kill()
1156 int j = ksh_NSIG - 1; in c_kill()
1180 print_columns(&co, (unsigned int)(ksh_NSIG - 1), in c_kill()
1188 sig = t ? t->signal : SIGTERM; in c_kill()
1245 if (e->loc->next == NULL) { in c_getopts()
1251 wp = e->loc->next->argv; in c_getopts()
1253 *--wp = e->loc->next->argv[0]; in c_getopts()
1255 /* Check that our saved state won't cause a core dump... */ in c_getopts()
1260 user_opt.p > strlen(wp[user_opt.optind - 1]))) { in c_getopts()
1274 * POSIX says var is set to ? at end-of-options, AT&T ksh in c_getopts()
1275 * sets it to null - we go with POSIX... in c_getopts()
1286 voptarg->flag &= ~RDONLY; in c_getopts()
1288 if (voptarg->flag & INTEGER) in c_getopts()
1322 while ((optc = ksh_getopt(wp, &builtin_opt, "lm")) != -1) in c_bind()
1353 struct block *l = e->loc; in c_shift()
1355 if ((l->flags & BF_RESETSPEC)) { in c_shift()
1357 l->flags &= ~BF_RESETSPEC; in c_shift()
1359 l = l->next; in c_shift()
1380 if (l->argc < n) { in c_shift()
1384 l->argv[n] = l->argv[0]; in c_shift()
1385 l->argv += n; in c_shift()
1386 l->argc -= n; in c_shift()
1398 while ((optc = ksh_getopt(wp, &builtin_opt, "S")) != -1) in c_umask()
1420 if (old_umask & (1 << (8 - (3*i + j)))) in c_umask()
1424 p[-1] = '\0'; in c_umask()
1499 case '-': in c_umask()
1552 argv[0] = e->loc->argv[0]; in c_dot()
1588 /* magic exit code: bad job-id */ in c_wait()
1612 /* to catch read -aN2 foo[i] */ in c_read()
1626 while ((c = ksh_getopt(wp, &builtin_opt, c_read_opts)) != -1) in c_read()
1642 if (c == -1) { in c_read()
1683 *--wp = TREPLY; in c_read()
1692 allocd[ccp - *wp] = '\0'; in c_read()
1756 if ((bytesread = blocking_read(fd, xp, bytesleft)) == (size_t)-1) { in c_read()
1806 if ((bytesleft -= bytesread) == 0) in c_read()
1831 --xp; in c_read()
1850 /*- in c_read()
1852 * Xstring(xs, xp) -> xp-1 = input string without trailing delim in c_read()
1865 histsave(&source->line, Xstring(xs, xp), HIST_STORE, false); in c_read()
1873 if (vp->flag & RDONLY) { in c_read()
1890 --bytesread; in c_read()
1893 while (bytesread && is_ifsws(ccp[bytesread - 1])) { in c_read()
1894 --bytesread; in c_read()
1913 --bytesleft; in c_read()
1914 --bytesread; in c_read()
1916 if (xp[-1] == '\0') { in c_read()
1917 xp[-1] = '0'; in c_read()
1918 xp[-3] = '2'; in c_read()
1945 --bytesread; in c_read()
1963 --bytesread; in c_read()
1973 --bytesread; in c_read()
1995 vq->flag |= AINDEX; in c_read()
2001 if (vq->flag & RDONLY) in c_read()
2011 vq->type = 0; in c_read()
2038 s->u.strv = wp + builtin_opt.optind; in c_eval()
2039 s->line = current_lineno; in c_eval()
2041 /*- in c_eval()
2053 * do. The following is an excerpt from SUSv4 [1003.2-2008]: in c_eval()
2064 * special built-in utility, that special built-in in c_eval()
2097 if (p->trap) { in c_trap()
2098 shf_puts("trap -- ", shl_stdout); in c_trap()
2099 print_value_quoted(shl_stdout, p->trap); in c_trap()
2100 shprintf(Tf__sN, p->name); in c_trap()
2103 } while (i--); in c_trap()
2122 warningf(true, Tbad_sig_ss, builtin_argv0, wp[-1]); in c_trap()
2138 } else if (trap_exstat != -1) in c_exitreturn()
2149 for (ep = e; ep; ep = ep->oenv) in c_exitreturn()
2150 if (STOP_RETURN(ep->type)) { in c_exitreturn()
2188 /* AT&T ksh does this for non-interactive shells only - weird */ in c_brkcont()
2195 for (ep = e; ep && !STOP_BRKCONT(ep->type); ep = ep->oenv) in c_brkcont()
2196 if (ep->type == E_LOOP) { in c_brkcont()
2197 if (--quit == 0) in c_brkcont()
2199 ep->flags |= EF_BRKCONT_PASS; in c_brkcont()
2205 * AT&T ksh doesn't print a message - just does what it in c_brkcont()
2219 last_ep->flags &= ~EF_BRKCONT_PASS; in c_brkcont()
2221 wp[0], wp[0], (unsigned int)n - quit); in c_brkcont()
2236 struct block *l = e->loc; in c_set()
2238 if ((l->flags & BF_RESETSPEC)) { in c_set()
2240 l->flags &= ~BF_RESETSPEC; in c_set()
2242 l = l->next; in c_set()
2246 static const char *args[] = { Tset, "-", NULL }; in c_set()
2256 wp += argi - 1; in c_set()
2259 wp[0] = l->argv[0]; in c_set()
2261 strdupx(*wp, *wp, &l->area); in c_set()
2262 l->argc = wp - owp - 1; in c_set()
2263 l->argv = alloc2(l->argc + 2, sizeof(char *), &l->area); in c_set()
2264 for (wp = l->argv; (*wp++ = *owp++) != NULL; ) in c_set()
2267 /*- in c_set()
2270 * set -- $(getopt ab:c "$@") in c_set()
2276 /* traditional behaviour, unless set -o posix */ in c_set()
2279 /* conformant behaviour, unless set -o sh +o posix */ in c_set()
2291 while ((optc = ksh_getopt(wp, &builtin_opt, "fv")) != -1) in c_unset()
2312 if (n > 3 && ord(id[n - 3]) == ORD('[') && in c_unset()
2313 ord(id[n - 2]) == ORD('*') && in c_unset()
2314 ord(id[n - 1]) == ORD(']')) { in c_unset()
2315 strndupx(cp, id, n - 3, ATEMP); in c_unset()
2324 if ((vp->flag&RDONLY)) { in c_unset()
2325 warningf(true, Tf_ro, vp->name); in c_unset()
2369 * time pipeline (really a statement, not a built-in command)
2384 if (t->left) { in timex()
2388 * finish while we are executing t->left), or get the in timex()
2389 * cpu usage of t->left. AT&T ksh does the former, while in timex()
2395 rv = execute(t->left, f | XTIME, xerrok); in timex()
2396 if (t->left->type == TCOM) in timex()
2397 tf |= t->left->str[0]; in timex()
2405 /* ksh93 - report shell times (shell+kids) */ in timex()
2452 while ((optc = ksh_getopt((const char **)wp, &opt, ":p")) != -1) in timex_hook()
2455 t->str[0] |= TF_POSIX; in timex_hook()
2472 t->str[0] |= TF_NOARGS; in timex_hook()
2476 /* exec with no args - args case is taken care of in comexec() */
2483 if (e->savefd != NULL) { in c_exec()
2485 if (e->savefd[i] > 0) in c_exec()
2486 close(e->savefd[i]); in c_exec()
2492 e->savefd[i]) in c_exec()
2495 e->savefd = NULL; in c_exec()
2510 while ((optc = ksh_getopt(wp, &builtin_opt, "m:")) != -1) { in c_mknod()
2580 bi_errorf("usage: mknod [-m mode] name %s", "b|c major minor"); in c_mknod()
2581 bi_errorf("usage: mknod [-m mode] name %s", "p"); in c_mknod()
2586 /*-
2588 * oexpr ::= aexpr | aexpr "-o" oexpr ;
2589 * aexpr ::= nexpr | nexpr "-a" aexpr ;
2591 * primary ::= unary-operator operand
2592 * | operand binary-operator operand
2597 * unary-operator ::= "-a"|"-b"|"-c"|"-d"|"-e"|"-f"|"-G"|"-g"|"-H"|"-h"|
2598 * "-k"|"-L"|"-n"|"-O"|"-o"|"-p"|"-r"|"-S"|"-s"|"-t"|
2599 * "-u"|"-v"|"-w"|"-x"|"-z";
2601 * binary-operator ::= "="|"=="|"!="|"<"|">"|"-eq"|"-ne"|"-gt"|"-ge"|
2602 * "-lt"|"-le"|"-ef"|"-nt"|"-ot";
2629 if (strcmp(wp[--argc], "]") != 0) { in c_test()
2640 * dumb code straight-forward from the 2008 spec, but unlike in c_test()
2644 switch (argc - 1) { in c_test()
2749 for (; tbl->op_text[0]; tbl++) in test_isop()
2750 if (sc1 == tbl->op_text[1] && !strcmp(s, tbl->op_text)) in test_isop()
2751 return (tbl->op_num); in test_isop()
2774 if (sb1->st_mtime < sb2->st_mtime) in mtimecmp()
2775 return (-1); in mtimecmp()
2776 if (sb1->st_mtime > sb2->st_mtime) in mtimecmp()
2779 if (sb1->st_mtimensec < sb2->st_mtimensec) in mtimecmp()
2780 return (-1); in mtimecmp()
2781 if (sb1->st_mtimensec > sb2->st_mtimensec) in mtimecmp()
2818 te->flags |= TEF_ERROR; in test_eval()
2834 /* -n */ in test_eval()
2838 /* -z */ in test_eval()
2842 /* -v */ in test_eval()
2844 return ((vp = isglobal(opnd1, false)) && (vp->flag & ISSET)); in test_eval()
2846 /* -o */ in test_eval()
2850 if ((k = option(opnd1)) == (size_t)-1) in test_eval()
2854 /* -r */ in test_eval()
2859 /* -w */ in test_eval()
2864 /* -x */ in test_eval()
2868 /* -a */ in test_eval()
2870 /* -e */ in test_eval()
2874 /* -f */ in test_eval()
2878 /* -d */ in test_eval()
2882 /* -c */ in test_eval()
2886 /* -b */ in test_eval()
2890 /* -p */ in test_eval()
2894 /* -h or -L */ in test_eval()
2902 /* -S */ in test_eval()
2906 /* -H => HP context dependent files (directories) */ in test_eval()
2931 /* -u */ in test_eval()
2936 /* -g */ in test_eval()
2941 /* -k */ in test_eval()
2950 /* -s */ in test_eval()
2955 /* -t */ in test_eval()
2958 te->flags |= TEF_ERROR; in test_eval()
2964 /* -O */ in test_eval()
2969 /* -G */ in test_eval()
2980 if (te->flags & TEF_DBRACKET) { in test_eval()
2989 if (te->flags & TEF_DBRACKET) { in test_eval()
3004 /* -nt */ in test_eval()
3014 /* -ot */ in test_eval()
3024 /* -ef */ in test_eval()
3036 /* -eq */ in test_eval()
3038 /* -ne */ in test_eval()
3040 /* -ge */ in test_eval()
3042 /* -gt */ in test_eval()
3044 /* -le */ in test_eval()
3046 /* -lt */ in test_eval()
3051 te->flags |= TEF_ERROR; in test_eval()
3073 (*te->error)(te, 0, "internal error: unknown op"); in test_eval()
3084 if (!(te->flags & TEF_ERROR) && !(*te->isa)(te, TM_END)) in test_parse()
3085 (*te->error)(te, 0, "unexpected operator/operand"); in test_parse()
3087 return ((te->flags & TEF_ERROR) ? T_ERR_EXIT : !rv); in test_parse()
3097 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_OR)) in test_oexpr()
3109 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_AND)) in test_aexpr()
3117 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_NOT)) in test_nexpr()
3129 if (te->flags & TEF_ERROR) in test_primary()
3131 if ((*te->isa)(te, TM_OPAREN)) { in test_primary()
3133 if (te->flags & TEF_ERROR) in test_primary()
3135 if (!(*te->isa)(te, TM_CPAREN)) { in test_primary()
3136 (*te->error)(te, 0, "missing )"); in test_primary()
3143 * so that something like test \( -f = -f \) is accepted in test_primary()
3145 if ((te->flags & TEF_DBRACKET) || (&te->pos.wp[1] < te->wp_end && in test_primary()
3146 !test_isop(TM_BINOP, te->pos.wp[1]))) { in test_primary()
3147 if ((op = (*te->isa)(te, TM_UNOP))) { in test_primary()
3149 opnd1 = (*te->getopnd)(te, op, do_eval); in test_primary()
3151 (*te->error)(te, -1, Tno_args); in test_primary()
3155 return ((*te->eval)(te, op, opnd1, NULL, do_eval)); in test_primary()
3158 opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval); in test_primary()
3160 (*te->error)(te, 0, "expression expected"); in test_primary()
3163 if ((op = (*te->isa)(te, TM_BINOP))) { in test_primary()
3165 opnd2 = (*te->getopnd)(te, op, do_eval); in test_primary()
3167 (*te->error)(te, -1, "missing second argument"); in test_primary()
3171 return ((*te->eval)(te, op, opnd1, opnd2, do_eval)); in test_primary()
3173 return ((*te->eval)(te, TO_STNZE, opnd1, NULL, do_eval)); in test_primary()
3182 * it is. Returns 0 if it is not, non-zero if it is (in the case of
3188 /* Order important - indexed by Test_meta values */ in ptest_isa()
3194 if (te->pos.wp >= te->wp_end) in ptest_isa()
3198 rv = test_isop(meta, *te->pos.wp); in ptest_isa()
3202 rv = !strcmp(*te->pos.wp, tokens[(int)meta]) ? in ptest_isa()
3207 te->pos.wp++; in ptest_isa()
3215 if (te->pos.wp >= te->wp_end) in ptest_getopnd()
3217 return (*te->pos.wp++); in ptest_getopnd()
3225 te->flags |= TEF_ERROR; in ptest_error()
3226 if ((op = te->pos.wp + ofs >= te->wp_end ? NULL : te->pos.wp[ofs])) in ptest_error()
3239 if (wp[0] && !strcmp(wp[0], "--")) in c_rename()
3240 /* skip "--" (options separator) */ in c_rename()
3264 if (wp[0] && !strcmp(wp[0], "--")) in c_realpath()
3265 /* skip "--" (options separator) */ in c_realpath()
3295 /* parse options: POSIX demands we support "-u" as no-op */ in c_cat()
3296 while ((rv = ksh_getopt(wp, &builtin_opt, Tu)) != -1) { in c_cat()
3330 MKSH_CAT_BUFSIZ)) == -1) { in c_cat()
3350 if ((w = write(1, cp, n)) != -1) { in c_cat()
3351 n -= w; in c_cat()
3399 if (wp[0] && !strcmp(wp[0], "--")) in c_sleep()
3400 /* skip "--" (options separator) */ in c_sleep()
3438 /* this will re-schedule signal delivery */ in c_sleep()