From stephan@nevis1.nevis.columbia.edu Mon Aug 30 14:28:47 1999 Date: Sun, 29 Aug 1999 02:11:07 -0400 From: Stephan I. Boettcher To: Allin Cottrell Subject: gstar-0.1 (patch included) Dear Allin, Thank you for gstar. It was very helpfull in identifying those few stars that my son (3 years) and I were able to see on the New York sky. (Venus+Castor+Pollux, and very nice Mars+Spica on the June sky). My `thank you' comes with a patch: The problem: gstar froze while gv was running. This is fixed. Plus: an `Update' button, which rewrites the old temorary ps file, and signals gv to reread it. You could just replace the view button with the update button, but then you couldn't view more than one file at once. Bug: it won't catch all cases, e.g., when you click `View' twice, kill the second gv, and then press `Update', it won't show anything new, because the killall -1 gv was successful, but delivered to the wrong gv. Bug: if you run this as root on a big login server, everybodys gv will die when you click on `Update'. Kind regards Stephan - ---------------------------------------------------------------------- Stephan Boettcher FAX: +1-914-591-4540 Columbia University, Nevis Labs Tel: +1-914-591-2863 P.O. Box 137, 136 South Broadway mailto:stephan@nevis1.columbia.edu Irvington, NY 10533, USA http://www.nevis.columbia.edu/~stephan - ---------------------------------------------------------------------- --- gstar.h~ Tue Mar 30 10:47:48 1999 +++ gstar.h Sun Aug 29 00:16:41 1999 @@ -54,3 +54,5 @@ extern starinfo conlocs[]; extern showinfo rcinfo[]; extern char userdir[MAXSTR]; + +extern char temp_filename[MAXSTR]; --- main.c~ Tue Mar 30 09:02:56 1999 +++ main.c Sun Aug 29 00:25:32 1999 @@ -393,6 +393,14 @@ GTK_SIGNAL_FUNC (make_chart), NULL); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); + button = gtk_button_new_with_label (" Update "); + gtk_tooltips_set_tip (tips, button, + "Update starchart in running gv", NULL); + gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (make_chart), + (gpointer) temp_filename); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); + button = gtk_button_new_with_label (" Save "); gtk_tooltips_set_tip (tips, button, "Save starchart output to named postscript file", NULL); --- utils.c~ Wed Mar 31 09:00:22 1999 +++ utils.c Sun Aug 29 00:43:50 1999 @@ -165,19 +165,25 @@ } } +char temp_filename[MAXSTR]; + void make_chart (char * filename) { GtkSpinButton *spin; char buf[MAXSTR], title[MAXSTR], psout[MAXSTR], temp[MAXSTR] ; char * foo; int i, show; - if (filename == NULL) { + if (filename == NULL || *filename == '\0') { foo = tmpnam(NULL); sprintf(psout, "%s.ps", foo); + strcpy(temp_filename, psout); show = 1; } else { strcpy(psout, filename); - show = 0; + if (strcmp(psout, temp_filename)) + show = 0; + else + show = 2; } write_rc(rcfile); @@ -213,7 +219,11 @@ } sprintf(temp, " >%s", psout); strcat(buf, temp); if (show == 1) { - sprintf(temp, " && %s %s", GVPATH, psout); + sprintf(temp, " && %s %s &", GVPATH, psout); + strcat(buf, temp); + } + else if (show==2) { + sprintf(temp, " && killall -HUP gv || %s %s &", GVPATH, psout); strcat(buf, temp); } system(buf);