diff options
| author | Joakim Verona | 2012-12-08 12:41:32 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-12-08 12:41:32 +0100 |
| commit | 382215a36fafe855326b60456d67589f706f4cd1 (patch) | |
| tree | 5080febb02d4a5f3013db3542e66aa8b3a189be7 | |
| parent | 1fb8a4e045a5ace9d6d22ed61b9d77179643229a (diff) | |
| parent | 75ceee05671c1698e27e5188487e7e74c490f201 (diff) | |
| download | emacs-382215a36fafe855326b60456d67589f706f4cd1.tar.gz emacs-382215a36fafe855326b60456d67589f706f4cd1.zip | |
auto upstream
| -rw-r--r-- | nt/ChangeLog | 6 | ||||
| -rw-r--r-- | nt/config.nt | 3 | ||||
| -rw-r--r-- | nt/inc/ms-w32.h | 6 | ||||
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/w32.c | 44 |
5 files changed, 63 insertions, 0 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog index 3cbe45fbd0e..df6a42595ad 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-12-08 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * inc/ms-w32.h (putenv): Redirect to sys_putenv. | ||
| 4 | |||
| 5 | * config.nt (HAVE_UNSETENV): Define to 1. | ||
| 6 | |||
| 1 | 2012-12-01 Juanma Barranquero <lekktu@gmail.com> | 7 | 2012-12-01 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 8 | ||
| 3 | * config.nt: Sync with autogen/config.in. | 9 | * config.nt: Sync with autogen/config.in. |
diff --git a/nt/config.nt b/nt/config.nt index baa10198a8c..e83c9ff655f 100644 --- a/nt/config.nt +++ b/nt/config.nt | |||
| @@ -993,6 +993,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 993 | /* Define to 1 if the system has the type 'unsigned long long int'. */ | 993 | /* Define to 1 if the system has the type 'unsigned long long int'. */ |
| 994 | #undef HAVE_UNSIGNED_LONG_LONG_INT | 994 | #undef HAVE_UNSIGNED_LONG_LONG_INT |
| 995 | 995 | ||
| 996 | /* Define to 1 if you have the `unsetenv' function. */ | ||
| 997 | #define HAVE_UNSETENV 1 | ||
| 998 | |||
| 996 | /* Define to 1 if you have the <util.h> header file. */ | 999 | /* Define to 1 if you have the <util.h> header file. */ |
| 997 | #undef HAVE_UTIL_H | 1000 | #undef HAVE_UTIL_H |
| 998 | 1001 | ||
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 7b16ccab069..1cbcb7f88f3 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h | |||
| @@ -376,6 +376,12 @@ extern char *get_emacs_configuration_options (void); | |||
| 376 | #define sys_nerr _sys_nerr | 376 | #define sys_nerr _sys_nerr |
| 377 | #endif | 377 | #endif |
| 378 | 378 | ||
| 379 | /* This must be after including stdlib.h, which defines putenv on MinGW. */ | ||
| 380 | #ifdef putenv | ||
| 381 | # undef putenv | ||
| 382 | #endif | ||
| 383 | #define putenv sys_putenv | ||
| 384 | |||
| 379 | extern int getloadavg (double *, int); | 385 | extern int getloadavg (double *, int); |
| 380 | extern int getpagesize (void); | 386 | extern int getpagesize (void); |
| 381 | 387 | ||
diff --git a/src/ChangeLog b/src/ChangeLog index 8e1e422d154..3e8b8519ba3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-12-08 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32.c (unsetenv, sys_putenv): New functions. | ||
| 4 | |||
| 1 | 2012-12-08 Chong Yidong <cyd@gnu.org> | 5 | 2012-12-08 Chong Yidong <cyd@gnu.org> |
| 2 | 6 | ||
| 3 | * editfns.c (Finsert_char): Make the error message more | 7 | * editfns.c (Finsert_char): Make the error message more |
| @@ -1544,6 +1544,50 @@ is_unc_volume (const char *filename) | |||
| 1544 | return 1; | 1544 | return 1; |
| 1545 | } | 1545 | } |
| 1546 | 1546 | ||
| 1547 | /* Emulate the Posix unsetenv. */ | ||
| 1548 | int | ||
| 1549 | unsetenv (const char *name) | ||
| 1550 | { | ||
| 1551 | char *var; | ||
| 1552 | size_t name_len; | ||
| 1553 | int retval; | ||
| 1554 | |||
| 1555 | if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) | ||
| 1556 | { | ||
| 1557 | errno = EINVAL; | ||
| 1558 | return -1; | ||
| 1559 | } | ||
| 1560 | name_len = strlen (name); | ||
| 1561 | /* MS docs says an environment variable cannot be longer than 32K. */ | ||
| 1562 | if (name_len > 32767) | ||
| 1563 | { | ||
| 1564 | errno = ENOMEM; | ||
| 1565 | return -1; | ||
| 1566 | } | ||
| 1567 | /* It is safe to use 'alloca' with 32K size, since the stack is at | ||
| 1568 | least 2MB, and we set it to 8MB in the link command line. */ | ||
| 1569 | var = alloca (name_len + 2); | ||
| 1570 | var[name_len++] = '='; | ||
| 1571 | var[name_len] = '\0'; | ||
| 1572 | return _putenv (var); | ||
| 1573 | } | ||
| 1574 | |||
| 1575 | /* MS _putenv doesn't support removing a variable when the argument | ||
| 1576 | does not include the '=' character, so we fix that here. */ | ||
| 1577 | int | ||
| 1578 | sys_putenv (char *str) | ||
| 1579 | { | ||
| 1580 | const char *const name_end = strchr (str, '='); | ||
| 1581 | |||
| 1582 | if (name_end == NULL) | ||
| 1583 | { | ||
| 1584 | /* Remove the variable from the environment. */ | ||
| 1585 | return unsetenv (str); | ||
| 1586 | } | ||
| 1587 | |||
| 1588 | return _putenv (str); | ||
| 1589 | } | ||
| 1590 | |||
| 1547 | #define REG_ROOT "SOFTWARE\\GNU\\Emacs" | 1591 | #define REG_ROOT "SOFTWARE\\GNU\\Emacs" |
| 1548 | 1592 | ||
| 1549 | LPBYTE | 1593 | LPBYTE |