char buf[BUFSIZ];
char buf[BUFSIZ + 1];
xpmParseValues(data, width, height, ncolors, cpp,	    x_hotspot, y_hotspot, hotspot, extensions)    xpmData *data;    unsigned int *width, *height, *ncolors, *cpp;    unsigned int *x_hotspot, *y_hotspot, *hotspot;    unsigned int *extensions;{    unsigned int l;    char buf[BUFSIZ];    if (!data->format) {		/* XPM 2 or 3 */	/*	 * read values: width, height, ncolors, chars_per_pixel	 */	if (!(xpmNextUI(data, width) && xpmNextUI(data, height)	      && xpmNextUI(data, ncolors) && xpmNextUI(data, cpp)))	    return (XpmFileInvalid);	/*	 * read optional information (hotspot and/or XPMEXT) if any	 */	l = xpmNextWord(data, buf, BUFSIZ);	if (l) {	    *extensions = (l == 6 && !strncmp("XPMEXT", buf, 6));	    if (*extensions)		*hotspot = (xpmNextUI(data, x_hotspot)			    && xpmNextUI(data, y_hotspot));	    else {		*hotspot = (xpmatoui(buf, l, x_hotspot)			    && xpmNextUI(data, y_hotspot));		l = xpmNextWord(data, buf, BUFSIZ);		*extensions = (l == 6 && !strncmp("XPMEXT", buf, 6));	    }	}    } else {	/*	 * XPM 1 file read values: width, height, ncolors, chars_per_pixel	 */	int i;	char *ptr;	Bool got_one, saw_width = False, saw_height = False;	Bool saw_ncolors = False, saw_chars_per_pixel = False;	for (i = 0; i < 4; i++) {	    l = xpmNextWord(data, buf, BUFSIZ);	    if (l != 7 || strncmp("#define", buf, 7))		return (XpmFileInvalid);	    l = xpmNextWord(data, buf, BUFSIZ);	    if (!l)		return (XpmFileInvalid);	    buf[l] = '\0';	    ptr = buf;	    got_one = False;	    while (!got_one) {		ptr = index(ptr, '_');		if (!ptr)		    return (XpmFileInvalid);		switch (l - (ptr - buf)) {		case 6:		    if (saw_width || strncmp("_width", ptr, 6)			|| !xpmNextUI(data, width))			return (XpmFileInvalid);		    else			saw_width = True;		    got_one = True;		    break;		case 7:		    if (saw_height || strncmp("_height", ptr, 7)			|| !xpmNextUI(data, height))			return (XpmFileInvalid);		    else			saw_height = True;		    got_one = True;		    break;		case 8:		    if (saw_ncolors || strncmp("_ncolors", ptr, 8)			|| !xpmNextUI(data, ncolors))			return (XpmFileInvalid);		    else			saw_ncolors = True;		    got_one = True;		    break;		case 16:		    if (saw_chars_per_pixel			|| strncmp("_chars_per_pixel", ptr, 16)			|| !xpmNextUI(data, cpp))			return (XpmFileInvalid);		    else			saw_chars_per_pixel = True;		    got_one = True;		    break;		default:		    ptr++;		}	    }	    /* skip the end of line */	    xpmNextString(data);	}	if (!saw_width || !saw_height || !saw_ncolors || !saw_chars_per_pixel)	  return (XpmFileInvalid);	*hotspot = 0;	*extensions = 0;    }    return (XpmSuccess);}