add: image->aperture[tool_num]->unit = INCH;
context: drill_parse_T_code(gerb_file_t *fd, drill_state_t *state, gerb_image_t *image){    int tool_num;    int done = FALSE;    int temp;    double size;    /* Sneak a peek at what's hiding after the 'T'. Ugly fix for       broken headers from Orcad, which is crap */    temp = gerb_fgetc(fd);    if( !(isdigit(temp) != 0 || temp == '+' || temp =='-') ) {	if(temp != EOF) {	    fprintf(stderr,		    "Warning: Junk text found in place of tool definition.\n"		    "         Please ask your CAD vendor to stop doing that.\n");	    eat_line(fd);	}	return -1;    }    gerb_ungetc(fd);    tool_num = gerb_fgetint(fd);    if ((tool_num < TOOL_MIN) || (tool_num >= TOOL_MAX)) 	GERB_COMPILE_ERROR("Tool out of bounds: %d\n", tool_num);    /* Set the current tool to the correct one */    state->current_tool = tool_num;    /* Check for a size definition */    temp = gerb_fgetc(fd);    while(!done) {		switch((char)temp) {	case 'C':	    size = read_double(fd, 1);	    if(image->info->unit == MM) {		size /= 25.4;	    }	    if(size <= 0 || size >= 10000) {		GERB_COMPILE_ERROR("Tool is wrong size: %g\n", size);	    } else {		if(image->aperture[tool_num] != NULL) {		    GERB_COMPILE_ERROR("Tool is already defined\n");		} else {		    image->aperture[tool_num] =			(gerb_aperture_t *)malloc(sizeof(gerb_aperture_t));		    if (image->aperture[tool_num] == NULL) {			GERB_FATAL_ERROR("malloc tool failed\n");		    }		    /* There's really no way of knowing what unit the tools		       are defined in without sneaking a peek in the rest of		       the file first. That's done in drill_guess_format() */		    image->aperture[tool_num]->parameter[0] = size;		    image->aperture[tool_num]->type = CIRCLE;		    image->aperture[tool_num]->nuf_parameters = 1;		}	    }	    break;	case 'F':	case 'S' :	    /* Silently ignored. They're not important. */	    gerb_fgetint(fd);	    break;	default:	    /* Stop when finding anything but what's expected	       (and put it back) */	    gerb_ungetc(fd);	    done = TRUE;	    break;	}	if( (temp = gerb_fgetc(fd)) == EOF) {	    GERB_COMPILE_ERROR("(very) Unexpected end of file found\n");	}    }    /* Catch the tools that aren't defined.       This isn't strictly a good thing, but at least something is shown */    if(image->aperture[tool_num] == NULL) {	image->aperture[tool_num] =	    (gerb_aperture_t *)malloc(sizeof(gerb_aperture_t));	if (image->aperture[tool_num] == NULL) {	    GERB_FATAL_ERROR("malloc tool failed\n");	}	/* This size calculation is, of course, totally bogus */	image->aperture[tool_num]->parameter[0] =	    (double)(16 + 8 * tool_num) / 1000;	image->aperture[tool_num]->type = CIRCLE;	image->aperture[tool_num]->nuf_parameters = 1;	/* Oooh, this is sooo ugly. But some CAD systems seem to always	   use T00 at the end of the file while others that don't have	   tool definitions inside the file never seem to use T00 at all */	if(tool_num != 0) {	    fprintf(stderr,		    "Warning: Tool %02d used without being defined\n",		    tool_num);	    fprintf(stderr,		    "         Setting a default size of %g\"\n",		    image->aperture[tool_num]->parameter[0]);	}    }        return tool_num;} /* drill_parse_T_code */