Index: main_act.c =================================================================== --- main_act.c (revision 29565) +++ main_act.c (revision 29566) @@ -40,11 +40,10 @@ #include #include "config.h" -#include "undo.h" -#include "change.h" #include "board.h" #include "data.h" #include "crosshair.h" +#include "actions_pcb.h" #include #include "layer.h" #include @@ -291,53 +290,10 @@ /* DOC: executefile.html */ fgw_error_t pcb_act_ExecuteFile(fgw_arg_t *res, int argc, fgw_arg_t *argv) { - FILE *fp; const char *fname; - char line[256]; - int n = 0; - char *sp; PCB_ACT_CONVARG(1, FGW_STR, ExecuteFile, fname = argv[1].val.str); - - if ((fp = pcb_fopen(PCB_ACT_HIDLIB, fname, "r")) == NULL) { - fprintf(stderr, "Could not open actions file \"%s\".\n", fname); - return 1; - } - - defer_updates = 1; - defer_needs_update = 0; - while (fgets(line, sizeof(line), fp) != NULL) { - n++; - sp = line; - - /* eat the trailing newline */ - while (*sp && *sp != '\r' && *sp != '\n') - sp++; - *sp = '\0'; - - /* eat leading spaces and tabs */ - sp = line; - while (*sp && (*sp == ' ' || *sp == '\t')) - sp++; - - /* - * if we have anything left and its not a comment line - * then execute it - */ - - if (*sp && *sp != '#') { - /*pcb_message("%s : line %-3d : \"%s\"\n", fname, n, sp); */ - pcb_parse_actions(PCB_ACT_HIDLIB, sp); - } - } - - defer_updates = 0; - if (defer_needs_update) { - pcb_undo_inc_serial(); - pcb_gui->invalidate_all(pcb_gui); - } - fclose(fp); - PCB_ACT_IRES(0); + PCB_ACT_IRES(pcb_act_execute_file(PCB_ACT_HIDLIB, fname)); return 0; }