rem: struct stat		stat_buf; FILE			*rgbtxt; char			line[MAX_LENGTH]; int				red, green, blue; char			name[48]; RColor			*color; WMListItem		*item;  if (stat(RGBTXT, &stat_buf) != 0) { wwarning("Cannot find file %s", RGBTXT); return; } else { rgbtxt = fopen(RGBTXT, "r"); if (rgbtxt) { while (fgets(line, MAX_LENGTH, rgbtxt)) { if (sscanf(line, "%d%d%d %[^\n]", &red, &green, &blue, name)) { color = wmalloc(sizeof(RColor)); color->red = (unsigned char)red; color->green = (unsigned char)green; color->blue = (unsigned char)blue; item = WMAddListItem(panel->colorListContentLst, name); item->clientData = (void *)color; } } fclose(rgbtxt); } else { wwarning("Unable to open file %s for reading", RGBTXT); } }
add: struct stat        stat_buf; FILE            *rgbtxt; char            line[MAX_LENGTH]; int                red, green, blue; char            name[48]; RColor            *color; WMListItem        *item;  if (stat(RGBTXT, &stat_buf) != 0) { wwarning("Cannot find file %s", RGBTXT); return; } else { rgbtxt = fopen(RGBTXT, "r"); if (rgbtxt) { while (fgets(line, MAX_LENGTH, rgbtxt)) { if (sscanf(line, "%d%d%d %[^\n]", &red, &green, &blue, name)) { color = wmalloc(sizeof(RColor)); color->red = (unsigned char)red; color->green = (unsigned char)green; color->blue = (unsigned char)blue; item = WMAddListItem(panel->colorListContentLst, name); item->clientData = (void *)color; } } fclose(rgbtxt); } else { wsyserror("Unable to open file %s for reading", RGBTXT); } }
context: readXColors(W_ColorPanel *panel){	struct stat		stat_buf;	FILE			*rgbtxt;	char			line[MAX_LENGTH];	int				red, green, blue;	char			name[48];	RColor			*color;	WMListItem		*item;		if (stat(RGBTXT, &stat_buf) != 0) {		wwarning("Cannot find file %s", RGBTXT);		return;	}	else {		rgbtxt = fopen(RGBTXT, "r");		if (rgbtxt) {			while (fgets(line, MAX_LENGTH, rgbtxt)) {				if (sscanf(line, "%d%d%d %[^\n]", &red, &green, &blue, name)) {					color = wmalloc(sizeof(RColor));					color->red = (unsigned char)red;					color->green = (unsigned char)green;					color->blue = (unsigned char)blue;					item = WMAddListItem(panel->colorListContentLst, name);					item->clientData = (void *)color;				}			}			fclose(rgbtxt);		}		else {			wwarning("Unable to open file %s for reading", RGBTXT);		}	}}