2009-04-07 11:33:22 +05:30
|
|
|
/* match.h - interface to shell ##/%% matching code */
|
|
|
|
|
2009-04-09 18:05:13 +05:30
|
|
|
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
|
|
|
|
|
2009-04-07 11:33:22 +05:30
|
|
|
typedef char *(*scan_t)(char *string, char *match, bool zero);
|
|
|
|
|
|
|
|
char *scanleft(char *string, char *match, bool zero);
|
|
|
|
char *scanright(char *string, char *match, bool zero);
|
|
|
|
|
|
|
|
static inline scan_t pick_scan(char op1, char op2, bool *zero)
|
|
|
|
{
|
|
|
|
/* # - scanleft
|
|
|
|
* ## - scanright
|
|
|
|
* % - scanright
|
|
|
|
* %% - scanleft
|
|
|
|
*/
|
|
|
|
if (op1 == '#') {
|
|
|
|
*zero = true;
|
|
|
|
return op1 == op2 ? scanright : scanleft;
|
|
|
|
} else {
|
|
|
|
*zero = false;
|
|
|
|
return op1 == op2 ? scanleft : scanright;
|
|
|
|
}
|
|
|
|
}
|
2009-04-09 18:05:13 +05:30
|
|
|
|
|
|
|
POP_SAVED_FUNCTION_VISIBILITY
|