1/* match.h - interface to shell ##/%% matching code */ 2 3#ifndef SHELL_MATCH_H 4#define SHELL_MATCH_H 1 5 6PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 7 8//TODO! Why ash.c still uses internal version?! 9 10typedef char *(*scan_t)(char *string, char *match, bool match_at_left); 11 12char *scanleft(char *string, char *match, bool match_at_left); 13char *scanright(char *string, char *match, bool match_at_left); 14 15static inline scan_t pick_scan(char op1, char op2, bool *match_at_left) 16{ 17 /* # - scanleft 18 * ## - scanright 19 * % - scanright 20 * %% - scanleft 21 */ 22 if (op1 == '#') { 23 *match_at_left = true; 24 return op1 == op2 ? scanright : scanleft; 25 } else { 26 *match_at_left = false; 27 return op1 == op2 ? scanleft : scanright; 28 } 29} 30 31POP_SAVED_FUNCTION_VISIBILITY 32 33#endif 34