diff --git a/edit.c b/edit.c index 456a4c7..48149c0 100644 --- a/edit.c +++ b/edit.c @@ -1,4 +1,4 @@ -/** $MirOS: src/bin/mksh/edit.c,v 1.1 2005/05/23 03:06:06 tg Exp $ */ +/** $MirOS: src/bin/mksh/edit.c,v 1.2 2005/05/23 15:18:15 tg Exp $ */ /* $OpenBSD: edit.c,v 1.29 2005/04/13 02:33:08 deraadt Exp $ */ /* $OpenBSD: edit.h,v 1.8 2005/03/28 21:28:22 deraadt Exp $ */ /* $OpenBSD: emacs.c,v 1.37 2005/03/30 17:16:37 deraadt Exp $ */ @@ -10,7 +10,7 @@ #include #include -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.1 2005/05/23 03:06:06 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.2 2005/05/23 15:18:15 tg Exp $"); #define BEL 0x07 @@ -792,7 +792,7 @@ glob_table(const char *pat, XPtrV *wp, struct table *tp) struct tbl *te; for (twalk(&ts, tp); (te = tnext(&ts)); ) { - if (gmatch(te->name, pat, false)) + if (gmatchx(te->name, pat, false)) XPput(*wp, str_save(te->name, ATEMP)); } } diff --git a/eval.c b/eval.c index 5e908f7..5f76c53 100644 --- a/eval.c +++ b/eval.c @@ -1,4 +1,4 @@ -/** $MirOS: src/bin/mksh/eval.c,v 1.1 2005/05/23 03:06:06 tg Exp $ */ +/** $MirOS: src/bin/mksh/eval.c,v 1.2 2005/05/23 15:18:15 tg Exp $ */ /* $OpenBSD: eval.c,v 1.27 2005/03/30 17:16:37 deraadt Exp $ */ #include "sh.h" @@ -6,7 +6,7 @@ #include #include -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.1 2005/05/23 03:06:06 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.2 2005/05/23 15:18:15 tg Exp $"); /* * string expansion @@ -881,7 +881,7 @@ trimsub(char *str, char *pat, int how) case '#': /* shortest at beginning */ for (p = str; p <= end; p++) { c = *p; *p = '\0'; - if (gmatch(str, pat, false)) { + if (gmatchx(str, pat, false)) { *p = c; return p; } @@ -891,7 +891,7 @@ trimsub(char *str, char *pat, int how) case '#'|0x80: /* longest match at beginning */ for (p = end; p >= str; p--) { c = *p; *p = '\0'; - if (gmatch(str, pat, false)) { + if (gmatchx(str, pat, false)) { *p = c; return p; } @@ -900,13 +900,13 @@ trimsub(char *str, char *pat, int how) break; case '%': /* shortest match at end */ for (p = end; p >= str; p--) { - if (gmatch(p, pat, false)) + if (gmatchx(p, pat, false)) return str_nsave(str, p - str, ATEMP); } break; case '%'|0x80: /* longest match at end */ for (p = str; p <= end; p++) { - if (gmatch(p, pat, false)) + if (gmatchx(p, pat, false)) return str_nsave(str, p - str, ATEMP); } break; @@ -1061,7 +1061,7 @@ globit(XString *xs, /* dest string */ (name[1] == 0 || (name[1] == '.' && name[2] == 0))) continue; /* always ignore . and .. */ if ((*name == '.' && *sp != '.') || - !gmatch(name, sp, true)) + !gmatchx(name, sp, true)) continue; len = strlen(d->d_name) + 1; diff --git a/exec.c b/exec.c index f6d1b7e..851ddd1 100644 --- a/exec.c +++ b/exec.c @@ -1,11 +1,11 @@ -/** $MirOS: src/bin/mksh/exec.c,v 1.1 2005/05/23 03:06:07 tg Exp $ */ +/** $MirOS: src/bin/mksh/exec.c,v 1.2 2005/05/23 15:18:16 tg Exp $ */ /* $OpenBSD: exec.c,v 1.41 2005/03/30 17:16:37 deraadt Exp $ */ #include "sh.h" #include #include -__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.1 2005/05/23 03:06:07 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.2 2005/05/23 15:18:16 tg Exp $"); static int comexec(struct op *, struct tbl *volatile, char **, int volatile); @@ -319,7 +319,7 @@ execute(struct op *volatile t, for (t = t->left; t != NULL && t->type == TPAT; t = t->right) for (ap = t->vars; *ap; ap++) if ((s = evalstr(*ap, DOTILDE|DOPAT)) && - gmatch(cp, s, false)) + gmatchx(cp, s, false)) goto Found; break; Found: diff --git a/funcs.c b/funcs.c index 647335c..6517f25 100644 --- a/funcs.c +++ b/funcs.c @@ -1,4 +1,4 @@ -/** $MirOS: src/bin/mksh/funcs.c,v 1.2 2005/05/23 14:19:13 tg Exp $ */ +/** $MirOS: src/bin/mksh/funcs.c,v 1.3 2005/05/23 15:18:16 tg Exp $ */ /* $OpenBSD: c_ksh.c,v 1.27 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: c_sh.c,v 1.29 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: c_test.c,v 1.17 2005/03/30 17:16:37 deraadt Exp $ */ @@ -13,7 +13,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.2 2005/05/23 14:19:13 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.3 2005/05/23 15:18:16 tg Exp $"); int c_cd(char **wp) @@ -2515,11 +2515,11 @@ test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, */ case TO_STEQL: /* = */ if (te->flags & TEF_DBRACKET) - return gmatch(opnd1, opnd2, false); + return gmatchx(opnd1, opnd2, false); return strcmp(opnd1, opnd2) == 0; case TO_STNEQ: /* != */ if (te->flags & TEF_DBRACKET) - return !gmatch(opnd1, opnd2, false); + return !gmatchx(opnd1, opnd2, false); return strcmp(opnd1, opnd2) != 0; case TO_STLT: /* < */ return strcmp(opnd1, opnd2) < 0; diff --git a/misc.c b/misc.c index 1365648..6ae8ad0 100644 --- a/misc.c +++ b/misc.c @@ -1,4 +1,4 @@ -/** $MirOS: src/bin/mksh/misc.c,v 1.1 2005/05/23 03:06:08 tg Exp $ */ +/** $MirOS: src/bin/mksh/misc.c,v 1.2 2005/05/23 15:18:16 tg Exp $ */ /* $OpenBSD: misc.c,v 1.28 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */ @@ -7,7 +7,7 @@ #include /* for MAXPATHLEN */ #include -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.1 2005/05/23 03:06:08 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.2 2005/05/23 15:18:16 tg Exp $"); short chtypes[UCHAR_MAX+1]; /* type bits for unsigned char */ @@ -471,7 +471,7 @@ bi_getn(const char *as, int *ai) */ int -gmatch(const char *s, const char *p, int isfile) +gmatchx(const char *s, const char *p, int isfile) { const char *se, *pe; diff --git a/sh.h b/sh.h index d4b74b7..87aa6e1 100644 --- a/sh.h +++ b/sh.h @@ -1,4 +1,4 @@ -/** $MirOS: src/bin/mksh/sh.h,v 1.2 2005/05/23 14:19:14 tg Exp $ */ +/** $MirOS: src/bin/mksh/sh.h,v 1.3 2005/05/23 15:18:17 tg Exp $ */ /* $OpenBSD: sh.h,v 1.27 2005/03/28 21:33:04 deraadt Exp $ */ /* $OpenBSD: shf.h,v 1.5 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */ @@ -256,6 +256,10 @@ struct temp { #define shl_out (&shf_iob[2]) EXTERN int shl_stdout_ok; +#ifdef __sun__ +typedef void (*sig_t)(int); +#endif + /* * trap handlers */ @@ -1175,7 +1179,7 @@ void change_flag(enum sh_flag, int, int); int parse_args(char **, int, int *); int getn(const char *, int *); int bi_getn(const char *, int *); -int gmatch(const char *, const char *, int); +int gmatchx(const char *, const char *, int); int has_globbing(const char *, const char *); const unsigned char *pat_scan(const unsigned char *, const unsigned char *, int);