v13i055: contool -- replacement for 'cmdtool -C', Patch4, Part02/02
Chuck Musciano
chuck at trantor.harris-atd.com
Tue Jun 18 16:37:27 AEST 1991
Submitted-by: Chuck Musciano <chuck at trantor.harris-atd.com>
Posting-number: Volume 13, Issue 55
Archive-name: contool/patch4.02
Patch-To: contool: Volume 10, Issues 34-40, 78 (10/29/90)
Patch-To: contool: Volume 11, Issue 5
This is the second part of the patch that brings contool from version
3.0c to 3.1. You'll need to obtain, unshar, and apply both patches before
rebuilding contool.
Full up-to-date sources, as well as previous patch files, are available
via FTP from trantor.harris-atd.com in /pub/suntools/contool.
Chuck Musciano ARPA : chuck at trantor.harris-atd.com
Harris Corporation Usenet: ...!uunet!x102a!trantor!chuck
PO Box 37, MS 3A/1912 AT&T : (407) 727-6131
Melbourne, FL 32902 FAX : (407) 729-3363
A good newspaper is never good enough,
but a lousy newspaper is a joy forever. -- Garrison Keillor
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: patch.2
# Wrapped by chuck at pluto on Mon Jun 3 08:11:53 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patch.2' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'patch.2'\"
else
echo shar: Extracting \"'patch.2'\" \(55243 characters\)
sed "s/^X//" >'patch.2' <<'END_OF_FILE'
X*** contool.info.orig Wed May 29 12:09:21 1991
X--- contool.info Wed May 29 11:59:50 1991
X***************
X*** 58,63 ****
X--- 58,65 ----
X
X If "Flash icon" is selected, contool's icon will flash, alternating between the "Check console" and "Flash" images specified in the contool Properties dialog box.
X
X+ If "Log message" is selected, contool will write the message to the log file, provided that logging is enabled and occurs after filtering.
X+
X If "Open window" is selected, contool will open to a window (if iconic) and move in front of any obscuring windows.
X
X If "Timestamp" is selected, a timestamp will be written to the console before the message text. Timestamping is further controlled by the timestamp resolution defined in the contool Properties dialog box.
X***************
X*** 196,201 ****
X--- 198,217 ----
X :stop
X The End pattern text field contains a regular expression (see ed(1) for more on regular expressions) which will match the last line of a multi-line filter.
X #
X+ :filter_timeout
X+ This numeric text field determines how long contool will process a multi-line filter. If contool does not receive a message matching the specified end pattern before the timeout value, the filter is disabled. This prevents a filter with an erroneous end pattern from absorbing all subsequent console messages.
X+
X+ A timeout value of zero indicates that no timeout will be in effect.
X+
X+ This item is only enabled if "Type" is set to "Multi-line filter".
X+ #
X+ :filter_timeout_units
X+ This numeric text field determines how long contool will process a multi-line filter. If contool does not receive a message matching the specified end pattern before the timeout value, the filter is disabled. This prevents a filter with an erroneous end pattern from absorbing all subsequent console messages.
X+
X+ A timeout value of zero indicates that no timeout will be in effect.
X+
X+ This item is only enabled if "Type" is set to "Multi-line filter".
X+ #
X :comment
X The Comment text field should contain a short description of what the current filter does. Since some filters can be quite arcane, this description can be helpful to new users.
X
X***************
X*** 217,222 ****
X--- 233,240 ----
X
X If "Flash icon" is selected, contool's icon will flash, alternating between the "Check console" and "Flash" images specified in the contool Properties dialog box.
X
X+ If "Log message" is selected, contool will write the message to the log file, provided that logging is enabled and occurs after filtering.
X+
X If "Open window" is selected, contool will open to a window (if iconic) and move in front of any obscuring windows.
X
X If "Timestamp" is selected, a timestamp will be written to the console before the message text. Timestamping is further controlled by the timestamp resolution defined in the contool Properties dialog box.
X***************
X*** 241,248 ****
X :filters_apply
X The Apply button takes the set of filters displayed in the filter list and makes them the current contool filter set. Before Apply is pressed, any additions, deletions, or changes made to the filters remain local to the Filters dialog box.
X
X! Even after pressing Apply, the filter changes are not written to the configuration file. In roder to make your changes take effect for subsequent invocations of contool, use the Save Configuration dialog box to write them to your configuration file.
X #
X :filters_reset
X The Reset button discards any changes you have made to the displayed filter set, restoring the filters to match the set currently in use by contool.
X
X--- 259,272 ----
X :filters_apply
X The Apply button takes the set of filters displayed in the filter list and makes them the current contool filter set. Before Apply is pressed, any additions, deletions, or changes made to the filters remain local to the Filters dialog box.
X
X! Even after pressing Apply, the filter changes are not written to the configuration file. In order to make your changes take effect for subsequent invocations of contool, use the Save Configuration dialog box to write them to your configuration file.
X #
X+ :filters_apply_and_save
X+ The Apply and Save button takes the set of filters displayed in the filter list and makes them the current contool filter set. The filters are then saved to the current configuration file, along with the current tool properties. If you wish to save just the filters or just the tool properties, or wish to save to a different file, you should press the Apply button instead and use the more general purpose Save Configuration dialog box.
X+
X+ Before this button is pressed, any additions, deletions, or changes made to the filters remain local to the Filters dialog box.
X+
X+ #
X :filters_reset
X The Reset button discards any changes you have made to the displayed filter set, restoring the filters to match the set currently in use by contool.
X
X***************
X*** 351,358 ****
X This window allows you to send mail concerning contool to its developer. You are encouraged to send comments and suggestions in order to make contool a better tool.
X #
X :address
X! This choice item lets you select the address to which your mail will be sent. If your machine understands Internet-style addresses, you should use the first choice item. If you are a UUCP-based site, you should use the second item. If neither address works, use the third item to enter a valid address.
X #
X :other_address
X This text field is used to enter an e-mail address to which your mail will be sent. It should only be used if the two default addresses do not work from your site.
X #
X--- 375,389 ----
X This window allows you to send mail concerning contool to its developer. You are encouraged to send comments and suggestions in order to make contool a better tool.
X #
X :address
X! This menu lets you select the address to which your message will be sent. You should use the first selection for Internet-style mail, the second selection for Usenet-style mail, and the third selection for unusual addressing.
X!
X! If you select the third item, a text field will appear, allowing you to enter an appropriate e-mail address.
X #
X+ :fixed_address
X+ This menu lets you select the address to which your message will be sent. You should use the first selection for Internet-style mail, the second selection for Usenet-style mail, and the third selection for unusual addressing.
X+
X+ If you select the third item, a text field will appear, allowing you to enter an appropriate e-mail address.
X+ #
X :other_address
X This text field is used to enter an e-mail address to which your mail will be sent. It should only be used if the two default addresses do not work from your site.
X #
X***************
X*** 361,366 ****
X #
X :accept_send
X Clicking this button will send your mail message to contool's developer.
X- #
X- :cancel_mail
X- Clicking this button cancels the message you were going to send.
X--- 392,394 ----
X*** contool.c.orig Wed May 29 12:09:24 1991
X--- contool.c Wed May 29 09:26:31 1991
X***************
X*** 39,45 ****
X #include <xview/icon.h>
X #include <xview/panel.h>
X #include <xview/textsw.h>
X! #include <xview/xv_xrect.h>
X
X #include "manifest.h"
X #include "contool.h"
X--- 39,45 ----
X #include <xview/icon.h>
X #include <xview/panel.h>
X #include <xview/textsw.h>
X! #include <xview/notify.h>
X
X #include "manifest.h"
X #include "contool.h"
X***************
X*** 56,61 ****
X--- 56,63 ----
X
X PUBLIC Server_image load_icon();
X
X+ PRIVATE Notify_value blink_proc();
X+
X PRIVATE short good_bits[] = {
X #include "icons/default_good.icon"
X };
X***************
X*** 89,94 ****
X--- 91,97 ----
X PRIVATE int old_time = 0;
X PRIVATE char *program;
X PRIVATE FILE *slave = NULL;
X+ PRIVATE int filter_timeout = 0;
X
X PRIVATE struct itimerval timer = {{0, 500000}, {0, 500000}};
X
X***************
X*** 131,153 ****
X /************************************************************************/
X
X /************************************************************************/
X! EXPORT acquire_console()
X
X {
X! if (ioctl(fileno(slave), TIOCCONS, NULL) == -1)
X! abend("%s: could not attach to /dev/console", program);
X }
X
X /************************************************************************/
X! EXPORT stop_blinking()
X
X! { Icon icon;
X!
X! notify_set_itimer_func(contool_base->base, NULL, ITIMER_REAL, NULL, NULL);
X! icon = (Icon) xv_get(contool_base->base, FRAME_ICON);
X! xv_set(icon, ICON_IMAGE, good, NULL);
X! xv_set(contool_base->base, FRAME_ICON, icon, 0);
X! blinking = FALSE;
X }
X
X /************************************************************************/
X--- 134,154 ----
X /************************************************************************/
X
X /************************************************************************/
X! PRIVATE stop_blinking()
X
X {
X! if (filter_timeout <= 0)
X! notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
X! change_icon(good, good == default_good_icon);
X! blinking = FALSE;
X }
X
X /************************************************************************/
X! EXPORT acquire_console()
X
X! {
X! if (ioctl(fileno(slave), TIOCCONS, NULL) == -1)
X! abend("%s: could not attach to /dev/console", program);
X }
X
X /************************************************************************/
X***************
X*** 157,165 ****
X--- 158,184 ----
X curr_filter = NULL;
X xv_set(contool_base->base, FRAME_LEFT_FOOTER, "", NULL);
X end_command();
X+ filter_timeout = 0;
X+ if (!blinking && beep_count == 0)
X+ notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
X }
X
X /************************************************************************/
X+ EXPORT adjust_window_limit()
X+
X+ { int sw_len;
X+ char *temp;
X+
X+ sw_len = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
X+ temp = (char *) malloc((unsigned) sw_len);
X+ xv_get(contool_base->display, TEXTSW_CONTENTS, 0, temp, sw_len);
X+ xv_set(contool_base->display, TEXTSW_MEMORY_MAXIMUM, defaults.max_size + defaults.max_size / 10, NULL);
X+ textsw_reset(contool_base->display, 0, 0);
X+ textsw_insert(contool_base->display, temp, sw_len);
X+ free(temp);
X+ }
X+
X+ /************************************************************************/
X /* Various small features */
X /************************************************************************/
X
X***************
X*** 364,370 ****
X change_icon(bad, bad == default_bad_icon);
X bad_is_up = !bad_is_up;
X }
X! if (beep_count == 0 && !blinking)
X notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
X return(NOTIFY_DONE);
X }
X--- 383,392 ----
X change_icon(bad, bad == default_bad_icon);
X bad_is_up = !bad_is_up;
X }
X! if (filter_timeout > 0)
X! if (--filter_timeout <= 0)
X! filters_changed();
X! if (beep_count == 0 && !blinking && filter_timeout <= 0)
X notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
X return(NOTIFY_DONE);
X }
X***************
X*** 379,389 ****
X
X {
X event_in_progress = TRUE;
X! if (event_action(event) == ACTION_OPEN && blinking) {
X! notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
X! change_icon(good, good == default_good_icon);
X! blinking = FALSE;
X! }
X event_in_progress = FALSE;
X return(notify_next_event_func(frame, event, arg, type));
X }
X--- 401,408 ----
X
X {
X event_in_progress = TRUE;
X! if (event_action(event) == ACTION_OPEN && blinking)
X! stop_blinking();
X event_in_progress = FALSE;
X return(notify_next_event_func(frame, event, arg, type));
X }
X***************
X*** 404,409 ****
X--- 423,443 ----
X }
X
X /************************************************************************/
X+ PRIVATE Notify_value signal_proc(frame, sig, when)
X+
X+ Frame frame;
X+ int sig;
X+ Notify_signal_mode when;
X+
X+ {
X+ if (sig == SIGUSR1)
X+ stop_blinking();
X+ else if (sig == SIGHUP)
X+ update_logging();
X+ return(NOTIFY_DONE);
X+ }
X+
X+ /************************************************************************/
X /* Routines which handle capturing and displaying messages */
X /************************************************************************/
X
X***************
X*** 417,433 ****
X char *temp;
X
X while ((int) xv_get(contool_base->display, TEXTSW_LENGTH) + len > defaults.max_size) {
X first = 1;
X last = TEXTSW_INFINITY;
X if (textsw_find_bytes(contool_base->display, &first, &last, "\n<<<", 4, 0) == -1)
X if (textsw_find_bytes(contool_base->display, &first, &last, "\n", 1, 0) == -1)
X! first = defaults.delete_amount;
X! textsw_erase(contool_base->display, 0, first + 1);
X! sw_len = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
X temp = (char *) malloc((unsigned) sw_len);
X xv_get(contool_base->display, TEXTSW_CONTENTS, 0, temp, sw_len);
X textsw_reset(contool_base->display, 0, 0);
X! textsw_insert(contool_base->display, temp, sw_len);
X free(temp);
X }
X xv_set(contool_base->display, TEXTSW_INSERTION_POINT, TEXTSW_INFINITY, 0);
X--- 451,466 ----
X char *temp;
X
X while ((int) xv_get(contool_base->display, TEXTSW_LENGTH) + len > defaults.max_size) {
X+ sw_len = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
X first = 1;
X last = TEXTSW_INFINITY;
X if (textsw_find_bytes(contool_base->display, &first, &last, "\n<<<", 4, 0) == -1)
X if (textsw_find_bytes(contool_base->display, &first, &last, "\n", 1, 0) == -1)
X! first = (defaults.delete_amount < sw_len)? defaults.delete_amount : sw_len;
X temp = (char *) malloc((unsigned) sw_len);
X xv_get(contool_base->display, TEXTSW_CONTENTS, 0, temp, sw_len);
X textsw_reset(contool_base->display, 0, 0);
X! textsw_insert(contool_base->display, temp + first, sw_len - first);
X free(temp);
X }
X xv_set(contool_base->display, TEXTSW_INSERTION_POINT, TEXTSW_INFINITY, 0);
X***************
X*** 501,511 ****
X if (f->stop == NULL)
X end_command();
X }
X! if (defaults.log_after)
X write_log(t);
X }
X if (f->stop) {
X curr_filter = f;
X sprintf(buf, "Filtering \"%s\"...", f->start);
X xv_set(contool_base->base, FRAME_LEFT_FOOTER, buf, NULL);
X }
X--- 534,545 ----
X if (f->stop == NULL)
X end_command();
X }
X! if (defaults.log_after && f->log)
X write_log(t);
X }
X if (f->stop) {
X curr_filter = f;
X+ filter_timeout = f->timeout * 2;
X sprintf(buf, "Filtering \"%s\"...", f->start);
X xv_set(contool_base->base, FRAME_LEFT_FOOTER, buf, NULL);
X }
X***************
X*** 519,525 ****
X continue_command(t);
X end_command();
X }
X! if (defaults.log_after)
X write_log(t);
X do_insertion(t, strlen(t));
X update_value(do_blink, defaults.flash);
X--- 553,559 ----
X continue_command(t);
X end_command();
X }
X! if (defaults.log_after && defaults.log)
X write_log(t);
X do_insertion(t, strlen(t));
X update_value(do_blink, defaults.flash);
X***************
X*** 531,537 ****
X if (curr_filter->save) {
X if (curr_filter->stamp)
X time_stamp();
X! if (defaults.log_after)
X write_log(t);
X do_insertion(t, strlen(t));
X if (curr_filter->command)
X--- 565,571 ----
X if (curr_filter->save) {
X if (curr_filter->stamp)
X time_stamp();
X! if (defaults.log_after && curr_filter->log)
X write_log(t);
X do_insertion(t, strlen(t));
X if (curr_filter->command)
X***************
X*** 557,563 ****
X bad_is_up = TRUE;
X notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
X }
X! if (beep_count > 0 || blinking)
X notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
X return(NOTIFY_DONE);
X }
X--- 591,597 ----
X bad_is_up = TRUE;
X notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
X }
X! if (beep_count > 0 || blinking || filter_timeout > 0)
X notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
X return(NOTIFY_DONE);
X }
X***************
X*** 604,609 ****
X--- 638,644 ----
X defaults.log_file = log_file;
X if (log)
X enable_logging();
X+ adjust_window_limit();
X }
X else if (explicit_filters)
X error("Could not read configuration file %s", filter_file);
X***************
X*** 664,670 ****
X
X hints.res_class = "Contool";
X hints.res_name = (p = rindex(program, '/'))? p + 1 : program;
X! XSetClassHint(xv_get(contool_base->base, XV_DISPLAY), xv_get(xv_get(contool_base->base, XV_ROOT), XV_XID), &hints);
X
X parse_options(&argc, argv);
X load_filters();
X--- 699,705 ----
X
X hints.res_class = "Contool";
X hints.res_name = (p = rindex(program, '/'))? p + 1 : program;
X! XSetClassHint(xv_get(contool_base->base, XV_DISPLAY), xv_get(contool_base->base, XV_XID), &hints);
X
X parse_options(&argc, argv);
X load_filters();
X***************
X*** 675,680 ****
X--- 710,717 ----
X notify_set_input_func(contool_base->base, input_func, fileno(master));
X notify_interpose_destroy_func(contool_base->base, destroy_proc);
X notify_interpose_event_func(contool_base->base, close_proc, NOTIFY_SAFE);
X+ notify_set_signal_func(contool_base->base, signal_proc, SIGUSR1, NOTIFY_SYNC);
X+ notify_set_signal_func(contool_base->base, signal_proc, SIGHUP, NOTIFY_SYNC);
X
X xv_main_loop(contool_base->base);
X exit(0);
X*** contool.h.orig Wed May 29 12:09:25 1991
X--- contool.h Wed May 29 08:13:12 1991
X***************
X*** 28,35 ****
X #define BEEP_BIT 0x01
X #define COMMAND_BIT 0x02
X #define FLASH_BIT 0x04
X! #define OPEN_BIT 0x08
X! #define STAMP_BIT 0x10
X
X typedef struct filter Filter;
X typedef struct props Props;
X--- 28,36 ----
X #define BEEP_BIT 0x01
X #define COMMAND_BIT 0x02
X #define FLASH_BIT 0x04
X! #define LOG_BIT 0x08
X! #define OPEN_BIT 0x10
X! #define STAMP_BIT 0x20
X
X typedef struct filter Filter;
X typedef struct props Props;
X***************
X*** 44,51 ****
X--- 45,54 ----
X int save;
X int beep;
X int flash;
X+ int log;
X int open;
X int stamp;
X+ int timeout;
X char *command;
X Filter *next;
X };
X***************
X*** 52,57 ****
X--- 55,61 ----
X
X struct props {int beep;
X int flash;
X+ int log;
X int open;
X int stamp;
X char *command;
X***************
X*** 75,77 ****
X--- 79,82 ----
X PUBLIC Filter *filters;
X PUBLIC int parse_errors_occured;
X PUBLIC char *filter_file;
X+ PUBLIC int filter_version;
X*** contool_ui.h.orig Wed May 29 12:09:29 1991
X--- contool_ui.h Wed May 29 11:59:48 1991
X***************
X*** 15,20 ****
X--- 15,21 ----
X extern Xv_opaque contool_filter_insert_menu_create();
X extern Xv_opaque contool_filter_edit_menu_create();
X extern Xv_opaque contool_filter_paste_menu_create();
X+ extern Xv_opaque contool_address_menu_create();
X
X typedef struct {
X Xv_opaque base;
X***************
X*** 90,95 ****
X--- 91,98 ----
X Xv_opaque filter_type;
X Xv_opaque start;
X Xv_opaque stop;
X+ Xv_opaque filter_timeout;
X+ Xv_opaque filter_timeout_units;
X Xv_opaque comment;
X Xv_opaque ignore;
X Xv_opaque action;
X***************
X*** 97,102 ****
X--- 100,106 ----
X Xv_opaque filter_beep_times;
X Xv_opaque filter_command;
X Xv_opaque filters_apply;
X+ Xv_opaque filters_apply_and_save;
X Xv_opaque filters_reset;
X } contool_filters_objects;
X
X***************
X*** 111,116 ****
X--- 115,122 ----
X extern Xv_opaque contool_filters_filter_type_create();
X extern Xv_opaque contool_filters_start_create();
X extern Xv_opaque contool_filters_stop_create();
X+ extern Xv_opaque contool_filters_filter_timeout_create();
X+ extern Xv_opaque contool_filters_filter_timeout_units_create();
X extern Xv_opaque contool_filters_comment_create();
X extern Xv_opaque contool_filters_ignore_create();
X extern Xv_opaque contool_filters_action_create();
X***************
X*** 118,123 ****
X--- 124,130 ----
X extern Xv_opaque contool_filters_filter_beep_times_create();
X extern Xv_opaque contool_filters_filter_command_create();
X extern Xv_opaque contool_filters_filters_apply_create();
X+ extern Xv_opaque contool_filters_filters_apply_and_save_create();
X extern Xv_opaque contool_filters_filters_reset_create();
X
X typedef struct {
X***************
X*** 204,214 ****
X Xv_opaque message21;
X Xv_opaque message22;
X Xv_opaque address;
X Xv_opaque other_address;
X Xv_opaque message;
X Xv_opaque mail_controls1;
X Xv_opaque accept_send;
X- Xv_opaque cancel_mail;
X } contool_mail_objects;
X
X extern contool_mail_objects *contool_mail_objects_initialize();
X--- 211,221 ----
X Xv_opaque message21;
X Xv_opaque message22;
X Xv_opaque address;
X+ Xv_opaque fixed_address;
X Xv_opaque other_address;
X Xv_opaque message;
X Xv_opaque mail_controls1;
X Xv_opaque accept_send;
X } contool_mail_objects;
X
X extern contool_mail_objects *contool_mail_objects_initialize();
X***************
X*** 218,226 ****
X extern Xv_opaque contool_mail_message21_create();
X extern Xv_opaque contool_mail_message22_create();
X extern Xv_opaque contool_mail_address_create();
X extern Xv_opaque contool_mail_other_address_create();
X extern Xv_opaque contool_mail_message_create();
X extern Xv_opaque contool_mail_mail_controls1_create();
X extern Xv_opaque contool_mail_accept_send_create();
X- extern Xv_opaque contool_mail_cancel_mail_create();
X #endif
X--- 225,233 ----
X extern Xv_opaque contool_mail_message21_create();
X extern Xv_opaque contool_mail_message22_create();
X extern Xv_opaque contool_mail_address_create();
X+ extern Xv_opaque contool_mail_fixed_address_create();
X extern Xv_opaque contool_mail_other_address_create();
X extern Xv_opaque contool_mail_message_create();
X extern Xv_opaque contool_mail_mail_controls1_create();
X extern Xv_opaque contool_mail_accept_send_create();
X #endif
X*** filters.c.orig Wed May 29 12:09:32 1991
X--- filters.c Wed May 29 08:13:11 1991
X***************
X*** 161,166 ****
X--- 161,168 ----
X xv_set(contool_filters->filter_type, PANEL_INACTIVE, FALSE, PANEL_VALUE, f->stop? 1 : 0, NULL);
X xv_set(contool_filters->start, PANEL_INACTIVE, FALSE, PANEL_VALUE, is_null(f->start), NULL);
X xv_set(contool_filters->stop, PANEL_INACTIVE, f->stop == NULL, PANEL_VALUE, is_null(f->stop), NULL);
X+ xv_set(contool_filters->filter_timeout, PANEL_INACTIVE, f->stop == NULL, PANEL_VALUE, f->timeout, NULL);
X+ xv_set(contool_filters->filter_timeout_units, PANEL_INACTIVE, f->stop == NULL, NULL);
X xv_set(contool_filters->comment, PANEL_INACTIVE, FALSE, PANEL_VALUE, is_null(f->comment), NULL);
X xv_set(contool_filters->ignore, PANEL_INACTIVE, FALSE, PANEL_VALUE, f->save? 0 : 1, NULL);
X if (f->save) {
X***************
X*** 183,188 ****
X--- 185,192 ----
X xv_set(contool_filters->filter_command, PANEL_INACTIVE, TRUE, NULL);
X if (f->flash)
X i |= FLASH_BIT;
X+ if (f->log)
X+ i |= LOG_BIT;
X if (f->open)
X i |= OPEN_BIT;
X if (f->stamp)
X***************
X*** 197,212 ****
X }
X }
X else {
X! xv_set(contool_filters->filter_update, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_type, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->start, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->stop, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->comment, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->ignore, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->action, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_beep_count, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_beep_times, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_command, PANEL_INACTIVE, TRUE, NULL);
X }
X }
X
X--- 201,218 ----
X }
X }
X else {
X! xv_set(contool_filters->filter_update, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_type, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_timeout, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_timeout_units, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->start, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->stop, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->comment, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->ignore, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->action, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_beep_count, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_beep_times, PANEL_INACTIVE, TRUE, NULL);
X! xv_set(contool_filters->filter_command, PANEL_INACTIVE, TRUE, NULL);
X }
X }
X
X***************
X*** 263,270 ****
X--- 269,278 ----
X f->beep = defaults.beep;
X f->command = strsave(defaults.command);
X f->flash = defaults.flash;
X+ f->log = defaults.log;
X f->open = defaults.open;
X f->stamp = defaults.stamp;
X+ f->timeout = 0;
X f->save = TRUE;
X update_controls();
X /* update the scrolling view */
X***************
X*** 315,322 ****
X error("You must specify a starting message pattern");
X return(FALSE);
X }
X! if (xv_get(contool_filters->filter_type, PANEL_VALUE) == 1)
X stop = (char *) xv_get(contool_filters->stop, PANEL_VALUE);
X else
X stop = NULL;
X if (msg = compile_exp(f, start, stop)) {
X--- 323,336 ----
X error("You must specify a starting message pattern");
X return(FALSE);
X }
X! if (xv_get(contool_filters->filter_type, PANEL_VALUE) == 1) {
X stop = (char *) xv_get(contool_filters->stop, PANEL_VALUE);
X+ if (is_empty(stop)) {
X+ if (flag)
X+ error("You must specify an ending message pattern");
X+ return(FALSE);
X+ }
X+ }
X else
X stop = NULL;
X if (msg = compile_exp(f, start, stop)) {
X***************
X*** 341,346 ****
X--- 355,361 ----
X else
X f->beep = 0;
X f->flash = (i & FLASH_BIT)? TRUE : FALSE;
X+ f->log = (i & LOG_BIT)? TRUE : FALSE;
X f->open = (i & OPEN_BIT)? TRUE : FALSE;
X f->stamp = (i & STAMP_BIT)? TRUE : FALSE;
X f->save = TRUE;
X***************
X*** 347,352 ****
X--- 362,368 ----
X }
X else
X f->save = FALSE;
X+ f->timeout = (stop == NULL)? 0 : (int) xv_get(contool_filters->filter_timeout, PANEL_VALUE);
X f->start = strsave(start);
X f->stop = strsave(stop);
X f->comment = strsave((char *) xv_get(contool_filters->comment, PANEL_VALUE));
X***************
X*** 713,718 ****
X--- 729,736 ----
X
X {
X xv_set(contool_filters->stop, PANEL_INACTIVE, value == 0, NULL);
X+ xv_set(contool_filters->filter_timeout, PANEL_INACTIVE, value == 0, NULL);
X+ xv_set(contool_filters->filter_timeout_units, PANEL_INACTIVE, value == 0, NULL);
X }
X
X /************************************************************************/
X***************
X*** 787,794 ****
X diff = TRUE;
X else if ((f->command != NULL && new.command == NULL) || (f->command == NULL && new.command != NULL))
X diff = TRUE;
X! else if (f->save != new.save || f->beep != new.beep || f->flash != new.flash || f->open != new.open || f->stamp != new.stamp)
X diff = TRUE;
X else if (f->start && strcmp(f->start, new.start) != 0)
X diff = TRUE;
X else if (f->stop && strcmp(f->stop, new.stop) != 0)
X--- 805,814 ----
X diff = TRUE;
X else if ((f->command != NULL && new.command == NULL) || (f->command == NULL && new.command != NULL))
X diff = TRUE;
X! else if (new.stop && f->timeout != new.timeout)
X diff = TRUE;
X+ else if (f->save != new.save || f->beep != new.beep || f->flash != new.flash || f->log != new.log || f->open != new.open || f->stamp != new.stamp)
X+ diff = TRUE;
X else if (f->start && strcmp(f->start, new.start) != 0)
X diff = TRUE;
X else if (f->stop && strcmp(f->stop, new.stop) != 0)
X***************
X*** 825,834 ****
X int i, total;
X char *msg = NULL;
X
X! if (!check_for_update()) {
X! xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
X return;
X- }
X
X total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
X for (i = 0; i < total; i++)
X--- 845,854 ----
X int i, total;
X char *msg = NULL;
X
X! xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
X!
X! if (!check_for_update())
X return;
X
X total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
X for (i = 0; i < total; i++)
X***************
X*** 839,845 ****
X xv_set(contool_filters->filter_list, PANEL_LIST_SELECT, i, TRUE, NULL);
X update_controls();
X error(msg? msg : "No pattern is specified for the indicated filter");
X- xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
X return;
X }
X free_list(filters);
X--- 859,864 ----
X***************
X*** 852,857 ****
X--- 871,890 ----
X clipboard = NULL;
X }
X filters_changed();
X+ xv_set(item, PANEL_NOTIFY_STATUS, XV_OK, NULL);
X+ }
X+
X+ /************************************************************************/
X+ EXPORT void accept_and_save_filters(item, event)
X+
X+ Panel_item item;
X+ Event *event;
X+
X+ {
X+ accept_filters(item, event);
X+ if (xv_get(item, PANEL_NOTIFY_STATUS) == XV_OK)
X+ if (!store_filters_to_file(filter_file, TRUE, TRUE))
X+ xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
X }
X
X /************************************************************************/
X*** getopt.c.orig Wed May 29 12:09:33 1991
X--- getopt.c Fri May 17 09:10:22 1991
X***************
X*** 0 ****
X--- 1,64 ----
X+ /************************************************************************/
X+ /* Copyright 1987-1991 by Chuck Musciano and Harris Corporation */
X+ /* */
X+ /* Full ownership of this software, and all rights pertaining to */
X+ /* the for-profit distribution of this software, are retained by */
X+ /* Chuck Musciano and Harris Corporation. You are permitted to */
X+ /* use this software without fee. This software is provided "as */
X+ /* is" without express or implied warranty. You may redistribute */
X+ /* this software, provided that this copyright notice is retained, */
X+ /* and that the software is not distributed for profit. If you */
X+ /* wish to use this software in a profit-making venture, you must */
X+ /* first license this code and its underlying technology from */
X+ /* Harris Corporation. */
X+ /* */
X+ /* Bottom line: you can have this software, you can use it, you */
X+ /* can give it away. You just can't sell any or all parts of it */
X+ /* without prior permission from Harris Corporation. */
X+ /************************************************************************/
X+
X+ #include <stdio.h>
X+
X+ #include "manifest.h"
X+
X+ /************************************************************************/
X+ PRIVATE delarg(argc, argv)
X+
X+ int *argc;
X+ char **argv;
X+
X+ { char *p;
X+
X+ while (*argv = *(argv+1))
X+ argv++;
X+ (*argc)--;
X+ }
X+
X+ /************************************************************************/
X+ EXPORT char getopt(argc, argv, opts, parm)
X+
X+ int *argc;
X+ char **argv;
X+ char *opts;
X+ char **parm;
X+
X+ { char c, *p, *strcpy(), *index();
X+ int killed;
X+
X+ *parm = NULL;
X+ while (*argv && ((**argv != '-') || (*(*argv+1) == '\0')))
X+ argv++;
X+ if (*argv == NULL)
X+ return(EOF);
X+ c = *(*argv+1);
X+ *++(*argv) = '-';
X+ if (killed = (*(*argv+1) == '\0'))
X+ delarg(argc, argv);
X+ if ((p = index(opts, c)) == NULL)
X+ c = '\0';
X+ else if (*(p+1) == ':') {
X+ *parm = killed ? *argv : *argv+1;
X+ delarg(argc, argv);
X+ }
X+ return(c);
X+ }
X*** lex.c.orig Wed May 29 12:09:34 1991
X--- lex.c Wed May 29 08:13:11 1991
X***************
X*** 41,46 ****
X--- 41,47 ----
X {"flash_icon", FLASH_ICON},
X {"good_icon", GOOD_ICON},
X {"ignore", IGNORE},
X+ {"log", LOG},
X {"log_before_filtering", LOG_BEFORE_FILTERING},
X {"log_file", LOG_FILE},
X {"match", MATCH},
X***************
X*** 53,60 ****
X--- 54,63 ----
X {"quiet", QUIET},
X {"save", SAVE},
X {"stamp", STAMP},
X+ {"timeout", TIMEOUT},
X {"timestamp", TIMESTAMP},
X {"to", TO},
X+ {"version", VERSION},
X {"yes", YES}};
X
X PRIVATE struct {char first;
X***************
X*** 100,121 ****
X }
X
X /************************************************************************/
X- PRIVATE fix_escapes(buf)
X-
X- char *buf;
X-
X- { char *q;
X- int i;
X-
X- for (q = buf; *buf; buf++, q++)
X- if (*buf == '\\')
X- *q = *++buf;
X- else
X- *q = *buf;
X- *q = '\0';
X- }
X-
X- /************************************************************************/
X PRIVATE int is_keyword(s)
X
X char *s;
X--- 103,108 ----
X***************
X*** 164,179 ****
X }
X else if (c == '"' || c == '\'') {
X for (p = buf; TRUE; p++)
X! if ((*p = getch()) == c)
X! break;
X! else if (*p == '\\')
X! *++p = getch();
X else if (*p == '\n' || *p == '\r') {
X yyerror("Newline in string not allowed");
X break;
X }
X *p = '\0';
X- fix_escapes(buf);
X yylval.cpval = strsave(buf);
X RETURN(STRING);
X }
X--- 151,169 ----
X }
X else if (c == '"' || c == '\'') {
X for (p = buf; TRUE; p++)
X! if ((*p = getch()) == c) {
X! if ((c1 = getch()) != c) {
X! ungetc = c1;
X! break;
X! }
X! }
X! else if (*p == '\\' && filter_version < 310)
X! *p = getch();
X else if (*p == '\n' || *p == '\r') {
X yyerror("Newline in string not allowed");
X break;
X }
X *p = '\0';
X yylval.cpval = strsave(buf);
X RETURN(STRING);
X }
X*** load.c.orig Wed May 29 12:09:35 1991
X--- load.c Tue May 28 14:16:42 1991
X***************
X*** 79,86 ****
X }
X else {
X kind = (int) xv_get(ip->load_type, PANEL_VALUE);
X! if (kind & 1 && parsed_defaults)
X defaults = *parsed_defaults;
X if (kind & 2)
X filters = parsed_filters;
X free(parsed_defaults);
X--- 79,88 ----
X }
X else {
X kind = (int) xv_get(ip->load_type, PANEL_VALUE);
X! if (kind & 1 && parsed_defaults) {
X defaults = *parsed_defaults;
X+ adjust_window_limit();
X+ }
X if (kind & 2)
X filters = parsed_filters;
X free(parsed_defaults);
X*** load_icon.c.orig Wed May 29 12:09:35 1991
X--- load_icon.c Thu May 23 11:59:02 1991
X***************
X*** 29,35 ****
X #define ICON_PATH ".:./icons:/usr/local/images:/usr/include/images"
X #endif
X
X! PUBLIC char *getenv();
X
X /************************************************************************/
X EXPORT Server_image load_icon(path, message)
X--- 29,35 ----
X #define ICON_PATH ".:./icons:/usr/local/images:/usr/include/images"
X #endif
X
X! PUBLIC char *getenv(), *index();
X
X /************************************************************************/
X EXPORT Server_image load_icon(path, message)
X*** misc.c.orig Wed May 29 12:09:37 1991
X--- misc.c Fri May 24 13:42:46 1991
X***************
X*** 24,29 ****
X--- 24,31 ----
X #include "manifest.h"
X #include "contool.h"
X
X+ PUBLIC char *index();
X+
X /************************************************************************/
X EXPORT int getline(stream, string, max)
X
X***************
X*** 43,90 ****
X }
X
X /************************************************************************/
X- PRIVATE delarg(argc, argv)
X-
X- int *argc;
X- char **argv;
X-
X- { char *p;
X-
X- while (*argv = *(argv+1))
X- argv++;
X- (*argc)--;
X- }
X-
X- /************************************************************************/
X- EXPORT char getopt(argc, argv, opts, parm)
X-
X- int *argc;
X- char **argv;
X- char *opts;
X- char **parm;
X-
X- { char c, *p, *strcpy(), *index();
X- int killed;
X-
X- *parm = NULL;
X- while (*argv && ((**argv != '-') || (*(*argv+1) == '\0')))
X- argv++;
X- if (*argv == NULL)
X- return(EOF);
X- c = *(*argv+1);
X- *++(*argv) = '-';
X- if (killed = (*(*argv+1) == '\0'))
X- delarg(argc, argv);
X- if ((p = index(opts, c)) == NULL)
X- c = '\0';
X- else if (*(p+1) == ':') {
X- *parm = killed ? *argv : *argv+1;
X- delarg(argc, argv);
X- }
X- return(c);
X- }
X-
X- /************************************************************************/
X EXPORT int verify(source, valid)
X
X char *source;
X--- 45,50 ----
X***************
X*** 256,263 ****
X char *p;
X
X for (p = buf; *s; s++, p++)
X! if (*s == '\\' || *s == '"') {
X! *p++ = '\\';
X *p = *s;
X }
X else
X--- 216,223 ----
X char *p;
X
X for (p = buf; *s; s++, p++)
X! if (*s == '"') {
X! *p++ = '"';
X *p = *s;
X }
X else
X*** parse.y.orig Wed May 29 12:09:38 1991
X--- parse.y Wed May 29 10:10:58 1991
X***************
X*** 27,32 ****
X--- 27,33 ----
X
X EXPORT Props *parsed_defaults;
X EXPORT Filter *parsed_filters;
X+ EXPORT int filter_version = 0;
X
X EXPORT int parse_errors_occured;
X
X***************
X*** 53,62 ****
X %token LBRACE RBRACE
X
X %token BEEP CHECK_ICON COMMAND COMMENT DEFAULTS DELETE DISPLAY FILTERS
X! FLASH FLASH_ICON GOOD_ICON IGNORE LOG_BEFORE_FILTERING LOG_FILE
X! MATCH NO NOFLASH NOOPEN NOSTAMP OPEN PRINT QUIET SAVE STAMP TIMESTAMP TO YES
X
X! %type <ival> beep flash old_flash old_open old_stamp open stamp yes_no
X %type <cpval> command old_end_string string
X %type <fval> filter filter_list old_filter old_filter_list old_ignore old_quiet old_save
X
X--- 54,64 ----
X %token LBRACE RBRACE
X
X %token BEEP CHECK_ICON COMMAND COMMENT DEFAULTS DELETE DISPLAY FILTERS
X! FLASH FLASH_ICON GOOD_ICON IGNORE LOG LOG_BEFORE_FILTERING LOG_FILE
X! MATCH NO NOFLASH NOOPEN NOSTAMP OPEN PRINT QUIET SAVE STAMP TIMEOUT
X! TIMESTAMP TO VERSION YES
X
X! %type <ival> beep flash log old_flash old_open old_stamp open stamp yes_no
X %type <cpval> command old_end_string string
X %type <fval> filter filter_list old_filter old_filter_list old_ignore old_quiet old_save
X
X***************
X*** 100,105 ****
X--- 102,109 ----
X f->flash = $3;
X f->open = $4;
X f->stamp = $5;
X+ f->timeout = 0;
X+ f->log = TRUE;
X f->start = $6;
X f->stop = $7;
X f->start_re = NULL;
X***************
X*** 123,128 ****
X--- 127,134 ----
X f->flash = FALSE;
X f->open = FALSE;
X f->stamp = FALSE;
X+ f->timeout = 0;
X+ f->log = TRUE;
X f->start = $2;
X f->stop = $3;
X f->start_re = NULL;
X***************
X*** 146,151 ****
X--- 152,159 ----
X f->flash = FALSE;
X f->open = FALSE;
X f->stamp = TRUE;
X+ f->timeout = 0;
X+ f->log = TRUE;
X f->start = $2;
X f->stop = $3;
X f->start_re = NULL;
X***************
X*** 183,193 ****
X { $$ = $2; }
X ;
X
X! new_style : defaults
X! | filters
X! | defaults filters
X ;
X
X defaults : DEFAULTS
X { parsed_defaults = (Props *) malloc(sizeof(Props));
X *parsed_defaults = defaults;
X--- 191,207 ----
X { $$ = $2; }
X ;
X
X! new_style : version defaults
X! | version filters
X! | version defaults filters
X ;
X
X+ version : empty
X+ { filter_version = 0; }
X+ | VERSION INTEGER
X+ { filter_version = $2; }
X+ ;
X+
X defaults : DEFAULTS
X { parsed_defaults = (Props *) malloc(sizeof(Props));
X *parsed_defaults = defaults;
X***************
X*** 209,214 ****
X--- 223,230 ----
X { parsed_defaults->command = $1; }
X | flash
X { parsed_defaults->flash = $1; }
X+ | log
X+ { parsed_defaults->log = $1; }
X | open
X { parsed_defaults->open = $1; }
X | stamp
X***************
X*** 252,257 ****
X--- 268,275 ----
X filter : LBRACE
X { curr = (Filter *) malloc(sizeof(Filter));
X bzero(curr, sizeof(Filter));
X+ if (filter_version < 310)
X+ curr->log = TRUE;
X }
X filter_attr_list RBRACE
X { char *msg;
X***************
X*** 274,279 ****
X--- 292,299 ----
X { curr->command = $1; }
X | flash
X { curr->flash = $1; }
X+ | log
X+ { curr->log = $1; }
X | open
X { curr->open = $1; }
X | stamp
X***************
X*** 284,289 ****
X--- 304,311 ----
X { curr->save = !$2; }
X | MATCH string
X { curr->start = $2; }
X+ | TIMEOUT INTEGER
X+ { curr->timeout = $2; }
X | TO string
X { curr->stop = $2; }
X ;
X***************
X*** 296,301 ****
X--- 318,327 ----
X { $$ = $2; }
X ;
X flash : FLASH yes_no
X+ { $$ = $2; }
X+ ;
X+
X+ log : LOG yes_no
X { $$ = $2; }
X ;
X
X*** patchlevel.h.orig Wed May 29 12:09:39 1991
X--- patchlevel.h Tue May 28 13:27:17 1991
X***************
X*** 30,34 ****
X--- 30,37 ----
X /* comp.sources.x: Volume 10, Issue 78 */
X /* */
X /* 3 Bug fixes; see README for details */
X+ /* comp.sources.x: Volume 11, Issue 4 */
X+ /* */
X+ /* 4 Release of version 3.1; see README for details */
X /* */
X /************************************************************************/
X*** props.c.orig Wed May 29 12:09:41 1991
X--- props.c Tue May 28 14:16:40 1991
X***************
X*** 37,42 ****
X--- 37,43 ----
X
X EXPORT Props defaults = {3, /* beeps */
X TRUE, /* flash the icon */
X+ TRUE, /* write the message to the log */
X FALSE, /* don't pop the window */
X TRUE, /* timestamp the message */
X NULL, /* no command to run */
X***************
X*** 67,72 ****
X--- 68,75 ----
X val |= COMMAND_BIT;
X if (defaults.flash)
X val |= FLASH_BIT;
X+ if (defaults.log)
X+ val |= LOG_BIT;
X if (defaults.open)
X val |= OPEN_BIT;
X if (defaults.stamp > 0)
X***************
X*** 170,175 ****
X--- 173,179 ----
X new.command = NULL;
X
X new.flash = (val & FLASH_BIT)? TRUE : FALSE;
X+ new.log = (val & LOG_BIT)? TRUE : FALSE;
X new.open = (val & OPEN_BIT)? TRUE : FALSE;
X new.stamp = (val & STAMP_BIT)? TRUE : FALSE;
X new.log_file = (char *) xv_get(ip->log_file, PANEL_VALUE);
X***************
X*** 213,218 ****
X--- 217,223 ----
X new.command = strsave(defaults.command);
X defaults = new;
X
X+ adjust_window_limit();
X update_icons();
X update_logging();
X }
X*** regexp.c.orig Wed May 29 12:09:42 1991
X--- regexp.c Fri May 24 13:42:44 1991
X***************
X*** 82,87 ****
X--- 82,107 ----
X }
X
X /************************************************************************/
X+ PRIVATE char *fix_control_chars(s)
X+
X+ char *s;
X+
X+ { static char buf[2048];
X+ char *p;
X+
X+ for (p = buf; *s; s++, p++)
X+ if (*s == '\\' && *(s + 1) >= '0' && *(s + 1) <= '7') {
X+ for (*p = 0, s++; *s && *s >= '0' && *s <= '7'; s++)
X+ *p = (*p << 3) + *s - '0';
X+ s--;
X+ }
X+ else
X+ *p = *s;
X+ *p = '\0';
X+ return(buf);
X+ }
X+
X+ /************************************************************************/
X EXPORT char *compile_exp(filter, start, stop)
X
X Filter *filter;
X***************
X*** 93,104 ****
X
X sre = ere = NULL;
X if (start) {
X! if ((sre = compile(start, rbuf, rbuf+1024, '\0')) == NULL)
X return(error_message);
X sc = circf;
X }
X if (stop) {
X! if ((ere = compile(stop, rbuf, rbuf+1024, '\0')) == NULL) {
X cond_free(sre);
X return(error_message);
X }
X--- 113,124 ----
X
X sre = ere = NULL;
X if (start) {
X! if ((sre = compile(fix_control_chars(start), rbuf, rbuf+1024, '\0')) == NULL)
X return(error_message);
X sc = circf;
X }
X if (stop) {
X! if ((ere = compile(fix_control_chars(stop), rbuf, rbuf+1024, '\0')) == NULL) {
X cond_free(sre);
X return(error_message);
X }
X*** send_mail.c.orig Wed May 29 12:09:43 1991
X--- send_mail.c Wed May 29 11:59:52 1991
X***************
X*** 33,39 ****
X
X #include "manifest.h"
X
X! #define VERSION "3.0c"
X
X PUBLIC contool_base_objects *contool_base;
X
X--- 33,39 ----
X
X #include "manifest.h"
X
X! #define VERSION "3.1"
X
X PUBLIC contool_base_objects *contool_base;
X
X***************
X*** 56,77 ****
X }
X
X /************************************************************************/
X! EXPORT void handle_address(item, value, event)
X
X! Panel_item item;
X! int value;
X! Event *event;
X
X! {
X! if (value == 2) {
X! xv_set(dialog->other_address, WIN_SHOW, TRUE, NULL);
X! panel_paint(dialog->address, PANEL_NO_CLEAR);
X! panel_paint(dialog->other_address, PANEL_NO_CLEAR);
X }
X! else {
X! xv_set(dialog->other_address, WIN_SHOW, FALSE, NULL);
X! panel_paint(dialog->address, PANEL_NO_CLEAR);
X! }
X }
X
X /************************************************************************/
X--- 56,78 ----
X }
X
X /************************************************************************/
X! EXPORT Menu handle_address(menu, op)
X
X! Menu_item menu;
X! Menu_generate op;
X
X! { char *addr;
X!
X! if (op == MENU_NOTIFY) {
X! addr = (char *) xv_get(menu, MENU_STRING);
X! xv_set(dialog->other_address, WIN_SHOW, strcmp(addr, "Other:") == 0, NULL);
X! xv_set(dialog->fixed_address, PANEL_LABEL_STRING, addr, NULL);
X! panel_paint(dialog->other_address, PANEL_CLEAR);
X! panel_paint(dialog->fixed_address, PANEL_CLEAR);
X }
X! xv_set(menu, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
X! xv_set(xv_get(menu, MENU_PARENT), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
X! return(menu);
X }
X
X /************************************************************************/
X***************
X*** 95,103 ****
X FILE *pipe;
X
X xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, 0);
X! val = (int) xv_get(dialog->address, PANEL_VALUE);
X! if (val != 2)
X! sprintf(cmd, "%s %s", MAILER, xv_get(dialog->address, PANEL_CHOICE_STRING, val));
X else {
X buf = (char *) xv_get(dialog->other_address, PANEL_VALUE);
X if (is_empty(buf)) {
X--- 96,104 ----
X FILE *pipe;
X
X xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, 0);
X! buf = (char *) xv_get(dialog->fixed_address, PANEL_LABEL_STRING);
X! if (strcmp(buf, "Other:") != 0)
X! sprintf(cmd, "%s %s", MAILER, buf);
X else {
X buf = (char *) xv_get(dialog->other_address, PANEL_VALUE);
X if (is_empty(buf)) {
X***************
X*** 129,144 ****
X free(buf);
X textsw_reset(dialog->message, 0, 0);
X lets_get_busy(contool_base->base, FALSE, NULL);
X- xv_set(item, PANEL_NOTIFY_STATUS, XV_OK, 0);
X- }
X-
X- /************************************************************************/
X- EXPORT void cancel_mail(item, event)
X-
X- Panel_item item;
X- Event *event;
X-
X- {
X- textsw_reset(dialog->message, 0, 0);
X xv_set(item, PANEL_NOTIFY_STATUS, XV_OK, 0);
X }
X--- 130,134 ----
X*** store.c.orig Wed May 29 12:09:43 1991
X--- store.c Wed May 29 08:13:10 1991
X***************
X*** 39,44 ****
X--- 39,46 ----
X
X #define yes_no(x) ((x)? "yes" : "no")
X
X+ #define FILTER_VERSION 310
X+
X PUBLIC contool_base_objects *contool_base;
X
X PRIVATE contool_store_objects *contool_store = NULL;
X***************
X*** 68,147 ****
X }
X
X /************************************************************************/
X! EXPORT void store_filters(item, event)
X
X! Panel_item item;
X! Event *event;
X
X! { contool_store_objects *ip = (contool_store_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
X! char *path, buf[1024];
X FILE *f;
X- int kind;
X Filter *filt;
X
X- path = expand_tilde(xv_get(ip->store_file, PANEL_VALUE));
X if (access(path, W_OK) == 0) {
X sprintf(buf, "File \"%s\" exists. You can:", path);
X! kind = notice_prompt(contool_base->base, NULL,
X! NOTICE_MESSAGE_STRINGS, buf, NULL,
X! NOTICE_BUTTON_YES, "Overwrite",
X! NOTICE_BUTTON_NO, "Cancel",
X! NULL);
X! if (kind == 0) {
X! xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
X! free(path);
X! return;
X! }
X }
X if ((f = fopen(path, "w")) == NULL) {
X error("Cannot write to %s: %s", path, sys_errlist[errno]);
X! xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
X! free(path);
X }
X! else {
X! kind = (int) xv_get(ip->store_type, PANEL_VALUE);
X! if (kind & 1) {
X! fprintf(f, "defaults {\n");
X! fprintf(f, " beep %d\n", defaults.beep);
X! fprintf(f, " command \"%s\"\n", check_escapes(is_null(defaults.command)));
X! fprintf(f, " flash %s\n", yes_no(defaults.flash));
X! fprintf(f, " open %s\n", yes_no(defaults.open));
X! fprintf(f, " stamp %s\n", yes_no(defaults.stamp));
X! fprintf(f, " good_icon \"%s\"\n", is_null(defaults.good_icon));
X! fprintf(f, " check_icon \"%s\"\n", is_null(defaults.bad_icon));
X! fprintf(f, " flash_icon \"%s\"\n", is_null(defaults.flash_icon));
X! fprintf(f, " print \"%s\"\n", defaults.print_filter);
X! fprintf(f, " log_file \"%s\"\n", is_null(defaults.log_file));
X! fprintf(f, " log_before_filtering %s\n", yes_no(!defaults.log_after));
X! fprintf(f, " timestamp %d\n", defaults.stamp_resolution);
X! fprintf(f, " display %d\n", defaults.max_size);
X! fprintf(f, " delete %d\n", defaults.delete_amount);
X! fprintf(f, "}\n");
X! }
X! if (kind & 2) {
X! fprintf(f, "filters {\n");
X! for (filt = filters; filt; filt = filt->next) {
X! fprintf(f, " {\n");
X! fprintf(f, " match \"%s\"\n", check_escapes(filt->start));
X! if (filt->stop)
X! fprintf(f, " to \"%s\"\n", check_escapes(filt->stop));
X! if (filt->comment)
X! fprintf(f, " comment \"%s\"\n", check_escapes(filt->comment));
X! if (filt->save) {
X! fprintf(f, " ignore no\n");
X! fprintf(f, " beep %d\n", filt->beep);
X! fprintf(f, " command \"%s\"\n", check_escapes(is_null(filt->command)));
X! fprintf(f, " flash %s\n", yes_no(filt->flash));
X! fprintf(f, " open %s\n", yes_no(filt->open));
X! fprintf(f, " stamp %s\n", yes_no(filt->stamp));
X! }
X! else
X! fprintf(f, " ignore yes\n");
X! fprintf(f, " }\n");
X }
X! fprintf(f, "}\n");
X }
X! fclose(f);
X filter_file = path;
X }
X }
X--- 70,168 ----
X }
X
X /************************************************************************/
X! EXPORT int store_filters_to_file(path, save_filters, save_props)
X
X! char *path;
X! int save_filters;
X! int save_props;
X
X! { char buf[1024];
X! int answer;
X FILE *f;
X Filter *filt;
X
X if (access(path, W_OK) == 0) {
X sprintf(buf, "File \"%s\" exists. You can:", path);
X! answer = notice_prompt(contool_base->base, NULL,
X! NOTICE_MESSAGE_STRINGS, buf, NULL,
X! NOTICE_BUTTON_YES, "Overwrite",
X! NOTICE_BUTTON_NO, "Cancel",
X! NULL);
X! if (answer == 0)
X! return(FALSE);
X }
X if ((f = fopen(path, "w")) == NULL) {
X error("Cannot write to %s: %s", path, sys_errlist[errno]);
X! return(FALSE);
X }
X! fprintf(f, "version %d\n", FILTER_VERSION);
X! if (save_props) {
X! fprintf(f, "defaults {\n");
X! fprintf(f, " beep %d\n", defaults.beep);
X! fprintf(f, " command \"%s\"\n", check_escapes(is_null(defaults.command)));
X! fprintf(f, " flash %s\n", yes_no(defaults.flash));
X! fprintf(f, " log %s\n", yes_no(defaults.log));
X! fprintf(f, " open %s\n", yes_no(defaults.open));
X! fprintf(f, " stamp %s\n", yes_no(defaults.stamp));
X! fprintf(f, " good_icon \"%s\"\n", is_null(defaults.good_icon));
X! fprintf(f, " check_icon \"%s\"\n", is_null(defaults.bad_icon));
X! fprintf(f, " flash_icon \"%s\"\n", is_null(defaults.flash_icon));
X! fprintf(f, " print \"%s\"\n", defaults.print_filter);
X! fprintf(f, " log_file \"%s\"\n", is_null(defaults.log_file));
X! fprintf(f, " log_before_filtering %s\n", yes_no(!defaults.log_after));
X! fprintf(f, " timestamp %d\n", defaults.stamp_resolution);
X! fprintf(f, " display %d\n", defaults.max_size);
X! fprintf(f, " delete %d\n", defaults.delete_amount);
X! fprintf(f, "}\n");
X! }
X! if (save_filters) {
X! fprintf(f, "filters {\n");
X! for (filt = filters; filt; filt = filt->next) {
X! fprintf(f, " {\n");
X! fprintf(f, " match \"%s\"\n", check_escapes(filt->start));
X! if (filt->stop) {
X! fprintf(f, " to \"%s\"\n", check_escapes(filt->stop));
X! fprintf(f, " timeout %d\n", filt->timeout);
X }
X! if (filt->comment)
X! fprintf(f, " comment \"%s\"\n", check_escapes(filt->comment));
X! if (filt->save) {
X! fprintf(f, " ignore no\n");
X! fprintf(f, " beep %d\n", filt->beep);
X! fprintf(f, " command \"%s\"\n", check_escapes(is_null(filt->command)));
X! fprintf(f, " flash %s\n", yes_no(filt->flash));
X! fprintf(f, " log %s\n", yes_no(filt->log));
X! fprintf(f, " open %s\n", yes_no(filt->open));
X! fprintf(f, " stamp %s\n", yes_no(filt->stamp));
X! }
X! else
X! fprintf(f, " ignore yes\n");
X! fprintf(f, " }\n");
X }
X! fprintf(f, "}\n");
X! }
X! fclose(f);
X! return(TRUE);
X! }
X!
X! /************************************************************************/
X! EXPORT void store_filters(item, event)
X!
X! Panel_item item;
X! Event *event;
X!
X! { contool_store_objects *ip = (contool_store_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
X! char *path;
X! int kind;
X!
X! path = expand_tilde(xv_get(ip->store_file, PANEL_VALUE));
X! kind = (int) xv_get(ip->store_type, PANEL_VALUE);
X! if (store_filters_to_file(path, kind & 2, kind & 1)) {
X! xv_set(item, PANEL_NOTIFY_STATUS, XV_OK, NULL);
X filter_file = path;
X+ }
X+ else {
X+ free(path);
X+ xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
X }
X }
END_OF_FILE
if test 55243 -ne `wc -c <'patch.2'`; then
echo shar: \"'patch.2'\" unpacked with wrong size!
fi
# end of 'patch.2'
fi
echo shar: End of shell archive.
exit 0
--
Dan Heller
O'Reilly && Associates Z-Code Software Comp-sources-x:
Senior Writer President comp-sources-x at uunet.uu.net
argv at ora.com argv at zipcode.com
More information about the Comp.sources.x
mailing list