diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-05-11 21:23:08 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-05-11 21:23:08 +0000 |
commit | e0a3eda234a3723de4a1d0025ef3099e747aff65 (patch) | |
tree | ab48aa46a965e430b01fa5331d36d9a150d24639 /src/msdos.c | |
parent | 3b765645623611b2349f64fbb63bc0a0938bf3f0 (diff) | |
download | emacs-e0a3eda234a3723de4a1d0025ef3099e747aff65.tar.gz |
(msdos_downcase_filename): New function to convert case in filenames.
(Fmsdos_downcase_filename): New function.
(syms_of_msdos): Defsubr it.
Diffstat (limited to 'src/msdos.c')
-rw-r--r-- | src/msdos.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/msdos.c b/src/msdos.c index 626119a0c00..d71787feb4c 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2090,6 +2090,7 @@ unixtodos_filename (p) } /* Get the default directory for a given drive. 0=def, 1=A, 2=B, ... */ +void msdos_downcase_filename (unsigned char *); int getdefdir (drive, dst) @@ -2113,11 +2114,7 @@ getdefdir (drive, dst) if (errno) return 0; - /* Under LFN we expect to get pathnames in their true case. */ - if (! (_USE_LFN)) - for (p = dst; *p; p++) - if (*p >= 'A' && *p <= 'Z') - *p += 'a' - 'A'; + msdos_downcase_filename (dst); errno = e; return 1; @@ -2232,6 +2229,32 @@ DEFUN ("msdos-long-file-names", Fmsdos_long_file_names, Smsdos_long_file_names, { return (_USE_LFN ? Qt : Qnil); } + +/* Convert alphabetic characters in a filename to lower-case. */ + +void +msdos_downcase_filename (p) + register unsigned char *p; +{ + /* Under LFN we expect to get pathnames in their true case. */ + if (NILP (Fmsdos_long_file_names ())) + for ( ; *p; p++) + if (*p >= 'A' && *p <= 'Z') + *p += 'a' - 'A'; +} + +DEFUN ("msdos-downcase-filename", Fmsdos_downcase_filename, Smsdos_downcase_filename, + 1, 1, 0, + "Convert alphabetic characters in FILENAME to lower case and return that.\n\ +When long filenames are supported, doesn't change FILENAME.") + (filename) + Lisp_Object filename; +{ + char *fname = XSTRING (filename)->data; + + msdos_downcase_filename (fname); + return make_string (fname, XSTRING (filename)->size); +} /* The Emacs root directory as determined by init_environment. */ @@ -2924,6 +2947,7 @@ syms_of_msdos () defsubr (&Srecent_doskeys); defsubr (&Smsdos_long_file_names); + defsubr (&Smsdos_downcase_filename); } #endif /* MSDOS */ |