Mercurial > hg > xemacs-beta
comparison src/ntproc.c @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | de805c49cfc1 |
children | da8ed4261e83 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
22 Adapted from alarm.c by Tim Fleehart */ | 22 Adapted from alarm.c by Tim Fleehart */ |
23 | 23 |
24 /* Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> */ | 24 /* Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> */ |
25 /* Synced with FSF Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> */ | 25 /* Synced with FSF Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> */ |
26 | 26 |
27 #include <stdio.h> | |
28 #include <stdlib.h> | |
29 #include <errno.h> | |
30 #include <io.h> | |
31 #include <fcntl.h> | |
32 #include <signal.h> | |
33 | |
34 /* must include CRT headers *before* config.h */ | |
35 /* ### I don't believe it - martin */ | |
27 #include <config.h> | 36 #include <config.h> |
28 #undef signal | 37 #undef signal |
29 #undef wait | 38 #undef wait |
30 #undef spawnve | 39 #undef spawnve |
31 #undef select | 40 #undef select |
32 #undef kill | 41 #undef kill |
33 | 42 |
34 #include <windows.h> | 43 #include <windows.h> |
44 #include <sys/socket.h> | |
35 #ifdef HAVE_A_OUT_H | 45 #ifdef HAVE_A_OUT_H |
36 #include <a.out.h> | 46 #include <a.out.h> |
37 #endif | 47 #endif |
38 #include "lisp.h" | 48 #include "lisp.h" |
39 #include "sysproc.h" | 49 #include "sysproc.h" |
43 #include "syssignal.h" | 53 #include "syssignal.h" |
44 #include "sysfile.h" | 54 #include "sysfile.h" |
45 #include "syswait.h" | 55 #include "syswait.h" |
46 #include "buffer.h" | 56 #include "buffer.h" |
47 #include "process.h" | 57 #include "process.h" |
48 | |
49 #include "console-msw.h" | |
50 | |
51 /*#include "w32term.h"*/ /* From 19.34.6: sync in ? --marcpa */ | 58 /*#include "w32term.h"*/ /* From 19.34.6: sync in ? --marcpa */ |
52 | 59 |
53 /* #### I'm not going to play with shit. */ | 60 /* #### I'm not going to play with shit. */ |
54 #pragma warning (disable:4013 4024 4090) | 61 #pragma warning (disable:4013 4024 4090) |
55 | 62 |
99 va_end (args); | 106 va_end (args); |
100 OutputDebugString (buf); | 107 OutputDebugString (buf); |
101 #endif | 108 #endif |
102 } | 109 } |
103 | 110 |
104 /* sys_signal moved to nt.c. It's now called mswindows_signal... */ | 111 /* sys_signal moved to nt.c. It's now called msw_signal... */ |
105 | 112 |
106 /* Defined in <process.h> which conflicts with the local copy */ | 113 /* Defined in <process.h> which conflicts with the local copy */ |
107 #define _P_NOWAIT 1 | 114 #define _P_NOWAIT 1 |
108 | 115 |
109 /* Child process management list. */ | 116 /* Child process management list. */ |
384 the new process should start in. This is set just before calling | 391 the new process should start in. This is set just before calling |
385 sys_spawnve, and is not generally valid at any other time. */ | 392 sys_spawnve, and is not generally valid at any other time. */ |
386 static const char * process_dir; | 393 static const char * process_dir; |
387 | 394 |
388 static BOOL | 395 static BOOL |
389 create_child (const char *exe, char *cmdline, char *env, | 396 create_child (CONST char *exe, char *cmdline, char *env, |
390 int * pPid, child_process *cp) | 397 int * pPid, child_process *cp) |
391 { | 398 { |
392 STARTUPINFO start; | 399 STARTUPINFO start; |
393 SECURITY_ATTRIBUTES sec_attrs; | 400 SECURITY_ATTRIBUTES sec_attrs; |
394 SECURITY_DESCRIPTOR sec_desc; | 401 SECURITY_DESCRIPTOR sec_desc; |
397 if (cp == NULL) abort (); | 404 if (cp == NULL) abort (); |
398 | 405 |
399 xzero (start); | 406 xzero (start); |
400 start.cb = sizeof (start); | 407 start.cb = sizeof (start); |
401 | 408 |
409 #ifdef HAVE_NTGUI | |
402 if (NILP (Vwin32_start_process_show_window)) | 410 if (NILP (Vwin32_start_process_show_window)) |
403 start.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; | 411 start.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; |
404 else | 412 else |
405 start.dwFlags = STARTF_USESTDHANDLES; | 413 start.dwFlags = STARTF_USESTDHANDLES; |
406 start.wShowWindow = SW_HIDE; | 414 start.wShowWindow = SW_HIDE; |
407 | 415 |
408 start.hStdInput = GetStdHandle (STD_INPUT_HANDLE); | 416 start.hStdInput = GetStdHandle (STD_INPUT_HANDLE); |
409 start.hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE); | 417 start.hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE); |
410 start.hStdError = GetStdHandle (STD_ERROR_HANDLE); | 418 start.hStdError = GetStdHandle (STD_ERROR_HANDLE); |
419 #endif /* HAVE_NTGUI */ | |
411 | 420 |
412 /* Explicitly specify no security */ | 421 /* Explicitly specify no security */ |
413 if (!InitializeSecurityDescriptor (&sec_desc, SECURITY_DESCRIPTOR_REVISION)) | 422 if (!InitializeSecurityDescriptor (&sec_desc, SECURITY_DESCRIPTOR_REVISION)) |
414 goto EH_Fail; | 423 goto EH_Fail; |
415 if (!SetSecurityDescriptorDacl (&sec_desc, TRUE, NULL, FALSE)) | 424 if (!SetSecurityDescriptorDacl (&sec_desc, TRUE, NULL, FALSE)) |
434 CloseHandle (cp->procinfo.hThread); | 443 CloseHandle (cp->procinfo.hThread); |
435 CloseHandle (cp->procinfo.hProcess); | 444 CloseHandle (cp->procinfo.hProcess); |
436 cp->procinfo.hThread=NULL; | 445 cp->procinfo.hThread=NULL; |
437 cp->procinfo.hProcess=NULL; | 446 cp->procinfo.hProcess=NULL; |
438 | 447 |
448 /* Hack for Windows 95, which assigns large (ie negative) pids */ | |
449 if (cp->pid < 0) | |
450 cp->pid = -cp->pid; | |
451 | |
439 /* pid must fit in a Lisp_Int */ | 452 /* pid must fit in a Lisp_Int */ |
440 | 453 #ifdef USE_UNION_TYPE |
454 cp->pid = (cp->pid & ((1U << VALBITS) - 1)); | |
455 #else | |
456 cp->pid = (cp->pid & VALMASK); | |
457 #endif | |
441 | 458 |
442 *pPid = cp->pid; | 459 *pPid = cp->pid; |
443 | 460 |
444 return TRUE; | 461 return TRUE; |
445 | 462 |
446 EH_Fail: | 463 EH_Fail: |
447 DebPrint (("create_child.CreateProcess failed: %ld\n", GetLastError());); | 464 DebPrint (("create_child.CreateProcess failed: %ld\n", GetLastError());); |
448 return FALSE; | 465 return FALSE; |
466 } | |
467 | |
468 #ifndef __MINGW32__ | |
469 /* Return pointer to section header for section containing the given | |
470 relative virtual address. */ | |
471 static IMAGE_SECTION_HEADER * | |
472 rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header) | |
473 { | |
474 PIMAGE_SECTION_HEADER section; | |
475 int i; | |
476 | |
477 section = IMAGE_FIRST_SECTION (nt_header); | |
478 | |
479 for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) | |
480 { | |
481 if (rva >= section->VirtualAddress | |
482 && rva < section->VirtualAddress + section->SizeOfRawData) | |
483 return section; | |
484 section++; | |
485 } | |
486 return NULL; | |
487 } | |
488 #endif | |
489 | |
490 void | |
491 win32_executable_type (CONST char * filename, int * is_dos_app, int * is_cygnus_app) | |
492 { | |
493 file_data executable; | |
494 char * p; | |
495 | |
496 /* Default values in case we can't tell for sure. */ | |
497 *is_dos_app = FALSE; | |
498 *is_cygnus_app = FALSE; | |
499 | |
500 if (!open_input_file (&executable, filename)) | |
501 return; | |
502 | |
503 p = strrchr (filename, '.'); | |
504 | |
505 /* We can only identify DOS .com programs from the extension. */ | |
506 if (p && stricmp (p, ".com") == 0) | |
507 *is_dos_app = TRUE; | |
508 else if (p && (stricmp (p, ".bat") == 0 || | |
509 stricmp (p, ".cmd") == 0)) | |
510 { | |
511 /* A DOS shell script - it appears that CreateProcess is happy to | |
512 accept this (somewhat surprisingly); presumably it looks at | |
513 COMSPEC to determine what executable to actually invoke. | |
514 Therefore, we have to do the same here as well. */ | |
515 /* Actually, I think it uses the program association for that | |
516 extension, which is defined in the registry. */ | |
517 p = egetenv ("COMSPEC"); | |
518 if (p) | |
519 win32_executable_type (p, is_dos_app, is_cygnus_app); | |
520 } | |
521 else | |
522 { | |
523 /* Look for DOS .exe signature - if found, we must also check that | |
524 it isn't really a 16- or 32-bit Windows exe, since both formats | |
525 start with a DOS program stub. Note that 16-bit Windows | |
526 executables use the OS/2 1.x format. */ | |
527 | |
528 #ifdef __MINGW32__ | |
529 /* mingw32 doesn't have enough headers to detect cygwin | |
530 apps, just do what we can. */ | |
531 FILHDR * exe_header; | |
532 | |
533 exe_header = (FILHDR*) executable.file_base; | |
534 if (exe_header->e_magic != DOSMAGIC) | |
535 goto unwind; | |
536 | |
537 if ((char *) exe_header->e_lfanew > (char *) executable.size) | |
538 { | |
539 /* Some dos headers (pkunzip) have bogus e_lfanew fields. */ | |
540 *is_dos_app = TRUE; | |
541 } | |
542 else if (exe_header->nt_signature != NT_SIGNATURE) | |
543 { | |
544 *is_dos_app = TRUE; | |
545 } | |
546 #else | |
547 IMAGE_DOS_HEADER * dos_header; | |
548 IMAGE_NT_HEADERS * nt_header; | |
549 | |
550 dos_header = (PIMAGE_DOS_HEADER) executable.file_base; | |
551 if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) | |
552 goto unwind; | |
553 | |
554 nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); | |
555 | |
556 if ((char *) nt_header > (char *) dos_header + executable.size) | |
557 { | |
558 /* Some dos headers (pkunzip) have bogus e_lfanew fields. */ | |
559 *is_dos_app = TRUE; | |
560 } | |
561 else if (nt_header->Signature != IMAGE_NT_SIGNATURE && | |
562 LOWORD (nt_header->Signature) != IMAGE_OS2_SIGNATURE) | |
563 { | |
564 *is_dos_app = TRUE; | |
565 } | |
566 else if (nt_header->Signature == IMAGE_NT_SIGNATURE) | |
567 { | |
568 /* Look for cygwin.dll in DLL import list. */ | |
569 IMAGE_DATA_DIRECTORY import_dir = | |
570 nt_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; | |
571 IMAGE_IMPORT_DESCRIPTOR * imports; | |
572 IMAGE_SECTION_HEADER * section; | |
573 | |
574 section = rva_to_section (import_dir.VirtualAddress, nt_header); | |
575 imports = RVA_TO_PTR (import_dir.VirtualAddress, section, executable); | |
576 | |
577 for ( ; imports->Name; imports++) | |
578 { | |
579 char * dllname = RVA_TO_PTR (imports->Name, section, executable); | |
580 | |
581 if (strcmp (dllname, "cygwin.dll") == 0) | |
582 { | |
583 *is_cygnus_app = TRUE; | |
584 break; | |
585 } | |
586 } | |
587 } | |
588 #endif | |
589 } | |
590 | |
591 unwind: | |
592 close_file_data (&executable); | |
593 } | |
594 | |
595 int | |
596 compare_env (const void *strp1, const void *strp2) | |
597 { | |
598 const char *str1 = *(const char**)strp1, *str2 = *(const char**)strp2; | |
599 | |
600 while (*str1 && *str2 && *str1 != '=' && *str2 != '=') | |
601 { | |
602 if ((*str1) > (*str2)) | |
603 return 1; | |
604 else if ((*str1) < (*str2)) | |
605 return -1; | |
606 str1++, str2++; | |
607 } | |
608 | |
609 if (*str1 == '=' && *str2 == '=') | |
610 return 0; | |
611 else if (*str1 == '=') | |
612 return -1; | |
613 else | |
614 return 1; | |
449 } | 615 } |
450 | 616 |
451 void | 617 void |
452 merge_and_sort_env (char **envp1, char **envp2, char **new_envp) | 618 merge_and_sort_env (char **envp1, char **envp2, char **new_envp) |
453 { | 619 { |
463 optr = envp2; | 629 optr = envp2; |
464 while (*optr) | 630 while (*optr) |
465 *nptr++ = *optr++; | 631 *nptr++ = *optr++; |
466 num += optr - envp2; | 632 num += optr - envp2; |
467 | 633 |
468 qsort (new_envp, num, sizeof (char*), compare_env); | 634 qsort (new_envp, num, sizeof (char *), compare_env); |
469 | 635 |
470 *nptr = NULL; | 636 *nptr = NULL; |
471 } | 637 } |
472 | 638 |
473 /* When a new child process is created we need to register it in our list, | 639 /* When a new child process is created we need to register it in our list, |
474 so intercept spawn requests. */ | 640 so intercept spawn requests. */ |
475 int | 641 int |
476 sys_spawnve (int mode, const char *cmdname, | 642 sys_spawnve (int mode, CONST char *cmdname, |
477 const char * const *argv, const char *const *envp) | 643 CONST char * CONST *argv, CONST char *CONST *envp) |
478 { | 644 { |
479 Lisp_Object program, full; | 645 Lisp_Object program, full; |
480 char *cmdline, *env, *parg, **targ; | 646 char *cmdline, *env, *parg, **targ; |
481 int arglen, numenv; | 647 int arglen, numenv; |
482 int pid; | 648 int pid; |
508 { | 674 { |
509 UNGCPRO; | 675 UNGCPRO; |
510 errno = EINVAL; | 676 errno = EINVAL; |
511 return -1; | 677 return -1; |
512 } | 678 } |
513 TO_EXTERNAL_FORMAT (LISP_STRING, full, | 679 GET_C_STRING_FILENAME_DATA_ALLOCA (full, cmdname); |
514 C_STRING_ALLOCA, cmdname, | |
515 Qfile_name); | |
516 } | 680 } |
517 else | 681 else |
518 { | 682 { |
519 cmdname = (char*)alloca (strlen (argv[0]) + 1); | 683 (char*)cmdname = alloca (strlen (argv[0]) + 1); |
520 strcpy ((char*)cmdname, argv[0]); | 684 strcpy ((char*)cmdname, argv[0]); |
521 } | 685 } |
522 UNGCPRO; | 686 UNGCPRO; |
523 | 687 |
524 /* make sure argv[0] and cmdname are both in DOS format */ | 688 /* make sure argv[0] and cmdname are both in DOS format */ |
525 unixtodos_filename ((char*)cmdname); | 689 unixtodos_filename ((char*)cmdname); |
526 /* #### KLUDGE */ | 690 /* #### KLUDGE */ |
527 ((const char**)argv)[0] = cmdname; | 691 ((CONST char**)argv)[0] = cmdname; |
528 | 692 |
529 /* Determine whether program is a 16-bit DOS executable, or a Win32 | 693 /* Determine whether program is a 16-bit DOS executable, or a Win32 |
530 executable that is implicitly linked to the Cygnus dll (implying it | 694 executable that is implicitly linked to the Cygnus dll (implying it |
531 was compiled with the Cygnus GNU toolchain and hence relies on | 695 was compiled with the Cygnus GNU toolchain and hence relies on |
532 cygwin.dll to parse the command line - we use this to decide how to | 696 cygwin.dll to parse the command line - we use this to decide how to |
533 escape quote chars in command line args that must be quoted). */ | 697 escape quote chars in command line args that must be quoted). */ |
534 mswindows_executable_type (cmdname, &is_dos_app, &is_cygnus_app); | 698 win32_executable_type (cmdname, &is_dos_app, &is_cygnus_app); |
535 | 699 |
536 /* On Windows 95, if cmdname is a DOS app, we invoke a helper | 700 /* On Windows 95, if cmdname is a DOS app, we invoke a helper |
537 application to start it by specifying the helper app as cmdname, | 701 application to start it by specifying the helper app as cmdname, |
538 while leaving the real app name as argv[0]. */ | 702 while leaving the real app name as argv[0]. */ |
539 if (is_dos_app) | 703 if (is_dos_app) |
540 { | 704 { |
541 cmdname = (char*) alloca (MAXPATHLEN); | 705 cmdname = alloca (MAXPATHLEN); |
542 if (egetenv ("CMDPROXY")) | 706 if (egetenv ("CMDPROXY")) |
543 strcpy ((char*)cmdname, egetenv ("CMDPROXY")); | 707 strcpy ((char*)cmdname, egetenv ("CMDPROXY")); |
544 else | 708 else |
545 { | 709 { |
546 strcpy ((char*)cmdname, XSTRING_DATA (Vinvocation_directory)); | 710 strcpy ((char*)cmdname, XSTRING_DATA (Vinvocation_directory)); |
583 { | 747 { |
584 do_quoting = 1; | 748 do_quoting = 1; |
585 /* Override escape char by binding win32-quote-process-args to | 749 /* Override escape char by binding win32-quote-process-args to |
586 desired character, or use t for auto-selection. */ | 750 desired character, or use t for auto-selection. */ |
587 if (INTP (Vwin32_quote_process_args)) | 751 if (INTP (Vwin32_quote_process_args)) |
588 escape_char = (char) XINT (Vwin32_quote_process_args); | 752 escape_char = XINT (Vwin32_quote_process_args); |
589 else | 753 else |
590 escape_char = is_cygnus_app ? '"' : '\\'; | 754 escape_char = is_cygnus_app ? '"' : '\\'; |
591 } | 755 } |
592 | 756 |
593 /* do argv... */ | 757 /* do argv... */ |
635 if (escape_char_run > 0) | 799 if (escape_char_run > 0) |
636 arglen += escape_char_run; | 800 arglen += escape_char_run; |
637 } | 801 } |
638 arglen += strlen (*targ++) + 1; | 802 arglen += strlen (*targ++) + 1; |
639 } | 803 } |
640 cmdline = (char*) alloca (arglen); | 804 cmdline = alloca (arglen); |
641 targ = (char**)argv; | 805 targ = (char**)argv; |
642 parg = cmdline; | 806 parg = cmdline; |
643 while (*targ) | 807 while (*targ) |
644 { | 808 { |
645 char * p = *targ; | 809 char * p = *targ; |
717 } | 881 } |
718 *--parg = '\0'; | 882 *--parg = '\0'; |
719 | 883 |
720 /* and envp... */ | 884 /* and envp... */ |
721 arglen = 1; | 885 arglen = 1; |
722 targ = (char**) envp; | 886 targ = (char**)envp; |
723 numenv = 1; /* for end null */ | 887 numenv = 1; /* for end null */ |
724 while (*targ) | 888 while (*targ) |
725 { | 889 { |
726 arglen += strlen (*targ++) + 1; | 890 arglen += strlen (*targ++) + 1; |
727 numenv++; | 891 numenv++; |
731 GetCurrentProcessId ()); | 895 GetCurrentProcessId ()); |
732 arglen += strlen (ppid_env_var_buffer) + 1; | 896 arglen += strlen (ppid_env_var_buffer) + 1; |
733 numenv++; | 897 numenv++; |
734 | 898 |
735 /* merge env passed in and extra env into one, and sort it. */ | 899 /* merge env passed in and extra env into one, and sort it. */ |
736 targ = (char **) alloca (numenv * sizeof (char*)); | 900 targ = (char **) alloca (numenv * sizeof (char *)); |
737 merge_and_sort_env ((char**) envp, extra_env, targ); | 901 merge_and_sort_env ((char**)envp, extra_env, targ); |
738 | 902 |
739 /* concatenate env entries. */ | 903 /* concatenate env entries. */ |
740 env = (char*) alloca (arglen); | 904 env = alloca (arglen); |
741 parg = env; | 905 parg = env; |
742 while (*targ) | 906 while (*targ) |
743 { | 907 { |
744 strcpy (parg, *targ); | 908 strcpy (parg, *targ); |
745 parg += strlen (*targ++); | 909 parg += strlen (*targ++); |
779 { | 943 { |
780 char window_class[32]; | 944 char window_class[32]; |
781 | 945 |
782 GetClassName (hwnd, window_class, sizeof (window_class)); | 946 GetClassName (hwnd, window_class, sizeof (window_class)); |
783 if (strcmp (window_class, | 947 if (strcmp (window_class, |
784 mswindows_windows9x_p() | 948 (os_subtype == OS_WIN95) |
785 ? "tty" | 949 ? "tty" |
786 : "ConsoleWindowClass") == 0) | 950 : "ConsoleWindowClass") == 0) |
787 { | 951 { |
788 cp->hwnd = hwnd; | 952 cp->hwnd = hwnd; |
789 return FALSE; | 953 return FALSE; |
872 else | 1036 else |
873 { | 1037 { |
874 if (NILP (Vwin32_start_process_share_console) && cp && cp->hwnd) | 1038 if (NILP (Vwin32_start_process_share_console) && cp && cp->hwnd) |
875 { | 1039 { |
876 #if 1 | 1040 #if 1 |
877 if (mswindows_windows9x_p()) | 1041 if (os_subtype == OS_WIN95) |
878 { | 1042 { |
879 /* | 1043 /* |
880 Another possibility is to try terminating the VDM out-right by | 1044 Another possibility is to try terminating the VDM out-right by |
881 calling the Shell VxD (id 0x17) V86 interface, function #4 | 1045 calling the Shell VxD (id 0x17) V86 interface, function #4 |
882 "SHELL_Destroy_VM", ie. | 1046 "SHELL_Destroy_VM", ie. |
933 return rc; | 1097 return rc; |
934 } | 1098 } |
935 | 1099 |
936 #if 0 | 1100 #if 0 |
937 /* Sync with FSF Emacs 19.34.6 note: ifdef'ed out in XEmacs */ | 1101 /* Sync with FSF Emacs 19.34.6 note: ifdef'ed out in XEmacs */ |
938 extern int report_file_error (const char *, Lisp_Object); | 1102 extern int report_file_error (CONST char *, Lisp_Object); |
939 #endif | 1103 #endif |
940 /* The following two routines are used to manipulate stdin, stdout, and | 1104 /* The following two routines are used to manipulate stdin, stdout, and |
941 stderr of our child processes. | 1105 stderr of our child processes. |
942 | 1106 |
943 Assuming that in, out, and err are *not* inheritable, we make them | 1107 Assuming that in, out, and err are *not* inheritable, we make them |
1026 } | 1190 } |
1027 | 1191 |
1028 /* Some miscellaneous functions that are Windows specific, but not GUI | 1192 /* Some miscellaneous functions that are Windows specific, but not GUI |
1029 specific (ie. are applicable in terminal or batch mode as well). */ | 1193 specific (ie. are applicable in terminal or batch mode as well). */ |
1030 | 1194 |
1195 /* lifted from fileio.c */ | |
1196 #define CORRECT_DIR_SEPS(s) \ | |
1197 do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \ | |
1198 else unixtodos_filename (s); \ | |
1199 } while (0) | |
1200 | |
1031 DEFUN ("win32-short-file-name", Fwin32_short_file_name, 1, 1, "", /* | 1201 DEFUN ("win32-short-file-name", Fwin32_short_file_name, 1, 1, "", /* |
1032 Return the short file name version (8.3) of the full path of FILENAME. | 1202 Return the short file name version (8.3) of the full path of FILENAME. |
1033 If FILENAME does not exist, return nil. | 1203 If FILENAME does not exist, return nil. |
1034 All path elements in FILENAME are converted to their short names. | 1204 All path elements in FILENAME are converted to their short names. |
1035 */ | 1205 */ |
1255 if (!SetThreadLocale (XINT (lcid))) | 1425 if (!SetThreadLocale (XINT (lcid))) |
1256 return Qnil; | 1426 return Qnil; |
1257 | 1427 |
1258 /* Sync with FSF Emacs 19.34.6 note: dwWinThreadId declared in | 1428 /* Sync with FSF Emacs 19.34.6 note: dwWinThreadId declared in |
1259 w32term.h and defined in w32fns.c, both of which are not in current | 1429 w32term.h and defined in w32fns.c, both of which are not in current |
1260 XEmacs. #### Check what we lose by ifdef'ing out these. --marcpa */ | 1430 XEmacs. ### Check what we lose by ifdef'ing out these. --marcpa */ |
1261 #if 0 | 1431 #if 0 |
1262 /* Need to set input thread locale if present. */ | 1432 /* Need to set input thread locale if present. */ |
1263 if (dwWinThreadId) | 1433 if (dwWinThreadId) |
1264 /* Reply is not needed. */ | 1434 /* Reply is not needed. */ |
1265 PostThreadMessage (dwWinThreadId, WM_EMACS_SETLOCALE, XINT (lcid), 0); | 1435 PostThreadMessage (dwWinThreadId, WM_EMACS_SETLOCALE, XINT (lcid), 0); |
1268 return make_int (GetThreadLocale ()); | 1438 return make_int (GetThreadLocale ()); |
1269 } | 1439 } |
1270 | 1440 |
1271 | 1441 |
1272 void | 1442 void |
1273 syms_of_ntproc (void) | 1443 syms_of_ntproc () |
1274 { | 1444 { |
1445 Qhigh = intern ("high"); | |
1446 Qlow = intern ("low"); | |
1447 | |
1275 DEFSUBR (Fwin32_short_file_name); | 1448 DEFSUBR (Fwin32_short_file_name); |
1276 DEFSUBR (Fwin32_long_file_name); | 1449 DEFSUBR (Fwin32_long_file_name); |
1277 DEFSUBR (Fwin32_set_process_priority); | 1450 DEFSUBR (Fwin32_set_process_priority); |
1278 DEFSUBR (Fwin32_get_locale_info); | 1451 DEFSUBR (Fwin32_get_locale_info); |
1279 DEFSUBR (Fwin32_get_current_locale_id); | 1452 DEFSUBR (Fwin32_get_current_locale_id); |
1280 DEFSUBR (Fwin32_get_default_locale_id); | 1453 DEFSUBR (Fwin32_get_default_locale_id); |
1281 DEFSUBR (Fwin32_get_valid_locale_ids); | 1454 DEFSUBR (Fwin32_get_valid_locale_ids); |
1282 DEFSUBR (Fwin32_set_current_locale); | 1455 DEFSUBR (Fwin32_set_current_locale); |
1283 } | |
1284 | |
1285 | |
1286 void | |
1287 vars_of_ntproc (void) | |
1288 { | |
1289 defsymbol (&Qhigh, "high"); | |
1290 defsymbol (&Qlow, "low"); | |
1291 | 1456 |
1292 DEFVAR_LISP ("win32-quote-process-args", &Vwin32_quote_process_args /* | 1457 DEFVAR_LISP ("win32-quote-process-args", &Vwin32_quote_process_args /* |
1293 Non-nil enables quoting of process arguments to ensure correct parsing. | 1458 Non-nil enables quoting of process arguments to ensure correct parsing. |
1294 Because Windows does not directly pass argv arrays to child processes, | 1459 Because Windows does not directly pass argv arrays to child processes, |
1295 programs have to reconstruct the argv array by parsing the command | 1460 programs have to reconstruct the argv array by parsing the command |
1316 allowing only only DOS subprocess to run at a time (whether started directly | 1481 allowing only only DOS subprocess to run at a time (whether started directly |
1317 or indirectly by Emacs), and preventing Emacs from cleanly terminating the | 1482 or indirectly by Emacs), and preventing Emacs from cleanly terminating the |
1318 subprocess group, but may allow Emacs to interrupt a subprocess that doesn't | 1483 subprocess group, but may allow Emacs to interrupt a subprocess that doesn't |
1319 otherwise respond to interrupts from Emacs. | 1484 otherwise respond to interrupts from Emacs. |
1320 */ ); | 1485 */ ); |
1321 Vwin32_start_process_share_console = Qt; | 1486 Vwin32_start_process_share_console = Qnil; |
1322 | 1487 |
1323 DEFVAR_LISP ("win32-pipe-read-delay", &Vwin32_pipe_read_delay /* | 1488 DEFVAR_LISP ("win32-pipe-read-delay", &Vwin32_pipe_read_delay /* |
1324 Forced delay before reading subprocess output. | 1489 Forced delay before reading subprocess output. |
1325 This is done to improve the buffering of subprocess output, by | 1490 This is done to improve the buffering of subprocess output, by |
1326 avoiding the inefficiency of frequently reading small amounts of data. | 1491 avoiding the inefficiency of frequently reading small amounts of data. |
1341 the truename of a file can be slow. | 1506 the truename of a file can be slow. |
1342 */ ); | 1507 */ ); |
1343 Vwin32_generate_fake_inodes = Qnil; | 1508 Vwin32_generate_fake_inodes = Qnil; |
1344 #endif | 1509 #endif |
1345 } | 1510 } |
1346 | |
1347 /* end of ntproc.c */ | 1511 /* end of ntproc.c */ |