Mercurial > hg > xemacs-beta
comparison src/nt.c @ 239:41f2f0e326e9 r20-5b18
Import from CVS: tag r20-5b18
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:15:48 +0200 |
parents | 2c611d1463a6 |
children | 727739f917cb |
comparison
equal
deleted
inserted
replaced
238:b5f2e56b938d | 239:41f2f0e326e9 |
---|---|
36 | 36 |
37 /* must include CRT headers *before* config.h */ | 37 /* must include CRT headers *before* config.h */ |
38 #include "config.h" | 38 #include "config.h" |
39 #include "systime.h" | 39 #include "systime.h" |
40 #include "syssignal.h" | 40 #include "syssignal.h" |
41 #include "sysproc.h" | |
41 | 42 |
42 #undef access | 43 #undef access |
43 #undef chdir | 44 #undef chdir |
44 #undef chmod | 45 #undef chmod |
45 #undef creat | 46 #undef creat |
296 strcpy (the_passwd.pw_dir, getenv ("HOME")); | 297 strcpy (the_passwd.pw_dir, getenv ("HOME")); |
297 strcpy (the_passwd.pw_shell, getenv ("SHELL")); | 298 strcpy (the_passwd.pw_shell, getenv ("SHELL")); |
298 | 299 |
299 if (token) | 300 if (token) |
300 CloseHandle (token); | 301 CloseHandle (token); |
301 } | |
302 | |
303 int | |
304 random () | |
305 { | |
306 /* rand () on NT gives us 15 random bits...hack together 30 bits. */ | |
307 return ((rand () << 15) | rand ()); | |
308 } | |
309 | |
310 void | |
311 srandom (int seed) | |
312 { | |
313 srand (seed); | |
314 } | 302 } |
315 | 303 |
316 /* Normalize filename by converting all path separators to | 304 /* Normalize filename by converting all path separators to |
317 the specified separator. Also conditionally convert upper | 305 the specified separator. Also conditionally convert upper |
318 case path name components to lower case. */ | 306 case path name components to lower case. */ |
555 } | 543 } |
556 | 544 |
557 | 545 |
558 /* Routines that are no-ops on NT but are defined to get Emacs to compile. */ | 546 /* Routines that are no-ops on NT but are defined to get Emacs to compile. */ |
559 | 547 |
560 int | 548 #if 0 /* #### We do not need those, do we? -kkm */ |
561 setpgrp (int pid, int gid) | |
562 { | |
563 return 0; | |
564 } | |
565 | |
566 | |
567 int | 549 int |
568 unrequest_sigio (void) | 550 unrequest_sigio (void) |
569 { | 551 { |
570 return 0; | 552 return 0; |
571 } | 553 } |
573 int | 555 int |
574 request_sigio (void) | 556 request_sigio (void) |
575 { | 557 { |
576 return 0; | 558 return 0; |
577 } | 559 } |
560 #endif /* 0 */ | |
578 | 561 |
579 #define REG_ROOT "SOFTWARE\\GNU\\XEmacs" | 562 #define REG_ROOT "SOFTWARE\\GNU\\XEmacs" |
580 | 563 |
581 LPBYTE | 564 LPBYTE |
582 nt_get_resource (key, lpdwtype) | 565 nt_get_resource (key, lpdwtype) |
826 sys_sleep (int seconds) | 809 sys_sleep (int seconds) |
827 { | 810 { |
828 Sleep (seconds * 1000); | 811 Sleep (seconds * 1000); |
829 } | 812 } |
830 #endif | 813 #endif |
814 | |
815 /* #### This is an evil dirty hack. We must get rid of it. | |
816 Word "munging" is not in XEmacs lexicon. - kkm */ | |
831 | 817 |
832 /* Internal MSVC data and functions for low-level descriptor munging */ | 818 /* Internal MSVC data and functions for low-level descriptor munging */ |
833 #if (_MSC_VER == 900) | 819 #if (_MSC_VER == 900) |
834 extern char _osfile[]; | 820 extern char _osfile[]; |
835 #endif | 821 #endif |
1445 } | 1431 } |
1446 | 1432 |
1447 int | 1433 int |
1448 sys_open (const char * path, int oflag, int mode) | 1434 sys_open (const char * path, int oflag, int mode) |
1449 { | 1435 { |
1450 int fd; | 1436 int fd; |
1451 | 1437 |
1452 /* Force all file handles to be non-inheritable. */ | 1438 /* Force all file handles to be non-inheritable. */ |
1453 fd = _open (map_win32_filename (path, NULL), oflag | _O_NOINHERIT, mode); | 1439 fd = _open (map_win32_filename (path, NULL), oflag | _O_NOINHERIT, mode); |
1440 | |
1441 if (fd >= MAXDESC) | |
1442 { | |
1443 _close (fd); | |
1444 errno = EMFILE; | |
1445 return -1; | |
1446 } | |
1447 | |
1454 if (fd >= 0) | 1448 if (fd >= 0) |
1455 { | 1449 { |
1456 fd_info[fd].cp = 0; | 1450 fd_info[fd].cp = 0; |
1457 } | 1451 } |
1458 return (fd); | 1452 return (fd); |