source: MondoRescue/branches/3.2/mindi-busybox/shell/match.h

Last change on this file was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
  • 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.