aboutsummaryrefslogtreecommitdiff
path: root/src/base/string/raw/compare.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/string/raw/compare.c')
-rw-r--r--src/base/string/raw/compare.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/base/string/raw/compare.c b/src/base/string/raw/compare.c
new file mode 100644
index 0000000..05e6c66
--- /dev/null
+++ b/src/base/string/raw/compare.c
@@ -0,0 +1,18 @@
+#include <u.h>
+#include <base.h>
+
+int
+str·compare(char *l, char *r)
+{
+ int cl, cr;
+
+ for(;;){
+ cl=*l++, cr=*r++;
+ if(cl != cr)
+ return cl-cr;
+ if(!cl)
+ return 0;
+ }
+ /* unreachable */
+ return 0;
+}