1 --- XFree86-3.3.3.1/xc/programs/xfs/difs/fonts.c.xfsredhat Fri Jan 5 08:21:27 1996
2 +++ XFree86-3.3.3.1/xc/programs/xfs/difs/fonts.c Wed Feb 17 12:03:19 1999
8 + * Extract a single element from the font path string starting at
9 + * pnt. The font path element will be returned, and pnt will be
10 + * updated to point to the start of the next element, or set to
11 + * NULL if there are no more.
20 + *pnt = index(*pnt, ',');
29 + * xf86ValidateFontPath --
30 + * Validates the user-specified font path. Each element that
31 + * begins with a '/' is checked to make sure the directory exists.
32 + * If the directory exists, the existence of a file named 'fonts.dir'
33 + * is checked. If either check fails, an error is printed and the
34 + * element is removed from the font path.
36 +#define DIR_FILE "/fonts.dir"
37 +#define CHECK_TYPE(mode, type) ((S_IFMT & (mode)) == (type))
39 +xf86ValidateFontPath(path)
42 + char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
43 + struct stat stat_buf;
47 + tmp_path = (char *)calloc(1,strlen(path)+1);
51 + while (next != NULL) {
52 + path_elem = xf86GetPathElem(&next);
54 + if (*path_elem == '/') {
55 + dir_elem = (char *)calloc(1, strlen(path_elem) + 1);
56 + if ((p1 = strchr(path_elem, ':')) != 0)
58 + /* OS/2 must prepend X11ROOT */
59 + if (*path_elem == '/') {
60 + path_elem = (char*)__XOS2RedirRoot(path_elem);
61 + dir_elem = (char*)calloc(1, strlen(path_elem) + 1);
62 + if (p1 = strchr(path_elem+2, ':'))
64 + dirlen = p1 - path_elem;
66 + dirlen = strlen(path_elem);
67 + strncpy(dir_elem, path_elem, dirlen);
68 + dir_elem[dirlen] = '\0';
69 + flag = stat(dir_elem, &stat_buf);
71 + if (!CHECK_TYPE(stat_buf.st_mode, S_IFDIR))
74 + printf("warning!\n");
75 + ErrorF("Warning: The directory \"%s\" does not exist.\n", dir_elem);
76 + ErrorF(" Entry deleted from font path.\n");
80 + p1 = (char *)malloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
81 + strcpy(p1, dir_elem);
82 + strcat(p1, DIR_FILE);
83 + flag = stat(p1, &stat_buf);
85 + if (!CHECK_TYPE(stat_buf.st_mode, S_IFREG))
91 + ErrorF("Warning: 'fonts.dir' not found (or not valid) in \"%s\".\n",
93 + ErrorF(" Entry deleted from font path.\n");
94 + ErrorF(" (Run 'mkfontdir' on \"%s\").\n", dir_elem);
102 + * Either an OK directory, or a font server name. So add it to
105 + if (out_pnt != tmp_path)
107 + strcat(out_pnt, path_elem);
108 + out_pnt += strlen(path_elem);
114 * note that the font wakeup queue is not refcounted. this is because
115 * an fpe needs to be added when it's inited, and removed when it's finally
116 * freed, in order to handle any data that isn't requested, like FS events.
123 + fixedpath = xf86ValidateFontPath(str);
125 - len = strlen(str) + 1;
126 + len = strlen(fixedpath) + 1;
128 paths = p = (char *) ALLOCATE_LOCAL(len);
133 err = set_font_path_elements(npaths, paths, badpath);
136 DEALLOCATE_LOCAL(paths);
139 --- XFree86-3.3.3.1/xc/programs/xfs/difs/main.c.xfsredhat Thu Nov 5 14:28:29 1998
140 +++ XFree86-3.3.3.1/xc/programs/xfs/difs/main.c Wed Feb 17 17:08:27 1999
142 #include "servermd.h"
147 char *ConnectionInfo;
150 ErrorF("fatal: couldn't read config file\n");