Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
e23f810c
Commit
e23f810c
authored
Aug 06, 1998
by
Kenichi Handa
Browse files
(Fdirectory_files): If MATCH is non-nil, decode filenames
before checking them against MATCH.
parent
d86ad277
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
src/dired.c
src/dired.c
+21
-18
No files found.
src/dired.c
View file @
e23f810c
...
...
@@ -187,13 +187,13 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\
report_file_error
(
"Opening directory"
,
Fcons
(
directory
,
Qnil
));
list
=
Qnil
;
dirnamelen
=
STRING_BYTES
(
XSTRING
(
encoded_
directory
));
dirnamelen
=
STRING_BYTES
(
XSTRING
(
directory
));
re_match_object
=
Qt
;
/* Decide whether we need to add a directory separator. */
#ifndef VMS
if
(
dirnamelen
==
0
||
!
IS_ANY_SEP
(
XSTRING
(
encoded_
directory
)
->
data
[
dirnamelen
-
1
]))
||
!
IS_ANY_SEP
(
XSTRING
(
directory
)
->
data
[
dirnamelen
-
1
]))
needsep
=
1
;
#endif
/* not VMS */
...
...
@@ -203,38 +203,41 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\
while
(
1
)
{
DIRENTRY
*
dp
=
readdir
(
d
);
int
len
;
if
(
!
dp
)
break
;
len
=
NAMLEN
(
dp
);
if
(
DIRENTRY_NONEMPTY
(
dp
))
{
int
len
;
len
=
NAMLEN
(
dp
);
name
=
DECODE_FILE
(
make_string
(
dp
->
d_name
,
len
));
len
=
STRING_BYTES
(
XSTRING
(
name
));
if
(
NILP
(
match
)
||
(
0
<=
re_search
(
bufp
,
dp
->
d_name
,
len
,
0
,
len
,
0
)))
||
(
0
<=
re_search
(
bufp
,
XSTRING
(
name
)
->
data
,
len
,
0
,
len
,
0
)))
{
if
(
!
NILP
(
full
))
{
int
afterdirindex
=
dirnamelen
;
int
total
=
len
+
dirnamelen
;
int
nchars
;
Lisp_Object
fullname
;
name
=
make_uninit_multibyte_string
(
total
+
needsep
,
total
+
needsep
);
bcopy
(
XSTRING
(
encoded_
directory
)
->
data
,
XSTRING
(
name
)
->
data
,
full
name
=
make_uninit_multibyte_string
(
total
+
needsep
,
total
+
needsep
);
bcopy
(
XSTRING
(
directory
)
->
data
,
XSTRING
(
full
name
)
->
data
,
dirnamelen
);
if
(
needsep
)
XSTRING
(
name
)
->
data
[
afterdirindex
++
]
=
DIRECTORY_SEP
;
bcopy
(
dp
->
d_name
,
XSTRING
(
name
)
->
data
+
afterdirindex
,
len
);
nchars
=
chars_in_text
(
XSTRING
(
name
)
->
data
,
XSTRING
(
full
name
)
->
data
[
afterdirindex
++
]
=
DIRECTORY_SEP
;
bcopy
(
XSTRING
(
name
)
->
data
,
XSTRING
(
full
name
)
->
data
+
afterdirindex
,
len
);
nchars
=
chars_in_text
(
XSTRING
(
full
name
)
->
data
,
afterdirindex
+
len
);
XSTRING
(
name
)
->
size
=
nchars
;
if
(
nchars
==
STRING_BYTES
(
XSTRING
(
name
)))
SET_STRING_BYTES
(
XSTRING
(
name
),
-
1
);
XSTRING
(
fullname
)
->
size
=
nchars
;
if
(
nchars
==
STRING_BYTES
(
XSTRING
(
fullname
)))
SET_STRING_BYTES
(
XSTRING
(
fullname
),
-
1
);
name
=
fullname
;
}
else
name
=
make_string
(
dp
->
d_name
,
len
);
name
=
DECODE_FILE
(
name
);
list
=
Fcons
(
name
,
list
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment