summaryrefslogtreecommitdiff
path: root/src/dired.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2001-12-18 22:50:26 +0000
committerRichard M. Stallman <rms@gnu.org>2001-12-18 22:50:26 +0000
commitb3f04cedf49fe13b5a88060bf4d2a41638cdb208 (patch)
tree5e806caa04ec272cb75a490e3d06086bac424068 /src/dired.c
parent30de3bd61146feebd12bf888adc21afb054c4740 (diff)
downloademacs-b3f04cedf49fe13b5a88060bf4d2a41638cdb208.tar.gz
(scmp): Function moved from minibuf.c.
Delete multibyte handling--used only on encoded strings.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/dired.c b/src/dired.c
index fe1d8098c77..d21cb65c9d3 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -117,6 +117,8 @@ Lisp_Object Qfile_name_completion;
Lisp_Object Qfile_name_all_completions;
Lisp_Object Qfile_attributes;
Lisp_Object Qfile_attributes_lessp;
+
+static int scmp P_ ((unsigned char *, unsigned char *, int));
Lisp_Object
@@ -734,6 +736,34 @@ file_name_completion (file, dirname, all_flag, ver_flag)
return Fsignal (Qquit, Qnil);
}
+/* Compare exactly LEN chars of strings at S1 and S2,
+ ignoring case if appropriate.
+ Return -1 if strings match,
+ else number of chars that match at the beginning. */
+
+static int
+scmp (s1, s2, len)
+ register unsigned char *s1, *s2;
+ int len;
+{
+ register int l = len;
+
+ if (completion_ignore_case)
+ {
+ while (l && DOWNCASE (*s1++) == DOWNCASE (*s2++))
+ l--;
+ }
+ else
+ {
+ while (l && *s1++ == *s2++)
+ l--;
+ }
+ if (l == 0)
+ return -1;
+ else
+ return len - l;
+}
+
static int
file_name_completion_stat (dirname, dp, st_addr)
Lisp_Object dirname;