diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-06-13 21:00:37 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-06-13 21:00:37 +0000 |
commit | 4d24003fedd96a6d1e7801d9dd99e48ade5ba410 (patch) | |
tree | 826d02765d6b23f62efc3d5cfd3785629f0a55f7 /app/xfs/os | |
parent | 1d806dfb5f48abe149074e7e3df7b6a7b76f68ba (diff) |
update to xfs 1.0.8.
(The multiple defined symbol problem is not fixed yet)
Diffstat (limited to 'app/xfs/os')
-rw-r--r-- | app/xfs/os/config.c | 44 | ||||
-rw-r--r-- | app/xfs/os/utils.c | 2 | ||||
-rw-r--r-- | app/xfs/os/xfstrans.c | 6 |
3 files changed, 43 insertions, 9 deletions
diff --git a/app/xfs/os/config.c b/app/xfs/os/config.c index e5dbc4801..1abf2afff 100644 --- a/app/xfs/os/config.c +++ b/app/xfs/os/config.c @@ -49,6 +49,8 @@ in this Software without prior written authorization from The Open Group. */ /* $XFree86: xc/programs/xfs/os/config.c,v 3.15 2002/05/31 18:46:12 dawes Exp $ */ +#include <xfs-config.h> + #include <stdio.h> #include <stdlib.h> #include <ctype.h> @@ -66,6 +68,15 @@ in this Software without prior written authorization from The Open Group. #include <X11/fonts/fontutil.h> #include "difs.h" +static const char * const default_config_files[] = { +#ifdef DEFAULT_CONFIG_FILE + DEFAULT_CONFIG_FILE, +#else + "/usr/lib/X11/fs/config", +#endif + NULL +}; + extern int portFromCmdline; static char *font_catalogue = NULL; @@ -285,6 +296,10 @@ SetConfigValues(void) int err, num; + if (font_catalogue == NULL) { + FatalError("font catalogue is missing/empty\n"); + } + err = SetFontCatalogue(font_catalogue, &num); if (err != FSSuccess) { FatalError("element #%d (starting at 0) of font path is bad or has a bad font:\n\"%s\"\n", @@ -315,12 +330,14 @@ char *__XFSRedirRoot(char *fname) } #endif +/* If argument is NULL, uses first file found from default_config_files */ int -ReadConfigFile(char *filename) +ReadConfigFile(const char *filename) { FILE *fp; int ret; int len; + int i; char *data; data = (char *) fsalloc(CONFIG_MAX_FILESIZE); @@ -328,12 +345,31 @@ ReadConfigFile(char *filename) ErrorF(ConfigErrors[CONFIG_ERR_MEMORY], filename); return FSBadAlloc; } + if (filename != NULL) { #ifdef __UNIXOS2__ - filename = __XFSRedirRoot(filename); + filename = __XFSRedirRoot(filename); #endif - if ((fp = fopen(filename, "r")) == NULL) { + fp = fopen(filename, "r"); + if (fp == NULL) { + ErrorF(ConfigErrors[CONFIG_ERR_OPEN], filename); + } + } else { + for (i = 0; default_config_files[i] != NULL; i++) { + filename = default_config_files[i]; +#ifdef __UNIXOS2__ + filename = __XFSRedirRoot(filename); +#endif + if ((fp = fopen(filename, "r")) != NULL) + break; + } + if (fp == NULL) { + for (i = 0; default_config_files[i] != NULL; i++) { + ErrorF(ConfigErrors[CONFIG_ERR_OPEN], default_config_files[i]); + } + } + } + if (fp == NULL) { fsfree(data); - ErrorF(ConfigErrors[CONFIG_ERR_OPEN], filename); return FSBadName; } ret = fread(data, sizeof(char), CONFIG_MAX_FILESIZE, fp); diff --git a/app/xfs/os/utils.c b/app/xfs/os/utils.c index fcc1c2a06..5ee8b6e94 100644 --- a/app/xfs/os/utils.c +++ b/app/xfs/os/utils.c @@ -562,7 +562,7 @@ StorePid (void) strerror (errno)); return -1; } - if (fprintf (pidFilePtr, "%5ld\n", (long) getpid ()) != 6) + if (fprintf (pidFilePtr, "%11ld\n", (long) getpid ()) != 12) { ErrorF ("cannot write to process-id file %s: %s\n", pidFile, strerror (errno)); diff --git a/app/xfs/os/xfstrans.c b/app/xfs/os/xfstrans.c index 0ee846473..f74a23a6b 100644 --- a/app/xfs/os/xfstrans.c +++ b/app/xfs/os/xfstrans.c @@ -1,5 +1,5 @@ /* - * $Id: xfstrans.c,v 1.1 2006/11/26 14:43:47 matthieu Exp $ + * $Id: xfstrans.c,v 1.2 2008/06/13 21:00:36 matthieu Exp $ * * Copyright © 2003 Keith Packard * @@ -22,9 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include <xfs-config.h> #define FONT_t #define TRANS_REOPEN |