Index: trunk/src_plugins/import_tinycad/tinycad.c =================================================================== --- trunk/src_plugins/import_tinycad/tinycad.c (revision 29519) +++ trunk/src_plugins/import_tinycad/tinycad.c (revision 29520) @@ -198,9 +198,35 @@ static int tinycad_support_prio(pcb_plug_import_t *ctx, unsigned int aspects, const char **args, int numargs) { - if (aspects != IMPORT_ASPECT_NETLIST) - return 0; /* only pure netlist import is supported */ - return 20; + FILE *f; + unsigned int good = 0; + + if ((aspects != IMPORT_ASPECT_NETLIST) || (numargs != 1)) + return 0; /* only pure netlist import is supported from a single file*/ + + f = pcb_fopen(&PCB->hidlib, args[0], "r"); + if (f == NULL) + return 0; + + while(!feof(f)) { + char *s, line[1024]; + s = fgets(line, sizeof(line), f); + while(isspace(*s)) s++; + if (strncmp(s, "COMPONENT", 9) == 0) + good |= 1; + else if (strncmp(s, "OPTION", 6) == 0) + good |= 2; + else if (strncmp(s, "NET", 3) == 0) + good |= 4; + if (good == (1|2|4)) { + fclose(f); + return 100; + } + } + + fclose(f); + + return 0; }