diff options
| author | Paul Eggert | 2016-06-01 21:00:58 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-06-01 21:09:17 -0700 |
| commit | 6b985764f07ae164d8142ba64774f2beb2856ca8 (patch) | |
| tree | 8e4d3deb0d0c798f00489e4dc743737925296d76 /src | |
| parent | 1e5539e0b35d2a7fcd1f1772c4532430cb18471b (diff) | |
| download | emacs-6b985764f07ae164d8142ba64774f2beb2856ca8.tar.gz emacs-6b985764f07ae164d8142ba64774f2beb2856ca8.zip | |
Port angle-bracket TZ settings to MS-Windows
* doc/lispref/os.texi (Time Zone Rules): Document MS-Windows
lack of support for numeric time zone abbreviations.
* src/w32.c (sys_putenv): Convert angle-bracket TZ syntax
to MS-compatible syntax if possible, and to "ZZZ" otherwise.
Problem reported by Kazuhiro Ito (Bug#23600).
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32.c | 29 |
1 files changed, 29 insertions, 0 deletions
| @@ -2505,6 +2505,35 @@ sys_putenv (char *str) | |||
| 2505 | return unsetenv (str); | 2505 | return unsetenv (str); |
| 2506 | } | 2506 | } |
| 2507 | 2507 | ||
| 2508 | if (strncmp (str, "TZ=<", 4) == 0) | ||
| 2509 | { | ||
| 2510 | /* MS-Windows does not support POSIX.1-2001 angle-bracket TZ | ||
| 2511 | abbreviation syntax. Convert to POSIX.1-1988 syntax if possible, | ||
| 2512 | and to the undocumented placeholder "ZZZ" otherwise. */ | ||
| 2513 | bool supported_abbr = true; | ||
| 2514 | for (char *p = str + 4; *p; p++) | ||
| 2515 | { | ||
| 2516 | if (('0' <= *p && *p <= '9') || *p == '-' || *p == '+') | ||
| 2517 | supported_abbr = false; | ||
| 2518 | else if (*p == '>') | ||
| 2519 | { | ||
| 2520 | ptrdiff_t abbrlen; | ||
| 2521 | if (supported_abbr) | ||
| 2522 | { | ||
| 2523 | abbrlen = p - (str + 4); | ||
| 2524 | memmove (str + 3, str + 4, abbrlen); | ||
| 2525 | } | ||
| 2526 | else | ||
| 2527 | { | ||
| 2528 | abbrlen = 3; | ||
| 2529 | memset (str + 3, 'Z', abbrlen); | ||
| 2530 | } | ||
| 2531 | memmove (str + 3 + abbrlen, p + 1, strlen (p)); | ||
| 2532 | break; | ||
| 2533 | } | ||
| 2534 | } | ||
| 2535 | } | ||
| 2536 | |||
| 2508 | return _putenv (str); | 2537 | return _putenv (str); |
| 2509 | } | 2538 | } |
| 2510 | 2539 | ||