fields = sscanf(name, "FONT %s %d %s %d",
strspec = XtMalloc(strlen("FONT %s %d %s %d") + 21); sprintf(strspec, "FONT %%%ds %%d %%%ds %%d", sizeof(source_name) - 1, sizeof(mask_name) - 1); fields = sscanf(name, strspec,
void XmuCvtStringToCursor(args, num_args, fromVal, toVal)    XrmValuePtr args;    Cardinal    *num_args;    XrmValuePtr	fromVal;    XrmValuePtr	toVal;{    static Cursor cursor;		/* static for cvt magic */    char *name = (char *)fromVal->addr;    Screen *screen;    register int i;    char maskname[PATH_MAX];    Pixmap source, mask;    /* XXX - make fg/bg resources */    static XColor bgColor = {0, 0xffff, 0xffff, 0xffff};    static XColor fgColor = {0, 0, 0, 0};    int xhot, yhot;    int len;    if (*num_args != 1)     XtErrorMsg("wrongParameters","cvtStringToCursor","XtToolkitError",             "String to cursor conversion needs screen argument",              (String *)NULL, (Cardinal *)NULL);    screen = *((Screen **) args[0].addr);    if (0 == strncmp(FONTSPECIFIER, name, strlen(FONTSPECIFIER))) {	char source_name[PATH_MAX], mask_name[PATH_MAX];	int source_char, mask_char, fields;	Font source_font, mask_font;	XrmValue fromString, toFont;	XrmValue cvtArg;	Boolean success;	Display *dpy = DisplayOfScreen(screen);#ifdef XMU_KLUDGE	Cardinal num;#endif	fields = sscanf(name, "FONT %s %d %s %d",			source_name, &source_char,			mask_name, &mask_char);	if (fields < 2) {	    XtStringConversionWarning(name, XtRCursor);	    return;	}	fromString.addr = source_name;	fromString.size = strlen(source_name) + 1;	toFont.addr = (XPointer) &source_font;	toFont.size = sizeof(Font);	cvtArg.addr = (XPointer) &dpy;	cvtArg.size = sizeof(Display *);	/* XXX using display of screen argument as message display */#ifdef XMU_KLUDGE	/* XXX Sacrifice caching */	num = 1;	success = XtCvtStringToFont(dpy, &cvtArg, &num, &fromString, &toFont,				    NULL);#else	success = XtCallConverter(dpy, XtCvtStringToFont, &cvtArg,				  (Cardinal)1, &fromString, &toFont, NULL);#endif	if (!success) {	    XtStringConversionWarning(name, XtRCursor);	    return;	}	switch (fields) {	  case 2:		/* defaulted mask font & char */	    mask_font = source_font;	    mask_char = source_char;	    break;	  case 3:		/* defaulted mask font */	    mask_font = source_font;	    mask_char = atoi(mask_name);	    break;	  case 4:		/* specified mask font & char */	    fromString.addr = mask_name;	    fromString.size = strlen(mask_name) + 1;	    toFont.addr = (XPointer) &mask_font;	    toFont.size = sizeof(Font);	    /* XXX using display of screen argument as message display */#ifdef XMU_KLUDGE	    /* XXX Sacrifice caching */	    num = 1;	    success = XtCvtStringToFont(dpy, &cvtArg, &num, &fromString,					&toFont, NULL);#else	    success = XtCallConverter(dpy, XtCvtStringToFont, &cvtArg,				      (Cardinal)1, &fromString, &toFont, NULL);#endif	    if (!success) {		XtStringConversionWarning(name, XtRCursor);		return;	    }	}	cursor = XCreateGlyphCursor( DisplayOfScreen(screen), source_font,				     mask_font, source_char, mask_char,				     &fgColor, &bgColor );	done(&cursor, Cursor);	return;    }    i = XmuCursorNameToIndex (name);    if (i != -1) {	cursor = XCreateFontCursor (DisplayOfScreen(screen), i);	done(&cursor, Cursor);	return;    }    if ((source = XmuLocateBitmapFile (screen, name, 				       maskname, (sizeof maskname) - 4,				       NULL, NULL, &xhot, &yhot)) == None) {	XtStringConversionWarning (name, XtRCursor);    }    len = strlen (maskname);    for (i = 0; i < 2; i++) {	strcpy (maskname + len, i == 0 ? "Mask" : "msk");	if ((mask = XmuLocateBitmapFile (screen, maskname, NULL, 0, 					 NULL, NULL, NULL, NULL)) != None)	  break;    }    cursor = XCreatePixmapCursor( DisplayOfScreen(screen), source, mask,				  &fgColor, &bgColor, xhot, yhot );    XFreePixmap( DisplayOfScreen(screen), source );    if (mask != None) XFreePixmap( DisplayOfScreen(screen), mask );    done(&cursor, Cursor);}