if (strlen(BITMAPDIR) + strlen(name) + 2 > sizeof(filename)) continue;
Pixmap XmuLocatePixmapFile (Screen *screen, _Xconst char *name, 			    unsigned long fore, unsigned long back, 			    unsigned int depth, 			    char *srcname, int srcnamelen,			    int *widthp, int *heightp, int *xhotp, int *yhotp)#elsePixmap XmuLocatePixmapFile (screen, name, fore, back, depth, 			    srcname, srcnamelen,			    widthp, heightp, xhotp, yhotp)    Screen *screen;    char *name;    unsigned long fore, back;    unsigned int depth;    char *srcname;			/* RETURN */    int srcnamelen;    int *widthp, *heightp, *xhotp, *yhotp;  /* RETURN */#endif{    Display *dpy = DisplayOfScreen (screen);    Window root = RootWindowOfScreen (screen);    Bool try_plain_name = True;    XmuCvtCache *cache = _XmuCCLookupDisplay (dpy);    char **file_paths = (char **) NULL;    char filename[PATH_MAX];    unsigned int width, height;    int xhot, yhot;    int i;    /*     * look in cache for bitmap path     */    if (cache) {	if (!cache->string_to_bitmap.bitmapFilePath) {	    XrmName xrm_name[2];	    XrmClass xrm_class[2];	    XrmRepresentation rep_type;	    XrmValue value;	    xrm_name[0] = XrmPermStringToQuark ("bitmapFilePath");	    xrm_name[1] = NULLQUARK;	    xrm_class[0] = XrmPermStringToQuark ("BitmapFilePath");	    xrm_class[1] = NULLQUARK;	    if (!XrmGetDatabase(dpy)) {		/* what a hack; need to initialize it */		(void) XGetDefault (dpy, "", "");	    }	    if (XrmQGetResource (XrmGetDatabase(dpy), xrm_name, xrm_class, 				 &rep_type, &value) &&		rep_type == XrmPermStringToQuark("String")) {		cache->string_to_bitmap.bitmapFilePath = 		  split_path_string (value.addr);	    }	}	file_paths = cache->string_to_bitmap.bitmapFilePath;    }    /*     * Search order:     *    1.  name if it begins with / or ./     *    2.  "each prefix in file_paths"/name     *    3.  BITMAPDIR/name     *    4.  name if didn't begin with / or .     */#ifndef BITMAPDIR#define BITMAPDIR "/usr/include/X11/bitmaps"#endif    for (i = 1; i <= 4; i++) {	char *fn = filename;	Pixmap pixmap;	unsigned char *data;	switch (i) {	  case 1:#ifndef __EMX__	    if (!(name[0] == '/' || (name[0] == '.') && name[1] == '/')) #else	    if (!(name[0] == '/' || (name[0] == '.' && name[1] == '/') ||		  (isalpha(name[0]) && name[1] == ':')))#endif	      continue;	    fn = (char *) name;	    try_plain_name = False;	    break;	  case 2:	    if (file_paths && *file_paths) {		sprintf (filename, "%s/%s", *file_paths, name);		file_paths++;		i--;		break;	    }	    continue;	  case 3:	    sprintf (filename, "%s/%s", BITMAPDIR, name);	    break;	  case 4:	    if (!try_plain_name) continue;	    fn = (char *) name;	    break;	}	data = NULL;	pixmap = None;#ifdef __EMX__	fn = (char*)__XOS2RedirRoot(fn);#endif	if (XmuReadBitmapDataFromFile (fn, &width, &height, &data,				       &xhot, &yhot) == BitmapSuccess) {	    pixmap = XCreatePixmapFromBitmapData (dpy, root, (char *) data,						  width, height,						  fore, back, depth);	    XFree ((char *)data);	}	if (pixmap) {	    if (widthp) *widthp = (int)width;	    if (heightp) *heightp = (int)height;	    if (xhotp) *xhotp = xhot;	    if (yhotp) *yhotp = yhot;	    if (srcname && srcnamelen > 0) {		strncpy (srcname, fn, srcnamelen - 1);		srcname[srcnamelen - 1] = '\0';	    }	    return pixmap;	}    }    return None;}