aboutsummaryrefslogtreecommitdiff
path: root/shell/shell_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/shell_common.c')
-rw-r--r--shell/shell_common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 1eca101b9..e5c2cefb3 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -22,6 +22,25 @@
22const char defifsvar[] ALIGN1 = "IFS= \t\n"; 22const char defifsvar[] ALIGN1 = "IFS= \t\n";
23const char defoptindvar[] ALIGN1 = "OPTIND=1"; 23const char defoptindvar[] ALIGN1 = "OPTIND=1";
24 24
25/* Compare two strings up to the first '=' or '\0'. */
26int FAST_FUNC varcmp(const char *p, const char *q)
27{
28 int c, d;
29
30 while ((c = *p) == (d = *q)) {
31 if (c == '\0' || c == '=')
32 goto out;
33 p++;
34 q++;
35 }
36 if (c == '=')
37 c = '\0';
38 if (d == '=')
39 d = '\0';
40 out:
41 return c - d;
42}
43
25/* read builtin */ 44/* read builtin */
26 45
27/* Needs to be interruptible: shell must handle traps and shell-special signals 46/* Needs to be interruptible: shell must handle traps and shell-special signals