diff options
| author | Richard M. Stallman | 2001-12-18 22:50:26 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-12-18 22:50:26 +0000 |
| commit | b3f04cedf49fe13b5a88060bf4d2a41638cdb208 (patch) | |
| tree | 5e806caa04ec272cb75a490e3d06086bac424068 | |
| parent | 30de3bd61146feebd12bf888adc21afb054c4740 (diff) | |
| download | emacs-b3f04cedf49fe13b5a88060bf4d2a41638cdb208.tar.gz emacs-b3f04cedf49fe13b5a88060bf4d2a41638cdb208.zip | |
(scmp): Function moved from minibuf.c.
Delete multibyte handling--used only on encoded strings.
| -rw-r--r-- | src/dired.c | 30 |
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; | |||
| 117 | Lisp_Object Qfile_name_all_completions; | 117 | Lisp_Object Qfile_name_all_completions; |
| 118 | Lisp_Object Qfile_attributes; | 118 | Lisp_Object Qfile_attributes; |
| 119 | Lisp_Object Qfile_attributes_lessp; | 119 | Lisp_Object Qfile_attributes_lessp; |
| 120 | |||
| 121 | static int scmp P_ ((unsigned char *, unsigned char *, int)); | ||
| 120 | 122 | ||
| 121 | 123 | ||
| 122 | Lisp_Object | 124 | Lisp_Object |
| @@ -734,6 +736,34 @@ file_name_completion (file, dirname, all_flag, ver_flag) | |||
| 734 | return Fsignal (Qquit, Qnil); | 736 | return Fsignal (Qquit, Qnil); |
| 735 | } | 737 | } |
| 736 | 738 | ||
| 739 | /* Compare exactly LEN chars of strings at S1 and S2, | ||
| 740 | ignoring case if appropriate. | ||
| 741 | Return -1 if strings match, | ||
| 742 | else number of chars that match at the beginning. */ | ||
| 743 | |||
| 744 | static int | ||
| 745 | scmp (s1, s2, len) | ||
| 746 | register unsigned char *s1, *s2; | ||
| 747 | int len; | ||
| 748 | { | ||
| 749 | register int l = len; | ||
| 750 | |||
| 751 | if (completion_ignore_case) | ||
| 752 | { | ||
| 753 | while (l && DOWNCASE (*s1++) == DOWNCASE (*s2++)) | ||
| 754 | l--; | ||
| 755 | } | ||
| 756 | else | ||
| 757 | { | ||
| 758 | while (l && *s1++ == *s2++) | ||
| 759 | l--; | ||
| 760 | } | ||
| 761 | if (l == 0) | ||
| 762 | return -1; | ||
| 763 | else | ||
| 764 | return len - l; | ||
| 765 | } | ||
| 766 | |||
| 737 | static int | 767 | static int |
| 738 | file_name_completion_stat (dirname, dp, st_addr) | 768 | file_name_completion_stat (dirname, dp, st_addr) |
| 739 | Lisp_Object dirname; | 769 | Lisp_Object dirname; |