Add WYSIWYG inter process signal linkage Patches for xfig.3.2.2.tar.gz on freebsd-3.2/ports/graphics/xfig sent to xfig-bugs_ERASE@epb1.lbl.gov (Brian V. Smith) Fri Jul 16 01:10:04 CEST 1999 # For FreeBSD-4.5+xfig.3.2.3d *** Doc/xfig.man.orig Tue May 29 20:36:07 2001 --- Doc/xfig.man Fri Jun 7 17:16:19 2002 *************** *** 959,964 **** --- 959,1001 ---- .I zoomscale .Ap Set the starting zoom scale. + .\" Added by Julian H. Stacey jhs@ + .At + .BR \-pid_report + .Ap + Prints the process number on startup. + Usually used with \fBreopen_sig\fP. + The default value is ``false''. + (\fPclass\fB PidReport)\fP + .\" --- + .\" Added by Julian H. Stacey ] ", "[-paper_size ] ", "[-pheight ] ", + "[-pid_report] ", "[-portrait] ", "[-pwidth ] ", + "[-reopen_sig] ", "[-right] ", "[-rigidtext] ", "[-rulerthick ] ", # For pre-FreeBSD-4.5+xfig.3.2.3d # *************** # *** 390,395 **** # --- 398,405 ---- # [-starttextstep ] \ # [-tablet] \ # [-track] \ # + [-reopen_sig] \ # + [-pid_report] \ # [-transparent_color ] \ # \n \ # [-userscale ] \ *** main.c.orig Fri Jun 7 17:26:25 2002 --- main.c Fri Jun 7 17:37:02 2002 *************** *** 444,449 **** --- 444,451 ---- int xargc; /* keeps copies of the command-line arguments */ char **xargv; + extern void do_load() ; /* for signal() */ + main(argc, argv) int argc; char *argv[]; # For FreeBSD-4.5+xfig.3.2.3d *** main.c.orig Fri Jun 7 17:26:25 2002 --- main.c Fri Jun 7 17:37:02 2002 *************** *** 704,709 **** --- 710,722 ---- } else { sprintf(cut_buf_name, "%s/xfig%06d", TMPDIR, getpid()); } + + /************************************************************************/ + /* Ignore any unexpectedly early SIGUSR1, though as we've not reported */ + /* our process id yet, it'll be hard for someone to find, except with */ + /* ps(1). */ + /************************************************************************/ + if (appres.reopen_sig) signal(SIGUSR1,SIG_IGN); /*******************************************************************************/ /* Now read the .xfigrc file from user home directory to get previous settings */ # For pre-FreeBSD-4.5+xfig.3.2.3d # *************** # *** 556,561 **** # --- 566,578 ---- # XtGetApplicationResources(tool, &appres, application_resources, # XtNumber(application_resources), NULL, 0); # # + # + /* Ignore any unexpectedly early SIGUSR1, though as we've not reported # + * our process id yet, it'll be hard for someone to find, except with # + * ps(1). # + */ # + if (appres.reopen_sig) signal(SIGUSR1,SIG_IGN); # + # /* All option args have now been deleted, leaving other args. (from Gordon Ross) */ # # /* the Fig filename is the only option now */ *** main.c.orig Fri Jun 7 17:26:25 2002 --- main.c Fri Jun 7 17:37:02 2002 *************** *** 1141,1146 **** --- 1158,1189 ---- else load_file(arg_filename,0,0); update_cur_filename(cur_filename); + + if (appres.reopen_sig) + { + signal(SIGUSR1,do_load); + /* Set signal handling before printing process number, so no one + * can send a an unexpectd SIGUSR1 that would kill us. + * I put off accepting first signal while xfig is presumably + * initialising stuff that maybe needed for the resize function + * (that I never wrote, merely grabbed shared use of). + # I also presume there's not much advantage to accepting + * a SIGUSR1 reopen till now. + */ + } + if (appres.pid_report) + { + printf("%d\n",(int)(getpid())); + /* Before I added the flush (in similar code for ghostview), + * when I called this from a makefile, + * the pid was only printed after + * I selected the file+exit buttons, much too late to be useful + * ghostview had been sitting idle for some time, & + * I had wanted to send a SIGUSR1, but could not, cos didnt know + * process number. + */ + fflush(stdout); + } /* If the user requests a tablet then do the set up for it */ /* and handle the tablet XInput extension events */ # For FreeBSD-4.5+xfig.3.2.3d *** w_file.c.orig Thu May 17 22:13:42 2001 --- w_file.c Fri Jun 7 18:19:01 2002 *************** *** 90,96 **** static void popup_file_panel(); static void file_panel_cancel(), do_merge(); ! static void do_load(), do_merge(), do_save(); static void merge_request(), cancel_request(); static void clear_preview(); --- 90,97 ---- static void popup_file_panel(); static void file_panel_cancel(), do_merge(); ! void do_load(); /* not static as called via signal */ ! static void do_merge(), do_save(); static void merge_request(), cancel_request(); static void clear_preview(); #-------------------------------- # Old patches for freebsd-earlier-than-2.2.8, # (earlier, as 2.2.8 also has xfig.3.2.2) # # *** Doc/xfig.man.orig Wed May 20 17:34:47 1998 # --- Doc/xfig.man Wed May 20 17:38:25 1998 # *************** # *** 754,759 **** # --- 754,793 ---- # .I zoomscale # .Ap # Set the starting zoom scale. # + .\" Added by Julian H. Stacey ] \ # \n \ # [-userunit ] \ # *************** # *** 367,372 **** # --- 377,388 ---- # XtGetApplicationResources(tool, &appres, application_resources, # XtNumber(application_resources), NULL, 0); # # + /* Ignore any unexpectedly early SIGUSR1, though as we've not reported # + * our process id yet, it'll be hard for someone to find, except with # + * ps(1). # + */ # + if (appres.reopen_sig) signal(SIGUSR1,SIG_IGN); # + # /* All option args have now been deleted, leaving other args. (from Gordon Ross) */ # if (argc > 1) { # filename = argv[1]; # *************** # *** 737,742 **** # --- 753,784 ---- # update_cur_filename(cur_filename); # # app_flush(); # + # + if (appres.reopen_sig) # + { # + signal(SIGUSR1,do_load); # + /* Set signal handling before printing process number, so no one # + * can send a an unexpectd SIGUSR1 that would kill us. # + * I put off accepting first signal while xfig is presumably # + * initialising stuff that maybe needed for the resize function # + * (that I never wrote, merely grabbed shared use of). # + # I also presume there's not much advantage to accepting # + * a SIGUSR1 reopen till now. # + */ # + } # + if (appres.pid_report) # + { # + printf("%d\n",(int)(getpid())); # + /* Before I added the flush (in similar code for ghostview), # + * when I called this from a makefile, # + * the pid was only printed after # + * I selected the file+exit buttons, much too late to be useful # + * ghostview had been sitting idle for some time, & # + * I had wanted to send a SIGUSR1, but could not, cos didnt know # + * process number. # + */ # + fflush(stdout); # + } # # /* If the user requests a tablet then do the set up for it */ # /* and handle the tablet XInput extension events */