diff options
| author | Eli Zaretskii | 2013-12-07 14:00:10 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-12-07 14:00:10 +0200 |
| commit | 94ae1542354539a0660b21cf3b7a5143139b8375 (patch) | |
| tree | 89148c0daaa32bb971351cefa5540ec33a00026d /src | |
| parent | 17788cb3da557d2d5c2dda8f7dedb80999a48242 (diff) | |
| download | emacs-94ae1542354539a0660b21cf3b7a5143139b8375.tar.gz emacs-94ae1542354539a0660b21cf3b7a5143139b8375.zip | |
Tested subprogram invocation, fixed decode_env_path.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 33 | ||||
| -rw-r--r-- | src/w32.c | 2 | ||||
| -rw-r--r-- | src/w32proc.c | 2 |
3 files changed, 33 insertions, 4 deletions
diff --git a/src/emacs.c b/src/emacs.c index 3e9635fd229..9f41bc251ea 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -36,6 +36,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 36 | #ifdef WINDOWSNT | 36 | #ifdef WINDOWSNT |
| 37 | #include <fcntl.h> | 37 | #include <fcntl.h> |
| 38 | #include <sys/socket.h> | 38 | #include <sys/socket.h> |
| 39 | #include <mbstring.h> | ||
| 39 | #include "w32.h" | 40 | #include "w32.h" |
| 40 | #include "w32heap.h" | 41 | #include "w32heap.h" |
| 41 | #endif | 42 | #endif |
| @@ -2205,8 +2206,36 @@ decode_env_path (const char *evarname, const char *defalt) | |||
| 2205 | char *path_copy; | 2206 | char *path_copy; |
| 2206 | 2207 | ||
| 2207 | #ifdef WINDOWSNT | 2208 | #ifdef WINDOWSNT |
| 2208 | path_copy = alloca (MAX_UTF8_PATH); | 2209 | char *path_utf8, *q, *d; |
| 2209 | filename_from_ansi (path, path_copy); | 2210 | int cnv_result; |
| 2211 | |||
| 2212 | /* Convert each element of PATH to UTF-8. */ | ||
| 2213 | p = path_copy = alloca (strlen (path) + 1); | ||
| 2214 | strcpy (path_copy, path); | ||
| 2215 | d = path_utf8 = alloca (4 * strlen (path) + 1); | ||
| 2216 | *d = '\0'; | ||
| 2217 | do { | ||
| 2218 | q = _mbschr (p, SEPCHAR); | ||
| 2219 | if (q) | ||
| 2220 | *q = '\0'; | ||
| 2221 | cnv_result = filename_from_ansi (p, d); | ||
| 2222 | if (q) | ||
| 2223 | { | ||
| 2224 | *q++ = SEPCHAR; | ||
| 2225 | p = q; | ||
| 2226 | /* If conversion of this PATH elements fails, make sure | ||
| 2227 | destination pointer will stay put, thus effectively | ||
| 2228 | ignoring the offending element. */ | ||
| 2229 | if (cnv_result == 0) | ||
| 2230 | { | ||
| 2231 | d += strlen (d); | ||
| 2232 | *d++ = SEPCHAR; | ||
| 2233 | } | ||
| 2234 | } | ||
| 2235 | else if (cnv_result != 0 && d > path_utf8) | ||
| 2236 | d[-1] = '\0'; /* remove last semi-colon and null-terminate PATH */ | ||
| 2237 | } while (q); | ||
| 2238 | path_copy = path_utf8; | ||
| 2210 | #else /* MSDOS */ | 2239 | #else /* MSDOS */ |
| 2211 | path_copy = alloca (strlen (path) + 1); | 2240 | path_copy = alloca (strlen (path) + 1); |
| 2212 | strcpy (path_copy, path); | 2241 | strcpy (path_copy, path); |
| @@ -2020,7 +2020,7 @@ normalize_filename (register char *fp, char path_sep) | |||
| 2020 | 2020 | ||
| 2021 | while (*fp) | 2021 | while (*fp) |
| 2022 | { | 2022 | { |
| 2023 | if (*fp == '/' || *fp == '\\') | 2023 | if ((*fp == '/' || *fp == '\\') && *fp != path_sep) |
| 2024 | *fp = path_sep; | 2024 | *fp = path_sep; |
| 2025 | fp++; | 2025 | fp++; |
| 2026 | } | 2026 | } |
diff --git a/src/w32proc.c b/src/w32proc.c index 76d8bb19cf8..d2751d50680 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -1619,7 +1619,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) | |||
| 1619 | return -1; | 1619 | return -1; |
| 1620 | } | 1620 | } |
| 1621 | /* From here on, CMDNAME is an ANSI-encoded string. */ | 1621 | /* From here on, CMDNAME is an ANSI-encoded string. */ |
| 1622 | cmdname = cmdname_a | 1622 | cmdname = cmdname_a; |
| 1623 | argv[0] = cmdname; | 1623 | argv[0] = cmdname; |
| 1624 | 1624 | ||
| 1625 | /* Determine whether program is a 16-bit DOS executable, or a 32-bit Windows | 1625 | /* Determine whether program is a 16-bit DOS executable, or a 32-bit Windows |