[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs qe.h util.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs qe.h util.c |
Date: |
Mon, 24 Mar 2014 09:38:15 +0000 |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 14/03/24 09:38:15
Modified files:
. : qe.h util.c
Log message:
add qe_stristr utility function
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.156&r2=1.157
http://cvs.savannah.gnu.org/viewcvs/qemacs/util.c?cvsroot=qemacs&r1=1.63&r2=1.64
Patches:
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -b -r1.156 -r1.157
--- qe.h 23 Mar 2014 01:11:34 -0000 1.156
+++ qe.h 24 Mar 2014 09:38:15 -0000 1.157
@@ -327,6 +327,7 @@
}
int umemcmp(const unsigned int *s1, const unsigned int *s2, int count);
int qe_memicmp(const void *p1, const void *p2, int count);
+const char *qe_stristr(const char *s1, const char *s2);
int strsubst(char *buf, int buf_size, const char *from,
const char *s1, const char *s2);
Index: util.c
===================================================================
RCS file: /sources/qemacs/qemacs/util.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- util.c 7 Mar 2014 10:25:59 -0000 1.63
+++ util.c 24 Mar 2014 09:38:15 -0000 1.64
@@ -664,6 +664,28 @@
return 0;
}
+const char *qe_stristr(const char *s1, const char *s2)
+{
+ int c, c1, c2, len;
+
+ len = strlen(s2);
+ if (!len)
+ return s1;
+
+ c = *s2++;
+ len--;
+ c1 = qe_toupper(c);
+ c2 = qe_tolower(c);
+
+ while ((c = *s1++) != '\0') {
+ if (c == c1 || c == c2) {
+ if (!qe_memicmp(s1, s2, len))
+ return s1 - 1;
+ }
+ }
+ return NULL;
+}
+
/**
* Return TRUE if val is a prefix of str (case independent). If it
* returns TRUE, ptr is set to the next character in 'str' after the
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs qe.h util.c,
Charlie Gordon <=