comparison src/nt.c @ 400:a86b2b5e0111 r21-2-30

Import from CVS: tag r21-2-30
author cvs
date Mon, 13 Aug 2007 11:14:34 +0200
parents 74fd4e045ea6
children 2f8bb876ab1d
comparison
equal deleted inserted replaced
399:376370fb5946 400:a86b2b5e0111
288 #endif 288 #endif
289 if (getenv ("SHELL") == NULL) 289 if (getenv ("SHELL") == NULL)
290 putenv ((GetVersion () & 0x80000000) ? "SHELL=command" : "SHELL=cmd"); 290 putenv ((GetVersion () & 0x80000000) ? "SHELL=command" : "SHELL=cmd");
291 291
292 /* Set dir and shell from environment variables. */ 292 /* Set dir and shell from environment variables. */
293 strcpy (the_passwd.pw_dir, get_home_directory()); 293 strcpy (the_passwd.pw_dir, (char *)get_home_directory());
294 strcpy (the_passwd.pw_shell, getenv ("SHELL")); 294 strcpy (the_passwd.pw_shell, getenv ("SHELL"));
295 } 295 }
296 296
297 /* Normalize filename by converting all path separators to 297 /* Normalize filename by converting all path separators to
298 the specified separator. Also conditionally convert upper 298 the specified separator. Also conditionally convert upper
299 case path name components to lower case. */ 299 case path name components to lower case. */
300 300
301 static void 301 static void
302 normalize_filename (fp, path_sep) 302 normalize_filename (char *fp, char path_sep)
303 REGISTER char *fp;
304 char path_sep;
305 { 303 {
306 char sep; 304 char sep;
307 char *elem; 305 char *elem;
308 306
309 /* Always lower-case drive letters a-z, even if the filesystem 307 /* Always lower-case drive letters a-z, even if the filesystem
355 } while (*fp++); 353 } while (*fp++);
356 } 354 }
357 355
358 /* Destructively turn backslashes into slashes. */ 356 /* Destructively turn backslashes into slashes. */
359 void 357 void
360 dostounix_filename (p) 358 dostounix_filename (char *p)
361 REGISTER char *p;
362 { 359 {
363 normalize_filename (p, '/'); 360 normalize_filename (p, '/');
364 } 361 }
365 362
366 /* Destructively turn slashes into backslashes. */ 363 /* Destructively turn slashes into backslashes. */
367 void 364 void
368 unixtodos_filename (p) 365 unixtodos_filename (char *p)
369 REGISTER char *p;
370 { 366 {
371 normalize_filename (p, '\\'); 367 normalize_filename (p, '\\');
372 } 368 }
373 369
374 /* Remove all CR's that are followed by a LF. 370 /* Remove all CR's that are followed by a LF.
375 (From msdos.c...probably should figure out a way to share it, 371 (From msdos.c...probably should figure out a way to share it,
376 although this code isn't going to ever change.) */ 372 although this code isn't going to ever change.) */
377 int 373 int
378 crlf_to_lf (n, buf, lf_count) 374 crlf_to_lf (int n, unsigned char *buf, unsigned *lf_count)
379 REGISTER int n;
380 REGISTER unsigned char *buf;
381 REGISTER unsigned *lf_count;
382 { 375 {
383 unsigned char *np = buf; 376 unsigned char *np = buf;
384 unsigned char *startp = buf; 377 unsigned char *startp = buf;
385 unsigned char *endp = buf + n; 378 unsigned char *endp = buf + n;
386 379
553 #endif /* 0 */ 546 #endif /* 0 */
554 547
555 #define REG_ROOT "SOFTWARE\\GNU\\XEmacs" 548 #define REG_ROOT "SOFTWARE\\GNU\\XEmacs"
556 549
557 LPBYTE 550 LPBYTE
558 nt_get_resource (key, lpdwtype) 551 nt_get_resource (char *key, LPDWORD lpdwtype)
559 char *key;
560 LPDWORD lpdwtype;
561 { 552 {
562 LPBYTE lpvalue; 553 LPBYTE lpvalue;
563 HKEY hrootkey = NULL; 554 HKEY hrootkey = NULL;
564 DWORD cbData; 555 DWORD cbData;
565 556
1477 directory of a drive or UNC volume in which case ensure there 1468 directory of a drive or UNC volume in which case ensure there
1478 is a trailing separator. */ 1469 is a trailing separator. */
1479 len = strlen (name); 1470 len = strlen (name);
1480 rootdir = (path >= name + len - 1 1471 rootdir = (path >= name + len - 1
1481 && (IS_DIRECTORY_SEP (*path) || *path == 0)); 1472 && (IS_DIRECTORY_SEP (*path) || *path == 0));
1482 name = strcpy (alloca (len + 2), name); 1473 name = strcpy ((char *)alloca (len + 2), name);
1483 1474
1484 if (rootdir) 1475 if (rootdir)
1485 { 1476 {
1486 if (!IS_DIRECTORY_SEP (name[len-1])) 1477 if (!IS_DIRECTORY_SEP (name[len-1]))
1487 strcat (name, "\\"); 1478 strcat (name, "\\");
2032 2023
2033 file_base = MapViewOfFile (file_mapping, FILE_MAP_READ, 0, 0, size); 2024 file_base = MapViewOfFile (file_mapping, FILE_MAP_READ, 0, 0, size);
2034 if (file_base == 0) 2025 if (file_base == 0)
2035 return FALSE; 2026 return FALSE;
2036 2027
2037 p_file->name = (char*)filename; 2028 p_file->name = (char *)filename;
2038 p_file->size = size; 2029 p_file->size = size;
2039 p_file->file = file; 2030 p_file->file = file;
2040 p_file->file_mapping = file_mapping; 2031 p_file->file_mapping = file_mapping;
2041 p_file->file_base = file_base; 2032 p_file->file_base = (char *)file_base;
2042 2033
2043 return TRUE; 2034 return TRUE;
2044 } 2035 }
2045 2036
2046 /* Close the system structures associated with the given file. */ 2037 /* Close the system structures associated with the given file. */