summaryrefslogtreecommitdiff
path: root/release/src/router/busybox/shell/match.h
diff options
context:
space:
mode:
Diffstat (limited to 'release/src/router/busybox/shell/match.h')
-rw-r--r--release/src/router/busybox/shell/match.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/release/src/router/busybox/shell/match.h b/release/src/router/busybox/shell/match.h
new file mode 100644
index 00000000..3fc4de34
--- /dev/null
+++ b/release/src/router/busybox/shell/match.h
@@ -0,0 +1,26 @@
+/* match.h - interface to shell ##/%% matching code */
+
+PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
+
+typedef char *(*scan_t)(char *string, char *match, bool zero);
+
+char *scanleft(char *string, char *match, bool zero);
+char *scanright(char *string, char *match, bool zero);
+
+static inline scan_t pick_scan(char op1, char op2, bool *zero)
+{
+ /* # - scanleft
+ * ## - scanright
+ * % - scanright
+ * %% - scanleft
+ */
+ if (op1 == '#') {
+ *zero = true;
+ return op1 == op2 ? scanright : scanleft;
+ } else {
+ *zero = false;
+ return op1 == op2 ? scanleft : scanright;
+ }
+}
+
+POP_SAVED_FUNCTION_VISIBILITY