Index: trunk/src/plug_footprint_act.c =================================================================== --- trunk/src/plug_footprint_act.c (revision 17707) +++ trunk/src/plug_footprint_act.c (revision 17708) @@ -33,38 +33,45 @@ static const char pcb_acts_fp_rehash[] = "fp_rehash()" ; static const char pcb_acth_fp_rehash[] = "Flush the library index; rescan all library search paths and rebuild the library index. Useful if there are changes in the library during a pcb-rnd session."; -static fgw_error_t pcb_act_fp_rehash(fgw_arg_t *ores, int oargc, fgw_arg_t *oargv) +static fgw_error_t pcb_act_fp_rehash(fgw_arg_t *res, int argc, fgw_arg_t *argv) { - PCB_OLD_ACT_BEGIN; + const char *name = NULL; pcb_fplibrary_t *l; - if (argc == 0) { + PCB_ACT_MAY_CONVARG(1, FGW_STR, fp_rehash, name = argv[1].val.str); + PCB_ACT_IRES(0); + + if (name == NULL) { pcb_fp_rehash(NULL); return 0; } - l = pcb_fp_lib_search(&pcb_library, argv[0]); + l = pcb_fp_lib_search(&pcb_library, name); if (l == NULL) { - pcb_message(PCB_MSG_ERROR, "Can't find library path %s\n", argv[0]); - return 1; + pcb_message(PCB_MSG_ERROR, "Can't find library path %s\n", name); + PCB_ACT_IRES(1); + return 0; } if (l->type != LIB_DIR) { - pcb_message(PCB_MSG_ERROR, "Library path %s is not a directory\n", argv[0]); - return 1; + pcb_message(PCB_MSG_ERROR, "Library path %s is not a directory\n", name); + PCB_ACT_IRES(1); + return 0; } if (l->data.dir.backend == NULL) { - pcb_message(PCB_MSG_ERROR, "Library path %s is not a top level directory of a fp_ plugin\n", argv[0]); - return 1; + pcb_message(PCB_MSG_ERROR, "Library path %s is not a top level directory of a fp_ plugin\n", name); + PCB_ACT_IRES(1); + return 0; } if (pcb_fp_rehash(l) != 0) { - pcb_message(PCB_MSG_ERROR, "Failed to rehash %s\n", argv[0]); - return 1; + pcb_message(PCB_MSG_ERROR, "Failed to rehash %s\n", name); + PCB_ACT_IRES(1); + return 0; } + return 0; - PCB_OLD_ACT_END; }