Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 4451) +++ trunk/src/plug_io.c (revision 4452) @@ -678,9 +678,9 @@ backup_timer = gui->add_timer(backup_cb, 1000 * conf_core.rc.backup_interval, x); } -static int build_fn_cb(gds_t *s, const char **input) +int pcb_build_fn_cb(gds_t *s, const char **input) { - char buff[16]; + char buff[20]; switch(**input) { case 'P': @@ -688,6 +688,19 @@ gds_append_str(s, buff); (*input)++; return 0; + case 'F': + gds_append_str(s, (PCB->Filename != NULL) ? PCB->Filename : "no_file_name"); + (*input)++; + return 0; + case 'N': + gds_append_str(s, (PCB->Name != NULL) ? PCB->Name : "no_name"); + (*input)++; + return 0; + case 'T': + sprintf(buff, "%lu", (unsigned long int)time(NULL)); + gds_append_str(s, buff); + (*input)++; + return 0; } return -1; } @@ -694,7 +707,7 @@ static char *build_fn(const char *template) { - return pcb_strdup_subst(template, build_fn_cb); + return pcb_strdup_subst(template, pcb_build_fn_cb); } /* --------------------------------------------------------------------------- Index: trunk/src/plug_io.h =================================================================== --- trunk/src/plug_io.h (revision 4451) +++ trunk/src/plug_io.h (revision 4452) @@ -147,5 +147,12 @@ pcb_io_err_inhibit--; \ } while(0) +/* generic file name template substitution callbacks for pcb_strdup_subst: + %P pid + %F load-time file name of the current pcb + %N name of the current pcb + %T wall time (Epoch) +*/ +int pcb_build_fn_cb(gds_t *s, const char **input); #endif