which might compile a new regexp until we're done with the loop! */
/* Do this opendir after anything which might signal an error.
- NOTE: the above comment is old; previosly, there was no
+ NOTE: the above comment is old; previously, there was no
unwind-protection in case of error, but now there is. */
d = opendir ((char *) XSTRING_DATA (dirname));
if (!d)
while (1)
{
DIRENTRY *dp = readdir (d);
- Lisp_Object name;
int len;
if (!dp)
continue;
}
- if (!NILP (full))
- name = concat2 (dirname, make_ext_string ((Bufbyte *)dp->d_name,
- len, FORMAT_FILENAME));
- else
- name = make_ext_string ((Bufbyte *)dp->d_name,
- len, FORMAT_FILENAME);
+ {
+ Lisp_Object name =
+ make_ext_string ((Bufbyte *)dp->d_name, len, FORMAT_FILENAME);
+ if (!NILP (full))
+ name = concat2 (dirname, name);
- list = Fcons (name, list);
+ list = Fcons (name, list);
+ }
}
}
unbind_to (speccount, Qnil); /* This will close the dir */
- if (!NILP (nosort))
- RETURN_UNGCPRO (list);
- else
- RETURN_UNGCPRO (Fsort (Fnreverse (list), Qstring_lessp));
+ if (NILP (nosort))
+ list = Fsort (Fnreverse (list), Qstring_lessp);
+
+ RETURN_UNGCPRO (list);
}
\f
static Lisp_Object file_name_completion (Lisp_Object file,
dp = readdir (d);
if (!dp) break;
- /* #### This is a bad idea, because d_name can contain
- control characters, which can make XEmacs crash. This
- should be handled properly with FORMAT_FILENAME. */
+ /* Cast to Bufbyte* is OK, as readdir() Mule-encapsulates. */
d_name = (Bufbyte *) dp->d_name;
len = NAMLEN (dp);
cclen = bytecount_to_charcount (d_name, len);
}
\f
+
+/* The *pwent() functions do not exist on NT */
+#ifndef WINDOWSNT
+
static Lisp_Object user_name_completion (Lisp_Object user,
int all_flag,
int *uniq);
for (i = 0; i < user_cache_len; i++)
{
- Bytecount len;
+ Bufbyte *d_name = (Bufbyte *) user_cache[i];
+ Bytecount len = strlen ((char *) d_name);
/* scmp() works in chars, not bytes, so we have to compute this: */
- Charcount cclen;
- Bufbyte *d_name;
-
- d_name = (Bufbyte *) user_cache[i];
- len = strlen (d_name);
- cclen = bytecount_to_charcount (d_name, len);
+ Charcount cclen = bytecount_to_charcount (d_name, len);
QUIT;
return Qt;
return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize));
}
+#endif /* ! defined WINDOWSNT */
\f
Lisp_Object
make_directory_hash_table (CONST char *path)
{
DIR *d;
- Lisp_Object hash = make_lisp_hashtable (100, HASHTABLE_NONWEAK,
- HASHTABLE_EQUAL);
+ Lisp_Object hash =
+ make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL);
if ((d = opendir (path)))
{
DIRENTRY *dp;
{
Bytecount len = NAMLEN (dp);
if (DIRENTRY_NONEMPTY (dp))
- Fputhash (make_ext_string ((Bufbyte *) dp->d_name, len,
- FORMAT_FILENAME), Qt, hash);
+ /* Cast to Bufbyte* is OK, as readdir() Mule-encapsulates. */
+ Fputhash (make_string ((Bufbyte *) dp->d_name, len), Qt, hash);
}
closedir (d);
}
DEFSUBR (Fdirectory_files);
DEFSUBR (Ffile_name_completion);
DEFSUBR (Ffile_name_all_completions);
+#ifndef WINDOWSNT
DEFSUBR (Fuser_name_completion);
DEFSUBR (Fuser_name_completion_1);
DEFSUBR (Fuser_name_all_completions);
+#endif
DEFSUBR (Ffile_attributes);
}
*/ );
Vcompletion_ignored_extensions = Qnil;
+#ifndef WINDOWSNT
user_cache = NULL;
user_cache_len = 0;
user_cache_max = 0;
+#endif
}