1 --- libXt-1.1.5/src/Intrinsic.c 2015-05-01 07:36:20.000000000 +0200
2 +++ Intrinsic.c 2016-12-12 00:42:16.567388450 +0100
3 @@ -1303,21 +1303,101 @@
4 } else (void) strcpy(*rest, string);
8 - * default path used if environment variable XFILESEARCHPATH
9 - * is not defined. Also substitued for %D.
10 - * The exact value should be documented in the implementation
11 - * notes for any Xt implementation.
15 + Return the default search path for the function
16 + XtResolvePathname to use if XFILESEARCHPATH is
19 + It returns the combination the set of values which are the 6 "stems" below,
20 + prepended with "/run/current-system/profile", and $GUIX_PROFILE and
21 + "$HOME/.guix-profile"
23 + These values provide the default paths where Guix/GuixSD can expect
24 + to find resources for installed packages.
26 -static const char *implementation_default_path(void)
27 +static const char *guix_default_path(void)
30 - static char xfilesearchpath[] = "";
32 - return xfilesearchpath;
34 - return XFILESEARCHPATHDEFAULT;
36 + static const char *search_path_default_stem[] = {
37 + "/lib/X11/%L/%T/%N%C%S",
38 + "/lib/X11/%l/%T/%N%C%S",
39 + "/lib/X11/%T/%N%C%S",
40 + "/lib/X11/%L/%T/%N%S",
41 + "/lib/X11/%l/%T/%N%S",
45 +#define SIZEOF_STEMS (strlen (search_path_default_stem[0]) \
46 + + strlen (search_path_default_stem[1]) \
47 + + strlen (search_path_default_stem[2]) \
48 + + strlen (search_path_default_stem[3]) \
49 + + strlen (search_path_default_stem[4]) \
50 + + strlen (search_path_default_stem[5]))
54 + const char *current_profile = "/run/current-system/profile";
55 + char *home = getenv ("HOME");
56 + char *guix_profile = getenv ("GUIX_PROFILE");
58 + size_t bytesAllocd = SIZEOF_STEMS + 1;
60 + /* This function is evaluated multiple times and the calling
61 + code assumes that it is idempotent. So we must not allow
62 + (say) a changed environment variable to cause it to return
63 + something different. */
64 + static char *path = NULL;
68 + bytesAllocd += 6 * (1 + strlen (current_profile));
70 + if (guix_profile != NULL)
72 + bytesAllocd += SIZEOF_STEMS;
73 + bytesAllocd += 6 * (1 + strlen (guix_profile));
78 + bytesAllocd += SIZEOF_STEMS;
79 + bytesAllocd += 6 * (1 + strlen(home) + strlen ("/.guix-profile"));
82 + path = XtMalloc(bytesAllocd);
83 + if (path == NULL) _XtAllocError(NULL);
85 + memset (path, 0, bytesAllocd);
87 + for (i = 0 ; i < 6 ; ++i)
89 + strcat (path, current_profile);
90 + strcat (path, search_path_default_stem[i]);
94 + if (guix_profile != NULL)
95 + for (i = 0 ; i < 6 ; ++i)
97 + strcat (path, guix_profile);
98 + strcat (path, search_path_default_stem[i]);
103 + for (i = 0 ; i < 6 ; ++i)
105 + strcat (path, home);
106 + strcat (path, "/.guix-profile");
107 + strcat (path, search_path_default_stem[i]);
108 + strcat (path, ":");
111 + /* Remove final : */
112 + path[strlen(path) - 1] = '\0';
118 @@ -1345,7 +1425,7 @@
121 static const char *defaultPath = NULL;
122 - const char *impl_default = implementation_default_path();
123 + const char *impl_default = guix_default_path();
124 int idef_len = strlen(impl_default);
126 int bytesAllocd, bytesLeft;