Index: mucs.c =================================================================== --- mucs.c (revision 17847) +++ mucs.c (revision 17848) @@ -55,9 +55,8 @@ static const char pcb_acts_LoadMucsFrom[] = "LoadMucsFrom(filename)"; static const char pcb_acth_LoadMucsFrom[] = "Loads the specified mucs routing file."; -fgw_error_t pcb_act_LoadMucsFrom(fgw_arg_t *ores, int oargc, fgw_arg_t *oargv) +fgw_error_t pcb_act_LoadMucsFrom(fgw_arg_t *res, int argc, fgw_arg_t *argv) { - PCB_OLD_ACT_BEGIN; const char *fname = NULL; static char *default_file = NULL; FILE *fi; @@ -64,20 +63,24 @@ int c, c2; pcb_coord_t x1, y1, x2, y2, r; pcb_pstk_t *ps; - fname = argc ? argv[0] : 0; + PCB_ACT_MAY_CONVARG(1, FGW_STR, LoadMucsFrom, fname = argv[1].val.str); + if (!(pcb_layer_flags(PCB, INDEXOFCURRENT) & PCB_LYT_COPPER)) { pcb_message(PCB_MSG_ERROR, "The currently active layer is not a copper layer.\n"); + PCB_ACT_IRES(1); + return 0; } - if (!fname || !*fname) { fname = pcb_gui->fileselect("Load mucs routing session Resource File...", "Picks a mucs session resource file to load.\n" "This file could be generated by mucs-pcb\n", default_file, ".l1", "unixplot", HID_FILESELECT_READ); - if (fname == NULL) - return 1; + if (fname == NULL) { + PCB_ACT_IRES(1); + return 0; + } if (default_file != NULL) { free(default_file); default_file = NULL; @@ -90,7 +93,8 @@ fi = pcb_fopen(fname, "r"); if (!fi) { pcb_message(PCB_MSG_ERROR, "Can't load mucs unixplot file %s for read\n", fname); - return 1; + PCB_ACT_IRES(1); + return 0; } while ((c = getc(fi)) != EOF) { @@ -146,8 +150,8 @@ } } fclose(fi); + PCB_ACT_IRES(0); return 0; - PCB_OLD_ACT_END; } pcb_action_t mucs_action_list[] = {