rem: else
add: else { #ifdef EAGLECAD_KLUDGE fprintf(stderr,"EagleCad bug detected: Defaults to omit leading zeroes\n"); ungetc(op[0],fd); image->format->omit_zeros = LEADING; #else
context: parse_rs274x(FILE *fd, struct gerb_image *image){    char op[3];    struct gerb_aperture *a = NULL;    int ano;        op[0] = fgetc(fd);    op[1] = fgetc(fd);        if ((op[0] == EOF) || (op[1] == EOF))	err(1, "Unexpected EOF found.\n");        /* Directive parameters */    if (strncmp(op, "AS", 2) == 0) {        /* Axis Select */	NOT_IMPL(fd, "%AS%");    } else if (strncmp(op, "FS", 2) == 0) { /* Format Statement */	image->format = (struct gerb_format *)malloc(sizeof(struct gerb_format));	if (image->format == NULL) 	    err(1, "Failed malloc for format\n");	bzero((void *)image->format, sizeof(struct gerb_format));		op[0] = fgetc(fd);	if (op[0] == 'L')	    image->format->omit_zeros = LEADING;	else if (op[0] == 'T')	    image->format->omit_zeros = TRAILING;	else if (op[0] == 'D')	    image->format->omit_zeros = EXPLICIT;	else	    err(1, "Format error: omit_zeros = %c\n", op[0]);		op[0] = fgetc(fd);	if (op[0] == 'A')	    image->format->coordinate = ABSOLUTE;	else if (op[0] == 'T')	    image->format->coordinate = INCREMENTAL;	else	    err(1, "Format error: coordinate = %c\n", op[0]);		/* XXX Here are other definitions possible but we currently silently ignores them */	while (fgetc(fd) != 'X') 	    fprintf(stderr, "Not handled  type of format statement\n");	op[0] = fgetc(fd);	if ((op[0] < '0') || (op[0] > '6'))	    err(1,  "Illegal format size : %c\n", op[0]);	image->format->x_int = (int)(op[0] - '0');	op[0] = fgetc(fd);	if ((op[0] < '0') || (op[0] > '6'))	    err(1,  "Illegal format size : %c\n", op[0]);	image->format->x_dec = (int)(op[0] - '0');		if (fgetc(fd) != 'Y') 	    fprintf(stderr, "Not handled  type of format statement\n");	op[0] = fgetc(fd);	if ((op[0] < '0') || (op[0] > '6'))	    err(1,  "Illegal format size : %c\n", op[0]);	image->format->y_int = (int)(op[0] - '0');	op[0] = fgetc(fd);	if ((op[0] < '0') || (op[0] > '6'))	    err(1,  "Illegal format size : %c\n", op[0]);	image->format->y_dec = (int)(op[0] - '0');	    } else if (strncmp(op, "MI", 2) == 0) { /* Mirror Image */	NOT_IMPL(fd, "%MI%");    } else if (strncmp(op, "MO", 2) == 0) { /* Mode of Units */		op[0] = fgetc(fd);	op[1] = fgetc(fd);		if ((op[0] == EOF) || (op[1] == EOF))	    err(1, "Unexpected EOF found.\n");		if (strncmp(op, "IN", 2) == 0)	    image->info->unit = INCH;	else if (strncmp(op, "MM", 2) == 0)	    image->info->unit = MM;	else	    err(1, "Illegal unit:%c%c\n", op[0], op[1]);	    } else if (strncmp(op, "OF", 2) == 0) { /* Offset */	op[0] = fgetc(fd);	while (op[0] != '*') {	    switch (op[0]) {	    case 'A' :		fscanf(fd, "%lf", &(image->info->offset_a));		break;	    case 'B' :		fscanf(fd, "%lf", &(image->info->offset_b));		break;	    default :		err(1, "Wrong character in offset:%c\n", op[0]);	    }	    op[0] = fgetc(fd);	}	return;    } else if (strncmp(op, "SF", 2) == 0) { /* Scale Factor */	NOT_IMPL(fd, "%SF%");		/* Image parameters */    } else if (strncmp(op, "IJ", 2) == 0) { /* Image Justify */	NOT_IMPL(fd, "%IJ%");    } else if (strncmp(op, "IN", 2) == 0) { /* Image Name */	NOT_IMPL(fd, "%IN%");    } else if (strncmp(op, "IO", 2) == 0) { /* Image Offset */	NOT_IMPL(fd, "%IO%");    } else if (strncmp(op, "IP", 2) == 0) { /* Image Polarity */		op[0] = fgetc(fd);	op[1] = fgetc(fd);	op[2] = fgetc(fd);		if ((op[0] == EOF) || (op[1] == EOF) || (op[2] == EOF))	    err(1, "Unexpected EOF found.\n");		if (strncmp(op, "POS", 3) == 0) 	    image->info->polarity = POSITIVE;	else if (strncmp(op, "NEG", 3) == 0)	    image->info->polarity = NEGATIVE;	else 	    err(1, "Strange polarity : %c%c%c\n", op[0], op[1], op[2]);	    } else if (strncmp(op, "IR", 2) == 0) { /* Image Rotation */	NOT_IMPL(fd, "%IR%");    } else if (strncmp(op, "PF", 2) == 0) { /* Plotter Film */	NOT_IMPL(fd, "%PF%");		/* Aperture parameters */    } else if (strncmp(op, "AD", 2) == 0) { /* Aperture Description */	a = (struct gerb_aperture *)malloc(sizeof(struct gerb_aperture));	bzero((void *)a, sizeof(struct gerb_aperture));	ano = parse_aperture_definition(fd, a);	if ((ano >= APERTURE_MIN) && (ano <= APERTURE_MAX)) 	    image->aperture[ano - APERTURE_MIN] = a;	else	    err(1, "Aperture number out of bounds : %d\n", ano);	    } else if (strncmp(op, "AM", 2) == 0) { /* Aperture Macro */	NOT_IMPL(fd, "%AM%");	return;		/* Layer */    } else if (strncmp(op, "LN", 2) == 0) { /* Layer Name */	NOT_IMPL(fd, "%LN%");    } else if (strncmp(op, "LP", 2) == 0) { /* Layer Polarity */	NOT_IMPL(fd, "%LP%");    } else if (strncmp(op, "KO", 2) == 0) { /* Knock Out */	NOT_IMPL(fd, "%KO%");    } else if (strncmp(op, "SR", 2) == 0) { /* Step and Repeat */	NOT_IMPL(fd, "%SR%");    } else if (strncmp(op, "RO", 2) == 0) { /* Rotate */	NOT_IMPL(fd, "%RO%");    } else {	fprintf(stderr, "Unknown extension found %%%c%c%%\n", op[0], op[1]);    }        return;} /* parse_rs274x */