http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/ports/gen/print/ghostview/files/patch-ja.REL=ALL.cust_rel document redisplay on signal hook for wysiwyg *** ghostview.man.orig Sat Jul 24 04:29:12 1993 --- ghostview.man Fri Dec 9 05:36:56 1994 *************** *** 44,49 **** --- 44,50 ---- [\-folio] [\-quarto] [\-10x14] [\-force] [\-forceorientation] [\-forcemedia] [\-[no]openwindows] [\-[no]ncdwm] + [\-[no]reopen_sig] [\-[no]pid_report] [\-page \fIlabel\fP] [\-\fItoolkitoption\fR\ ...] [filename] .SH DESCRIPTION *************** *** 555,560 **** --- 556,577 ---- fix-10. You should only set this resource if you have the problem. The default value is ``false''. + .IP "\fBpid_report (\fPclass\fB PidReport)\fP" 1i + .\" added by Julian H. Stacey + extern char *getenv(); static String version = "Ghostview, version 1.5"; *************** *** 129,134 **** --- 131,140 ---- XtOffsetOf(AppResources, openwindows), XtRImmediate, (XtPointer)False}, {"ncdwm", "Ncdwm", XtRBoolean, sizeof(Boolean), XtOffsetOf(AppResources, ncdwm), XtRImmediate, (XtPointer)False}, + {"reopenSig", "ReopenSig", XtRBoolean, sizeof(Boolean), + XtOffsetOf(AppResources, reopen_sig), XtRImmediate, (XtPointer)False}, + {"pidReport", "PidReport", XtRBoolean, sizeof(Boolean), + XtOffsetOf(AppResources, pid_report), XtRImmediate, (XtPointer)False}, }; static XrmOptionDescRec options[] = { *************** *** 183,188 **** --- 189,198 ---- {"-noopenwindows", ".openWindows", XrmoptionNoArg, "False"}, {"-ncdwm", ".ncdwm", XrmoptionNoArg, "True"}, {"-noncdwm", ".ncdwm", XrmoptionNoArg, "False"}, + {"-reopen_sig", ".reopenSig", XrmoptionNoArg, "True"}, + {"-noreopen_sig", ".reopenSig", XrmoptionNoArg, "False"}, + {"-pid_report", ".pidReport", XrmoptionNoArg, "True"}, + {"-nopid_report", ".pidReport", XrmoptionNoArg, "False"}, }; static XtActionsRec actions[] = { *************** *** 411,416 **** --- 421,433 ---- XtGetApplicationResources(toplevel, (XtPointer) &app_res, resources, XtNumber(resources), NULL, ZERO); + + /* 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 (app_res.reopen_sig) signal(SIGUSR1,SIG_IGN); + if (s1 = getenv(app_res.printer_variable)) app_res.default_printer = s1; /* Open Windows sometimes hands me a bad bitmap */ *************** *** 879,884 **** --- 896,926 ---- layout_ghostview(); XtMapWidget(toplevel); + if (app_res.reopen_sig) + { + signal(SIGUSR1,gv_reopen); + /* 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 ghostview 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 (app_res.pid_report) + { + printf("%d\n",(int)(getpid())); + /* Before I added the flush, 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); + } + show_page(i); XtAppMainLoop(app_con); *************** *** 916,921 **** --- 955,962 ---- " [-force] [-forceorientation] [-forcemedia]\n"); fprintf(stderr, " [-[no]openwindows] [-[no]ncdwm]\n"); + fprintf(stderr, + " [-[no]reopen_sig] [-[no]pid_report]\n"); fprintf(stderr, " [-page