comparison src/sysdep.c @ 4834:b3ea9c582280

Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
author Ben Wing <ben@xemacs.org>
date Tue, 12 Jan 2010 01:38:04 -0600
parents 217abcf015c4
children 95c4ced5c07c
comparison
equal deleted inserted replaced
4833:4dd2389173fc 4834:b3ea9c582280
3090 3090
3091 for (argc = 0; argv[argc]; argc++) 3091 for (argc = 0; argv[argc]; argc++)
3092 ; 3092 ;
3093 new_argv = alloca_array (Extbyte *, argc + 1); 3093 new_argv = alloca_array (Extbyte *, argc + 1);
3094 for (i = 0; i < argc; i++) 3094 for (i = 0; i < argc; i++)
3095 C_STRING_TO_EXTERNAL (argv[i], new_argv[i], Qnative); 3095 C_STRING_TO_EXTERNAL (argv[i], new_argv[i], Qcommand_argument_encoding);
3096 new_argv[argc] = NULL; 3096 new_argv[argc] = NULL;
3097 3097
3098 for (envc = 0; envp[envc]; envc++) 3098 for (envc = 0; envp[envc]; envc++)
3099 ; 3099 ;
3100 new_envp = alloca_array (Extbyte *, envc + 1); 3100 new_envp = alloca_array (Extbyte *, envc + 1);
3101 for (i = 0; i < envc; i++) 3101 for (i = 0; i < envc; i++)
3102 C_STRING_TO_EXTERNAL (envp[i], new_envp[i], Qnative); 3102 C_STRING_TO_EXTERNAL (envp[i], new_envp[i],
3103 Qenvironment_variable_encoding);
3103 new_envp[envc] = NULL; 3104 new_envp[envc] = NULL;
3104 3105
3105 #if defined (WIN32_NATIVE) 3106 #if defined (WIN32_NATIVE)
3106 if (XEUNICODE_P) 3107 if (XEUNICODE_P)
3107 return _wexecve ((const wchar_t *) pathext, 3108 return _wexecve ((const wchar_t *) pathext,
3144 xfree (cached_pwd.pw_shell, char *); 3145 xfree (cached_pwd.pw_shell, char *);
3145 3146
3146 cached_pwd = *pwd; 3147 cached_pwd = *pwd;
3147 if (cached_pwd.pw_name) 3148 if (cached_pwd.pw_name)
3148 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_name, 3149 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_name,
3149 C_STRING_MALLOC, cached_pwd.pw_name, Qnative); 3150 C_STRING_MALLOC, cached_pwd.pw_name,
3151 Quser_name_encoding);
3150 if (cached_pwd.pw_passwd) 3152 if (cached_pwd.pw_passwd)
3151 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_passwd, 3153 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_passwd,
3152 C_STRING_MALLOC, cached_pwd.pw_passwd, Qnative); 3154 C_STRING_MALLOC, cached_pwd.pw_passwd,
3155 Quser_name_encoding);
3153 if (cached_pwd.pw_gecos) 3156 if (cached_pwd.pw_gecos)
3154 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_gecos, 3157 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_gecos,
3155 C_STRING_MALLOC, cached_pwd.pw_gecos, Qnative); 3158 C_STRING_MALLOC, cached_pwd.pw_gecos,
3159 Quser_name_encoding);
3156 if (cached_pwd.pw_dir) 3160 if (cached_pwd.pw_dir)
3157 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_dir, 3161 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_dir,
3158 C_STRING_MALLOC, cached_pwd.pw_dir, Qfile_name); 3162 C_STRING_MALLOC, cached_pwd.pw_dir, Qfile_name);
3159 if (cached_pwd.pw_shell) 3163 if (cached_pwd.pw_shell)
3160 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_shell, 3164 TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_shell,
3168 #ifdef WIN32_NATIVE 3172 #ifdef WIN32_NATIVE
3169 /* Synthetic versions are defined in nt.c and already do conversion. */ 3173 /* Synthetic versions are defined in nt.c and already do conversion. */
3170 return getpwnam (name); 3174 return getpwnam (name);
3171 #else 3175 #else
3172 Extbyte *nameext; 3176 Extbyte *nameext;
3173 C_STRING_TO_EXTERNAL (name, nameext, Qnative); 3177 C_STRING_TO_EXTERNAL (name, nameext, Quser_name_encoding);
3174 3178
3175 return copy_in_passwd (getpwnam (nameext)); 3179 return copy_in_passwd (getpwnam (nameext));
3176 #endif /* WIN32_NATIVE */ 3180 #endif /* WIN32_NATIVE */
3177 } 3181 }
3178 3182
3208 Extbyte *str = (Extbyte *) ctime (t); 3212 Extbyte *str = (Extbyte *) ctime (t);
3209 if (!str) /* can happen on MS Windows */ 3213 if (!str) /* can happen on MS Windows */
3210 return (Ibyte *) "Sun Jan 01 00:00:00 1970"; 3214 return (Ibyte *) "Sun Jan 01 00:00:00 1970";
3211 if (ctime_static) 3215 if (ctime_static)
3212 xfree (ctime_static, Ibyte *); 3216 xfree (ctime_static, Ibyte *);
3213 EXTERNAL_TO_C_STRING_MALLOC (str, ctime_static, Qnative); 3217 EXTERNAL_TO_C_STRING_MALLOC (str, ctime_static, Qtime_function_encoding);
3214 return ctime_static; 3218 return ctime_static;
3215 } 3219 }
3216 3220
3217 3221
3218 /************************************************************************/ 3222 /************************************************************************/