source: MondoRescue/branches/2.2.9/mindi-busybox/shell/match.h@ 3320

Last change on this file since 3320 was 3320, checked in by Bruno Cornec, 9 years ago
  • Re-add (thanks git BTW) the 2.2.9 branch which had been destroyed in the move to 3.0
  • Property svn:eol-style set to native
File size: 806 bytes
Line 
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
10enum {
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),
15};
16
17char* FAST_FUNC scan_and_match(char *string, const char *pattern, unsigned flags);
18
19static inline unsigned pick_scan(char op1, char op2)
20{
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);
28 }
29 return scan_flags;
30}
31
32POP_SAVED_FUNCTION_VISIBILITY
33
34#endif
Note: See TracBrowser for help on using the repository browser.