blob: 3fc4de340c7f53996bad658d6d10b97f6a0ff222 [file] [log] [blame]
Mike Frysingera4f331d2009-04-07 06:03:22 +00001/* match.h - interface to shell ##/%% matching code */
2
Denis Vlasenkof81e8db2009-04-09 12:35:13 +00003PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
4
Mike Frysingera4f331d2009-04-07 06:03:22 +00005typedef char *(*scan_t)(char *string, char *match, bool zero);
6
7char *scanleft(char *string, char *match, bool zero);
8char *scanright(char *string, char *match, bool zero);
9
10static inline scan_t pick_scan(char op1, char op2, bool *zero)
11{
12 /* # - scanleft
13 * ## - scanright
14 * % - scanright
15 * %% - scanleft
16 */
17 if (op1 == '#') {
18 *zero = true;
19 return op1 == op2 ? scanright : scanleft;
20 } else {
21 *zero = false;
22 return op1 == op2 ? scanleft : scanright;
23 }
24}
Denis Vlasenkof81e8db2009-04-09 12:35:13 +000025
26POP_SAVED_FUNCTION_VISIBILITY