busybox: update to 1.25.0
[tomato.git] / release / src / router / busybox / shell / match.h
blobaa393ed1ab8247b803cbbb35ff11e4f167d9e472
1 /* match.h - interface to shell ##/%% matching code */
3 #ifndef SHELL_MATCH_H
4 #define SHELL_MATCH_H 1
6 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
8 //TODO! Why ash.c still uses internal version?!
10 enum {
11 SCAN_MOVE_FROM_LEFT = (1 << 0),
12 SCAN_MOVE_FROM_RIGHT = (1 << 1),
13 SCAN_MATCH_LEFT_HALF = (1 << 2),
14 SCAN_MATCH_RIGHT_HALF = (1 << 3),
17 char* FAST_FUNC scan_and_match(char *string, const char *pattern, unsigned flags);
19 static inline unsigned pick_scan(char op1, char op2)
21 unsigned scan_flags;
22 if (op1 == '#') {
23 scan_flags = SCAN_MATCH_LEFT_HALF +
24 (op1 == op2 ? SCAN_MOVE_FROM_RIGHT : SCAN_MOVE_FROM_LEFT);
25 } else { /* % */
26 scan_flags = SCAN_MATCH_RIGHT_HALF +
27 (op1 == op2 ? SCAN_MOVE_FROM_LEFT : SCAN_MOVE_FROM_RIGHT);
29 return scan_flags;
32 POP_SAVED_FUNCTION_VISIBILITY
34 #endif