/[emacs]/emacs/src/w32proc.c
ViewVC logotype

Diff of /emacs/src/w32proc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.51 by jasonr, Fri May 3 20:35:38 2002 UTC revision 1.51.2.1 by miles, Fri Apr 4 06:21:04 2003 UTC
# Line 120  typedef void (_CALLBACK_ *signal_handler Line 120  typedef void (_CALLBACK_ *signal_handler
120  static signal_handler sig_handlers[NSIG];  static signal_handler sig_handlers[NSIG];
121    
122  /* Fake signal implementation to record the SIGCHLD handler.  */  /* Fake signal implementation to record the SIGCHLD handler.  */
123  signal_handler  signal_handler
124  sys_signal (int sig, signal_handler handler)  sys_signal (int sig, signal_handler handler)
125  {  {
126    signal_handler old;    signal_handler old;
127      
128    if (sig != SIGCHLD)    if (sig != SIGCHLD)
129      {      {
130        errno = EINVAL;        errno = EINVAL;
# Line 151  new_child (void) Line 151  new_child (void)
151  {  {
152    child_process *cp;    child_process *cp;
153    DWORD id;    DWORD id;
154      
155    for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--)    for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--)
156      if (!CHILD_ACTIVE (cp))      if (!CHILD_ACTIVE (cp))
157        goto Initialise;        goto Initialise;
# Line 182  new_child (void) Line 182  new_child (void)
182    return NULL;    return NULL;
183  }  }
184    
185  void  void
186  delete_child (child_process *cp)  delete_child (child_process *cp)
187  {  {
188    int i;    int i;
# Line 257  find_child_pid (DWORD pid) Line 257  find_child_pid (DWORD pid)
257     is normally blocked until woken by select() to check for input by     is normally blocked until woken by select() to check for input by
258     reading one char.  When the read completes, char_avail is signalled     reading one char.  When the read completes, char_avail is signalled
259     to wake up the select emulator and the thread blocks itself again. */     to wake up the select emulator and the thread blocks itself again. */
260  DWORD WINAPI  DWORD WINAPI
261  reader_thread (void *arg)  reader_thread (void *arg)
262  {  {
263    child_process *cp;    child_process *cp;
264      
265    /* Our identity */    /* Our identity */
266    cp = (child_process *)arg;    cp = (child_process *)arg;
267      
268    /* We have to wait for the go-ahead before we can start */    /* We have to wait for the go-ahead before we can start */
269    if (cp == NULL    if (cp == NULL
270        || WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0)        || WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0)
# Line 287  reader_thread (void *arg) Line 287  reader_thread (void *arg)
287    
288        if (rc == STATUS_READ_ERROR)        if (rc == STATUS_READ_ERROR)
289          return 1;          return 1;
290            
291        /* If the read died, the child has died so let the thread die */        /* If the read died, the child has died so let the thread die */
292        if (rc == STATUS_READ_FAILED)        if (rc == STATUS_READ_FAILED)
293          break;          break;
294            
295        /* Wait until our input is acknowledged before reading again */        /* Wait until our input is acknowledged before reading again */
296        if (WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0)        if (WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0)
297          {          {
# Line 308  reader_thread (void *arg) Line 308  reader_thread (void *arg)
308     sys_spawnve, and is not generally valid at any other time.  */     sys_spawnve, and is not generally valid at any other time.  */
309  static char * process_dir;  static char * process_dir;
310    
311  static BOOL  static BOOL
312  create_child (char *exe, char *cmdline, char *env, int is_gui_app,  create_child (char *exe, char *cmdline, char *env, int is_gui_app,
313                int * pPid, child_process *cp)                int * pPid, child_process *cp)
314  {  {
# Line 319  create_child (char *exe, char *cmdline, Line 319  create_child (char *exe, char *cmdline,
319  #endif  #endif
320    DWORD flags;    DWORD flags;
321    char dir[ MAXPATHLEN ];    char dir[ MAXPATHLEN ];
322      
323    if (cp == NULL) abort ();    if (cp == NULL) abort ();
324      
325    memset (&start, 0, sizeof (start));    memset (&start, 0, sizeof (start));
326    start.cb = sizeof (start);    start.cb = sizeof (start);
327      
328  #ifdef HAVE_NTGUI  #ifdef HAVE_NTGUI
329    if (NILP (Vw32_start_process_show_window) && !is_gui_app)    if (NILP (Vw32_start_process_show_window) && !is_gui_app)
330      start.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;      start.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
# Line 347  create_child (char *exe, char *cmdline, Line 347  create_child (char *exe, char *cmdline,
347    sec_attrs.nLength = sizeof (sec_attrs);    sec_attrs.nLength = sizeof (sec_attrs);
348    sec_attrs.lpSecurityDescriptor = NULL /* &sec_desc */;    sec_attrs.lpSecurityDescriptor = NULL /* &sec_desc */;
349    sec_attrs.bInheritHandle = FALSE;    sec_attrs.bInheritHandle = FALSE;
350      
351    strcpy (dir, process_dir);    strcpy (dir, process_dir);
352    unixtodos_filename (dir);    unixtodos_filename (dir);
353    
# Line 383  create_child (char *exe, char *cmdline, Line 383  create_child (char *exe, char *cmdline,
383     to register the handle with the process     to register the handle with the process
384     This way the select emulator knows how to match file handles with     This way the select emulator knows how to match file handles with
385     entries in child_procs.  */     entries in child_procs.  */
386  void  void
387  register_child (int pid, int fd)  register_child (int pid, int fd)
388  {  {
389    child_process *cp;    child_process *cp;
390      
391    cp = find_child_pid (pid);    cp = find_child_pid (pid);
392    if (cp == NULL)    if (cp == NULL)
393      {      {
394        DebPrint (("register_child unable to find pid %lu\n", pid));        DebPrint (("register_child unable to find pid %lu\n", pid));
395        return;        return;
396      }      }
397      
398  #ifdef FULL_DEBUG  #ifdef FULL_DEBUG
399    DebPrint (("register_child registered fd %d with pid %lu\n", fd, pid));    DebPrint (("register_child registered fd %d with pid %lu\n", fd, pid));
400  #endif  #endif
401      
402    cp->fd = fd;    cp->fd = fd;
403    
404    /* thread is initially blocked until select is called; set status so    /* thread is initially blocked until select is called; set status so
# Line 419  register_child (int pid, int fd) Line 419  register_child (int pid, int fd)
419     signal failure to the select emulator.     signal failure to the select emulator.
420     The select emulator then calls this routine to clean up.     The select emulator then calls this routine to clean up.
421     Since the thread signaled failure we can assume it is exiting.  */     Since the thread signaled failure we can assume it is exiting.  */
422  static void  static void
423  reap_subprocess (child_process *cp)  reap_subprocess (child_process *cp)
424  {  {
425    if (cp->procinfo.hProcess)    if (cp->procinfo.hProcess)
# Line 448  reap_subprocess (child_process *cp) Line 448  reap_subprocess (child_process *cp)
448     When it does, close its handle     When it does, close its handle
449     Return the pid and fill in the status if non-NULL.  */     Return the pid and fill in the status if non-NULL.  */
450    
451  int  int
452  sys_wait (int *status)  sys_wait (int *status)
453  {  {
454    DWORD active, retval;    DWORD active, retval;
# Line 456  sys_wait (int *status) Line 456  sys_wait (int *status)
456    int pid;    int pid;
457    child_process *cp, *cps[MAX_CHILDREN];    child_process *cp, *cps[MAX_CHILDREN];
458    HANDLE wait_hnd[MAX_CHILDREN];    HANDLE wait_hnd[MAX_CHILDREN];
459      
460    nh = 0;    nh = 0;
461    if (dead_child != NULL)    if (dead_child != NULL)
462      {      {
# Line 479  sys_wait (int *status) Line 479  sys_wait (int *status)
479              nh++;              nh++;
480            }            }
481      }      }
482      
483    if (nh == 0)    if (nh == 0)
484      {      {
485        /* Nothing to wait on, so fail */        /* Nothing to wait on, so fail */
# Line 535  get_result: Line 535  get_result:
535      retval = SIGINT;      retval = SIGINT;
536    else    else
537      retval <<= 8;      retval <<= 8;
538      
539    cp = cps[active];    cp = cps[active];
540    pid = cp->pid;    pid = cp->pid;
541  #ifdef FULL_DEBUG  #ifdef FULL_DEBUG
# Line 571  get_result: Line 571  get_result:
571      }      }
572    
573    reap_subprocess (cp);    reap_subprocess (cp);
574      
575    return pid;    return pid;
576  }  }
577    
# Line 580  w32_executable_type (char * filename, in Line 580  w32_executable_type (char * filename, in
580  {  {
581    file_data executable;    file_data executable;
582    char * p;    char * p;
583      
584    /* Default values in case we can't tell for sure.  */    /* Default values in case we can't tell for sure.  */
585    *is_dos_app = FALSE;    *is_dos_app = FALSE;
586    *is_cygnus_app = FALSE;    *is_cygnus_app = FALSE;
# Line 590  w32_executable_type (char * filename, in Line 590  w32_executable_type (char * filename, in
590      return;      return;
591    
592    p = strrchr (filename, '.');    p = strrchr (filename, '.');
593      
594    /* We can only identify DOS .com programs from the extension. */    /* We can only identify DOS .com programs from the extension. */
595    if (p && stricmp (p, ".com") == 0)    if (p && stricmp (p, ".com") == 0)
596      *is_dos_app = TRUE;      *is_dos_app = TRUE;
# Line 623  w32_executable_type (char * filename, in Line 623  w32_executable_type (char * filename, in
623    
624        nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew);        nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew);
625    
626        if ((char *) nt_header > (char *) dos_header + executable.size)        if ((char *) nt_header > (char *) dos_header + executable.size)
627          {          {
628            /* Some dos headers (pkunzip) have bogus e_lfanew fields.  */            /* Some dos headers (pkunzip) have bogus e_lfanew fields.  */
629            *is_dos_app = TRUE;            *is_dos_app = TRUE;
630          }          }
631        else if (nt_header->Signature != IMAGE_NT_SIGNATURE        else if (nt_header->Signature != IMAGE_NT_SIGNATURE
632                 && LOWORD (nt_header->Signature) != IMAGE_OS2_SIGNATURE)                 && LOWORD (nt_header->Signature) != IMAGE_OS2_SIGNATURE)
633          {          {
# Line 664  w32_executable_type (char * filename, in Line 664  w32_executable_type (char * filename, in
664            *is_gui_app = (nt_header->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI);            *is_gui_app = (nt_header->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI);
665          }          }
666      }      }
667      
668  unwind:  unwind:
669    close_file_data (&executable);    close_file_data (&executable);
670  }  }
# Line 717  merge_and_sort_env (char **envp1, char * Line 717  merge_and_sort_env (char **envp1, char *
717    
718  /* When a new child process is created we need to register it in our list,  /* When a new child process is created we need to register it in our list,
719     so intercept spawn requests.  */     so intercept spawn requests.  */
720  int  int
721  sys_spawnve (int mode, char *cmdname, char **argv, char **envp)  sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
722  {  {
723    Lisp_Object program, full;    Lisp_Object program, full;
# Line 746  sys_spawnve (int mode, char *cmdname, ch Line 746  sys_spawnve (int mode, char *cmdname, ch
746    if (NILP (Ffile_executable_p (program)))    if (NILP (Ffile_executable_p (program)))
747      {      {
748        struct gcpro gcpro1;        struct gcpro gcpro1;
749          
750        full = Qnil;        full = Qnil;
751        GCPRO1 (program);        GCPRO1 (program);
752        openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK));        openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK));
# Line 760  sys_spawnve (int mode, char *cmdname, ch Line 760  sys_spawnve (int mode, char *cmdname, ch
760      }      }
761    
762    /* make sure argv[0] and cmdname are both in DOS format */    /* make sure argv[0] and cmdname are both in DOS format */
763    cmdname = XSTRING (program)->data;    cmdname = SDATA (program);
764    unixtodos_filename (cmdname);    unixtodos_filename (cmdname);
765    argv[0] = cmdname;    argv[0] = cmdname;
766    
# Line 784  sys_spawnve (int mode, char *cmdname, ch Line 784  sys_spawnve (int mode, char *cmdname, ch
784          strcpy (cmdname, egetenv ("CMDPROXY"));          strcpy (cmdname, egetenv ("CMDPROXY"));
785        else        else
786          {          {
787            strcpy (cmdname, XSTRING (Vinvocation_directory)->data);            strcpy (cmdname, SDATA (Vinvocation_directory));
788            strcat (cmdname, "cmdproxy.exe");            strcat (cmdname, "cmdproxy.exe");
789          }          }
790        unixtodos_filename (cmdname);        unixtodos_filename (cmdname);
791      }      }
792      
793    /* we have to do some conjuring here to put argv and envp into the    /* we have to do some conjuring here to put argv and envp into the
794       form CreateProcess wants...  argv needs to be a space separated/null       form CreateProcess wants...  argv needs to be a space separated/null
795       terminated list of parameters, and envp is a null       terminated list of parameters, and envp is a null
# Line 830  sys_spawnve (int mode, char *cmdname, ch Line 830  sys_spawnve (int mode, char *cmdname, ch
830        else        else
831          escape_char = is_cygnus_app ? '"' : '\\';          escape_char = is_cygnus_app ? '"' : '\\';
832      }      }
833      
834    /* Cygwin apps needs quoting a bit more often */    /* Cygwin apps needs quoting a bit more often */
835    if (escape_char == '"')    if (escape_char == '"')
836      sepchars = "\r\n\t\f '";      sepchars = "\r\n\t\f '";
837    
# Line 966  sys_spawnve (int mode, char *cmdname, ch Line 966  sys_spawnve (int mode, char *cmdname, ch
966        targ++;        targ++;
967      }      }
968    *--parg = '\0';    *--parg = '\0';
969      
970    /* and envp...  */    /* and envp...  */
971    arglen = 1;    arglen = 1;
972    targ = envp;    targ = envp;
# Line 977  sys_spawnve (int mode, char *cmdname, ch Line 977  sys_spawnve (int mode, char *cmdname, ch
977        numenv++;        numenv++;
978      }      }
979    /* extra env vars... */    /* extra env vars... */
980    sprintf (ppid_env_var_buffer, "EM_PARENT_PROCESS_ID=%d",    sprintf (ppid_env_var_buffer, "EM_PARENT_PROCESS_ID=%d",
981             GetCurrentProcessId ());             GetCurrentProcessId ());
982    arglen += strlen (ppid_env_var_buffer) + 1;    arglen += strlen (ppid_env_var_buffer) + 1;
983    numenv++;    numenv++;
# Line 1004  sys_spawnve (int mode, char *cmdname, ch Line 1004  sys_spawnve (int mode, char *cmdname, ch
1004        errno = EAGAIN;        errno = EAGAIN;
1005        return -1;        return -1;
1006      }      }
1007      
1008    /* Now create the process.  */    /* Now create the process.  */
1009    if (!create_child (cmdname, cmdline, env, is_gui_app, &pid, cp))    if (!create_child (cmdname, cmdline, env, is_gui_app, &pid, cp))
1010      {      {
# Line 1012  sys_spawnve (int mode, char *cmdname, ch Line 1012  sys_spawnve (int mode, char *cmdname, ch
1012        errno = ENOEXEC;        errno = ENOEXEC;
1013        return -1;        return -1;
1014      }      }
1015      
1016    return pid;    return pid;
1017  }  }
1018    
# Line 1043  extern HANDLE interrupt_handle; Line 1043  extern HANDLE interrupt_handle;
1043  /* From process.c */  /* From process.c */
1044  extern int proc_buffered_char[];  extern int proc_buffered_char[];
1045    
1046  int  int
1047  sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,  sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
1048              EMACS_TIME *timeout)              EMACS_TIME *timeout)
1049  {  {
# Line 1054  sys_select (int nfds, SELECT_TYPE *rfds, Line 1054  sys_select (int nfds, SELECT_TYPE *rfds,
1054    child_process *cp, *cps[MAX_CHILDREN];    child_process *cp, *cps[MAX_CHILDREN];
1055    HANDLE wait_hnd[MAXDESC + MAX_CHILDREN];    HANDLE wait_hnd[MAXDESC + MAX_CHILDREN];
1056    int fdindex[MAXDESC];   /* mapping from wait handles back to descriptors */    int fdindex[MAXDESC];   /* mapping from wait handles back to descriptors */
1057      
1058    timeout_ms = timeout ? (timeout->tv_sec * 1000 + timeout->tv_usec / 1000) : INFINITE;    timeout_ms = timeout ? (timeout->tv_sec * 1000 + timeout->tv_usec / 1000) : INFINITE;
1059    
1060    /* If the descriptor sets are NULL but timeout isn't, then just Sleep.  */    /* If the descriptor sets are NULL but timeout isn't, then just Sleep.  */
1061    if (rfds == NULL && wfds == NULL && efds == NULL && timeout != NULL)    if (rfds == NULL && wfds == NULL && efds == NULL && timeout != NULL)
1062      {      {
1063        Sleep (timeout_ms);        Sleep (timeout_ms);
1064        return 0;        return 0;
# Line 1070  sys_select (int nfds, SELECT_TYPE *rfds, Line 1070  sys_select (int nfds, SELECT_TYPE *rfds,
1070        errno = EINVAL;        errno = EINVAL;
1071        return -1;        return -1;
1072      }      }
1073      
1074    orfds = *rfds;    orfds = *rfds;
1075    FD_ZERO (rfds);    FD_ZERO (rfds);
1076    nr = 0;    nr = 0;
# Line 1078  sys_select (int nfds, SELECT_TYPE *rfds, Line 1078  sys_select (int nfds, SELECT_TYPE *rfds,
1078    /* Always wait on interrupt_handle, to detect C-g (quit).  */    /* Always wait on interrupt_handle, to detect C-g (quit).  */
1079    wait_hnd[0] = interrupt_handle;    wait_hnd[0] = interrupt_handle;
1080    fdindex[0] = -1;    fdindex[0] = -1;
1081      
1082    /* Build a list of pipe handles to wait on.  */    /* Build a list of pipe handles to wait on.  */
1083    nh = 1;    nh = 1;
1084    for (i = 0; i < nfds; i++)    for (i = 0; i < nfds; i++)
# Line 1195  count_children: Line 1195  count_children:
1195          cps[nc] = cp;          cps[nc] = cp;
1196          nc++;          nc++;
1197        }        }
1198      
1199    /* Nothing to look for, so we didn't find anything */    /* Nothing to look for, so we didn't find anything */
1200    if (nh + nc == 0)    if (nh + nc == 0)
1201      {      {
1202        if (timeout)        if (timeout)
1203          Sleep (timeout_ms);          Sleep (timeout_ms);
1204        return 0;        return 0;
1205      }      }
1206      
1207    start_time = GetTickCount ();    start_time = GetTickCount ();
1208    
1209    /* Wait for input or child death to be signalled.  If user input is    /* Wait for input or child death to be signalled.  If user input is
# Line 1362  find_child_console (HWND hwnd, LPARAM ar Line 1362  find_child_console (HWND hwnd, LPARAM ar
1362    return TRUE;    return TRUE;
1363  }  }
1364    
1365  int  int
1366  sys_kill (int pid, int sig)  sys_kill (int pid, int sig)
1367  {  {
1368    child_process *cp;    child_process *cp;
1369    HANDLE proc_hand;    HANDLE proc_hand;
1370    int need_to_free = 0;    int need_to_free = 0;
1371    int rc = 0;    int rc = 0;
1372      
1373    /* Only handle signals that will result in the process dying */    /* Only handle signals that will result in the process dying */
1374    if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP)    if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP)
1375      {      {
# Line 1396  sys_kill (int pid, int sig) Line 1396  sys_kill (int pid, int sig)
1396        /* Try to locate console window for process. */        /* Try to locate console window for process. */
1397        EnumWindows (find_child_console, (LPARAM) cp);        EnumWindows (find_child_console, (LPARAM) cp);
1398      }      }
1399      
1400    if (sig == SIGINT || sig == SIGQUIT)    if (sig == SIGINT || sig == SIGQUIT)
1401      {      {
1402        if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd)        if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd)
# Line 1572  prepare_standard_handles (int in, int ou Line 1572  prepare_standard_handles (int in, int ou
1572    handles[2] = GetStdHandle (STD_ERROR_HANDLE);    handles[2] = GetStdHandle (STD_ERROR_HANDLE);
1573    
1574    /* make inheritable copies of the new handles */    /* make inheritable copies of the new handles */
1575    if (!DuplicateHandle (parent,    if (!DuplicateHandle (parent,
1576                         (HANDLE) _get_osfhandle (in),                         (HANDLE) _get_osfhandle (in),
1577                         parent,                         parent,
1578                         &newstdin,                         &newstdin,
1579                         0,                         0,
1580                         TRUE,                         TRUE,
1581                         DUPLICATE_SAME_ACCESS))                         DUPLICATE_SAME_ACCESS))
1582      report_file_error ("Duplicating input handle for child", Qnil);      report_file_error ("Duplicating input handle for child", Qnil);
1583      
1584    if (!DuplicateHandle (parent,    if (!DuplicateHandle (parent,
1585                         (HANDLE) _get_osfhandle (out),                         (HANDLE) _get_osfhandle (out),
1586                         parent,                         parent,
# Line 1589  prepare_standard_handles (int in, int ou Line 1589  prepare_standard_handles (int in, int ou
1589                         TRUE,                         TRUE,
1590                         DUPLICATE_SAME_ACCESS))                         DUPLICATE_SAME_ACCESS))
1591      report_file_error ("Duplicating output handle for child", Qnil);      report_file_error ("Duplicating output handle for child", Qnil);
1592      
1593    if (!DuplicateHandle (parent,    if (!DuplicateHandle (parent,
1594                         (HANDLE) _get_osfhandle (err),                         (HANDLE) _get_osfhandle (err),
1595                         parent,                         parent,
# Line 1602  prepare_standard_handles (int in, int ou Line 1602  prepare_standard_handles (int in, int ou
1602    /* and store them as our std handles */    /* and store them as our std handles */
1603    if (!SetStdHandle (STD_INPUT_HANDLE, newstdin))    if (!SetStdHandle (STD_INPUT_HANDLE, newstdin))
1604      report_file_error ("Changing stdin handle", Qnil);      report_file_error ("Changing stdin handle", Qnil);
1605      
1606    if (!SetStdHandle (STD_OUTPUT_HANDLE, newstdout))    if (!SetStdHandle (STD_OUTPUT_HANDLE, newstdout))
1607      report_file_error ("Changing stdout handle", Qnil);      report_file_error ("Changing stdout handle", Qnil);
1608    
# Line 1723  All path elements in FILENAME are conver Line 1723  All path elements in FILENAME are conver
1723    filename = Fexpand_file_name (filename, Qnil);    filename = Fexpand_file_name (filename, Qnil);
1724    
1725    /* luckily, this returns the short version of each element in the path.  */    /* luckily, this returns the short version of each element in the path.  */
1726    if (GetShortPathName (XSTRING (filename)->data, shortname, MAX_PATH) == 0)    if (GetShortPathName (SDATA (filename), shortname, MAX_PATH) == 0)
1727      return Qnil;      return Qnil;
1728    
1729    CORRECT_DIR_SEPS (shortname);    CORRECT_DIR_SEPS (shortname);
# Line 1747  All path elements in FILENAME are conver Line 1747  All path elements in FILENAME are conver
1747    /* first expand it.  */    /* first expand it.  */
1748    filename = Fexpand_file_name (filename, Qnil);    filename = Fexpand_file_name (filename, Qnil);
1749    
1750    if (!w32_get_long_filename (XSTRING (filename)->data, longname, MAX_PATH))    if (!w32_get_long_filename (SDATA (filename), longname, MAX_PATH))
1751      return Qnil;      return Qnil;
1752    
1753    CORRECT_DIR_SEPS (longname);    CORRECT_DIR_SEPS (longname);
# Line 1933  human-readable form.  */) Line 1933  human-readable form.  */)
1933    return make_number (GetUserDefaultLCID ());    return make_number (GetUserDefaultLCID ());
1934  }  }
1935    
1936      
1937  DEFUN ("w32-set-current-locale", Fw32_set_current_locale, Sw32_set_current_locale, 1, 1, 0,  DEFUN ("w32-set-current-locale", Fw32_set_current_locale, Sw32_set_current_locale, 1, 1, 0,
1938         doc: /* Make Windows locale LCID be the current locale setting for Emacs.         doc: /* Make Windows locale LCID be the current locale setting for Emacs.
1939  If successful, the new locale id is returned, otherwise nil.  */)  If successful, the new locale id is returned, otherwise nil.  */)
# Line 1990  DEFUN ("w32-get-console-codepage", Fw32_ Line 1990  DEFUN ("w32-get-console-codepage", Fw32_
1990    return make_number (GetConsoleCP ());    return make_number (GetConsoleCP ());
1991  }  }
1992    
1993      
1994  DEFUN ("w32-set-console-codepage", Fw32_set_console_codepage,  DEFUN ("w32-set-console-codepage", Fw32_set_console_codepage,
1995         Sw32_set_console_codepage, 1, 1, 0,         Sw32_set_console_codepage, 1, 1, 0,
1996         doc: /* Make Windows codepage CP be the current codepage setting for Emacs.         doc: /* Make Windows codepage CP be the current codepage setting for Emacs.
# Line 2019  DEFUN ("w32-get-console-output-codepage" Line 2019  DEFUN ("w32-get-console-output-codepage"
2019    return make_number (GetConsoleOutputCP ());    return make_number (GetConsoleOutputCP ());
2020  }  }
2021    
2022      
2023  DEFUN ("w32-set-console-output-codepage", Fw32_set_console_output_codepage,  DEFUN ("w32-set-console-output-codepage", Fw32_set_console_output_codepage,
2024         Sw32_set_console_output_codepage, 1, 1, 0,         Sw32_set_console_output_codepage, 1, 1, 0,
2025         doc: /* Make Windows codepage CP be the current codepage setting for Emacs.         doc: /* Make Windows codepage CP be the current codepage setting for Emacs.
# Line 2099  The return value is the cons of the lang Line 2099  The return value is the cons of the lang
2099                  make_number ((kl >> 16) & 0xffff));                  make_number ((kl >> 16) & 0xffff));
2100  }  }
2101    
2102      
2103  DEFUN ("w32-set-keyboard-layout", Fw32_set_keyboard_layout,  DEFUN ("w32-set-keyboard-layout", Fw32_set_keyboard_layout,
2104         Sw32_set_keyboard_layout, 1, 1, 0,         Sw32_set_keyboard_layout, 1, 1, 0,
2105         doc: /* Make LAYOUT be the current keyboard layout for Emacs.         doc: /* Make LAYOUT be the current keyboard layout for Emacs.
# Line 2218  process temporarily).  A value of zero d Line 2218  process temporarily).  A value of zero d
2218  This applies when performing completions and file name expansion.  This applies when performing completions and file name expansion.
2219  Note that the value of this setting also affects remote file names,  Note that the value of this setting also affects remote file names,
2220  so you probably don't want to set to non-nil if you use case-sensitive  so you probably don't want to set to non-nil if you use case-sensitive
2221  filesystems via ange-ftp.  */);  filesystems via ange-ftp.  */);
2222    Vw32_downcase_file_names = Qnil;    Vw32_downcase_file_names = Qnil;
2223    
2224  #if 0  #if 0
# Line 2232  the truename of a file can be slow.  */) Line 2232  the truename of a file can be slow.  */)
2232  #endif  #endif
2233    
2234    DEFVAR_LISP ("w32-get-true-file-attributes", &Vw32_get_true_file_attributes,    DEFVAR_LISP ("w32-get-true-file-attributes", &Vw32_get_true_file_attributes,
2235                 doc: /* Non-nil means determine accurate link count in file-attributes.                 doc: /* Non-nil means determine accurate link count in `file-attributes'.
2236  This option slows down file-attributes noticeably, so is disabled by  Note that this option is only useful for files on NTFS volumes, where hard links
2237  default.  Note that it is only useful for files on NTFS volumes,  are supported.  Moreover, it slows down `file-attributes' noticeably.  */);
 where hard links are supported.  */);  
2238    Vw32_get_true_file_attributes = Qt;    Vw32_get_true_file_attributes = Qt;
2239  }  }
2240  /* end of ntproc.c */  /* end of ntproc.c */

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.51.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26