Magellan Linux

Contents of /trunk/mkinitrd-magellan/busybox/shell/match.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 984 - (show annotations) (download)
Sun May 30 11:32:42 2010 UTC (13 years, 11 months ago) by niro
File MIME type: text/plain
File size: 762 byte(s)
-updated to busybox-1.16.1 and enabled blkid/uuid support in default config
1 /* match.h - interface to shell ##/%% matching code */
2
3 #ifndef SHELL_MATCH_H
4 #define SHELL_MATCH_H 1
5
6 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
7
8 //TODO! Why ash.c still uses internal version?!
9
10 typedef char *(*scan_t)(char *string, char *match, bool match_at_left);
11
12 char *scanleft(char *string, char *match, bool match_at_left);
13 char *scanright(char *string, char *match, bool match_at_left);
14
15 static 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
31 POP_SAVED_FUNCTION_VISIBILITY
32
33 #endif