diff options
| author | Karl Heuer | 1994-02-02 06:26:21 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-02-02 06:26:21 +0000 |
| commit | e29ad34213505cc9a0ef68130d15d8262a2bb763 (patch) | |
| tree | 2cddabee10ed5bd52c123a967c27894a327b0ffd /src | |
| parent | 67004ffb7a9afa613b753655848a11424bda1734 (diff) | |
| download | emacs-e29ad34213505cc9a0ef68130d15d8262a2bb763.tar.gz emacs-e29ad34213505cc9a0ef68130d15d8262a2bb763.zip | |
(x_get_customization_string): Use get_system_name instead of gethostname.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xrdb.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/xrdb.c b/src/xrdb.c index d3f22c91610..112badf3629 100644 --- a/src/xrdb.c +++ b/src/xrdb.c | |||
| @@ -77,6 +77,8 @@ extern struct passwd *getpwuid (); | |||
| 77 | extern struct passwd *getpwnam (); | 77 | extern struct passwd *getpwnam (); |
| 78 | #endif | 78 | #endif |
| 79 | 79 | ||
| 80 | extern char *get_system_name (); | ||
| 81 | |||
| 80 | /* Make sure not to #include anything after these definitions. Let's | 82 | /* Make sure not to #include anything after these definitions. Let's |
| 81 | not step on anyone's prototypes. */ | 83 | not step on anyone's prototypes. */ |
| 82 | #ifdef emacs | 84 | #ifdef emacs |
| @@ -481,26 +483,12 @@ get_environ_db () | |||
| 481 | { | 483 | { |
| 482 | XrmDatabase db; | 484 | XrmDatabase db; |
| 483 | char *p; | 485 | char *p; |
| 484 | char *path = 0, *home = 0, *host = 0; | 486 | char *path = 0, *home = 0, *host; |
| 485 | 487 | ||
| 486 | if ((p = getenv ("XENVIRONMENT")) == NULL) | 488 | if ((p = getenv ("XENVIRONMENT")) == NULL) |
| 487 | { | 489 | { |
| 488 | home = gethomedir (); | 490 | home = gethomedir (); |
| 489 | 491 | host = get_system_name (); | |
| 490 | { | ||
| 491 | int host_size = 100; | ||
| 492 | host = (char *) malloc (host_size); | ||
| 493 | |||
| 494 | for (;;) | ||
| 495 | { | ||
| 496 | host[host_size - 1] = '\0'; | ||
| 497 | gethostname (host, host_size - 1); | ||
| 498 | if (strlen (host) < host_size - 1) | ||
| 499 | break; | ||
| 500 | host = (char *) realloc (host, host_size *= 2); | ||
| 501 | } | ||
| 502 | } | ||
| 503 | |||
| 504 | path = (char *) malloc (strlen (home) | 492 | path = (char *) malloc (strlen (home) |
| 505 | + sizeof (".Xdefaults-") | 493 | + sizeof (".Xdefaults-") |
| 506 | + strlen (host)); | 494 | + strlen (host)); |
| @@ -512,7 +500,6 @@ get_environ_db () | |||
| 512 | 500 | ||
| 513 | if (path) free (path); | 501 | if (path) free (path); |
| 514 | if (home) free (home); | 502 | if (home) free (home); |
| 515 | if (host) free (host); | ||
| 516 | 503 | ||
| 517 | return db; | 504 | return db; |
| 518 | } | 505 | } |