comparison src/msdos.c @ 15219:a800d1a0f07e

(msdos_downcase_filename): New function to convert case in filenames. (Fmsdos_downcase_filename): New function. (syms_of_msdos): Defsubr it.
author Richard M. Stallman <rms@gnu.org>
date Sat, 11 May 1996 21:23:08 +0000
parents 242bddc25e5a
children cc264dd966cd
comparison
equal deleted inserted replaced
15218:12a9c8b48830 15219:a800d1a0f07e
2088 p++; 2088 p++;
2089 } 2089 }
2090 } 2090 }
2091 2091
2092 /* Get the default directory for a given drive. 0=def, 1=A, 2=B, ... */ 2092 /* Get the default directory for a given drive. 0=def, 1=A, 2=B, ... */
2093 void msdos_downcase_filename (unsigned char *);
2093 2094
2094 int 2095 int
2095 getdefdir (drive, dst) 2096 getdefdir (drive, dst)
2096 int drive; 2097 int drive;
2097 char *dst; 2098 char *dst;
2111 errno = 0; 2112 errno = 0;
2112 _fixpath (in_path, dst); 2113 _fixpath (in_path, dst);
2113 if (errno) 2114 if (errno)
2114 return 0; 2115 return 0;
2115 2116
2116 /* Under LFN we expect to get pathnames in their true case. */ 2117 msdos_downcase_filename (dst);
2117 if (! (_USE_LFN))
2118 for (p = dst; *p; p++)
2119 if (*p >= 'A' && *p <= 'Z')
2120 *p += 'a' - 'A';
2121 2118
2122 errno = e; 2119 errno = e;
2123 return 1; 2120 return 1;
2124 } 2121 }
2125 2122
2229 0, 0, 0, 2226 0, 0, 0,
2230 "Return non-nil if long file names are supported on MSDOS.") 2227 "Return non-nil if long file names are supported on MSDOS.")
2231 () 2228 ()
2232 { 2229 {
2233 return (_USE_LFN ? Qt : Qnil); 2230 return (_USE_LFN ? Qt : Qnil);
2231 }
2232
2233 /* Convert alphabetic characters in a filename to lower-case. */
2234
2235 void
2236 msdos_downcase_filename (p)
2237 register unsigned char *p;
2238 {
2239 /* Under LFN we expect to get pathnames in their true case. */
2240 if (NILP (Fmsdos_long_file_names ()))
2241 for ( ; *p; p++)
2242 if (*p >= 'A' && *p <= 'Z')
2243 *p += 'a' - 'A';
2244 }
2245
2246 DEFUN ("msdos-downcase-filename", Fmsdos_downcase_filename, Smsdos_downcase_filename,
2247 1, 1, 0,
2248 "Convert alphabetic characters in FILENAME to lower case and return that.\n\
2249 When long filenames are supported, doesn't change FILENAME.")
2250 (filename)
2251 Lisp_Object filename;
2252 {
2253 char *fname = XSTRING (filename)->data;
2254
2255 msdos_downcase_filename (fname);
2256 return make_string (fname, XSTRING (filename)->size);
2234 } 2257 }
2235 2258
2236 /* The Emacs root directory as determined by init_environment. */ 2259 /* The Emacs root directory as determined by init_environment. */
2237 2260
2238 static char emacsroot[MAXPATHLEN]; 2261 static char emacsroot[MAXPATHLEN];
2922 recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil); 2945 recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil);
2923 staticpro (&recent_doskeys); 2946 staticpro (&recent_doskeys);
2924 2947
2925 defsubr (&Srecent_doskeys); 2948 defsubr (&Srecent_doskeys);
2926 defsubr (&Smsdos_long_file_names); 2949 defsubr (&Smsdos_long_file_names);
2950 defsubr (&Smsdos_downcase_filename);
2927 } 2951 }
2928 2952
2929 #endif /* MSDOS */ 2953 #endif /* MSDOS */