home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume16 / contol32 / part02 < prev    next >
Encoding:
Text File  |  1992-03-04  |  54.8 KB  |  1,273 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!think.com!mips!msi!dcmartin
  3. From: chuck@trantor.harris-atd.com (Chuck Musciano)
  4. Subject: v16i087: Contool 3.2, Part02/05
  5. Message-ID: <1992Mar5.185110.2231@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-16i086-contool-3.2@uunet.UU.NET>
  10. Date: Thu, 5 Mar 1992 18:51:10 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: chuck@trantor.harris-atd.com (Chuck Musciano)
  14. Posting-number: Volume 16, Issue 87
  15. Archive-name: contool-3.2/part02
  16.  
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  21. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  22. # If this archive is complete, you will see the following message at the end:
  23. #        "End of archive 2 (of 5)."
  24. # Contents:  contool.c contool.info
  25. # Wrapped by dcmartin@fascet on Sat Feb 22 10:11:09 1992
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'contool.c' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'contool.c'\"
  29. else
  30. echo shar: Extracting \"'contool.c'\" \(23861 characters\)
  31. sed "s/^X//" >'contool.c' <<'END_OF_FILE'
  32. X/************************************************************************/
  33. X/*    Copyright 1987-1991 by Chuck Musciano and Harris Corporation     */
  34. X/*                                    */
  35. X/*    Full ownership of this software, and all rights pertaining to     */
  36. X/*    the for-profit distribution of this software, are retained by     */
  37. X/*    Chuck Musciano and Harris Corporation.  You are permitted to     */
  38. X/*    use this software without fee.  This software is provided "as     */
  39. X/*    is" without express or implied warranty.  You may redistribute     */
  40. X/*    this software, provided that this copyright notice is retained,    */
  41. X/*    and that the software is not distributed for profit.  If you     */
  42. X/*    wish to use this software in a profit-making venture, you must     */
  43. X/*    first license this code and its underlying technology from     */
  44. X/*    Harris Corporation.                         */
  45. X/*                                    */
  46. X/*    Bottom line: you can have this software, you can use it, you     */
  47. X/*    can give it away.  You just can't sell any or all parts of it     */
  48. X/*    without prior permission from Harris Corporation.         */
  49. X/************************************************************************/
  50. X
  51. X/************************************************************************/
  52. X/*                                    */
  53. X/*    contool.c    main contool driver                */
  54. X/*                                    */
  55. X/************************************************************************/
  56. X
  57. X#include    <stdio.h>
  58. X#include    <fcntl.h>
  59. X#include    <strings.h>
  60. X#include    <sys/ioctl.h>
  61. X#include    <sys/file.h>
  62. X#include    <sys/types.h>
  63. X#include    <sys/stat.h>
  64. X#include    <sys/param.h>
  65. X
  66. X#include    <X11/Xlib.h>
  67. X#include    <X11/Xutil.h>
  68. X
  69. X#include    <xview/xview.h>
  70. X#include    <xview/icon.h>
  71. X#include    <xview/panel.h>
  72. X#include    <xview/textsw.h>
  73. X#include    <xview/notify.h>
  74. X
  75. X#include    "manifest.h"
  76. X#include    "contool.h"
  77. X#include    "contool_ui.h"
  78. X
  79. X#define        update_value(old, new)        ((old) = ((new) > (old))? (new) : (old))
  80. X
  81. X#define        INPUT_BUFFER_SIZE        4096
  82. X
  83. XEXPORT    Attr_attribute    INSTANCE;
  84. X
  85. XEXPORT    contool_base_objects    *contool_base;
  86. XEXPORT    char            *filter_file;
  87. X
  88. XPUBLIC    Server_image        load_icon();
  89. X
  90. XPRIVATE    Notify_value        blink_proc();
  91. X
  92. XPRIVATE    short    good_bits[]  = {
  93. X#include    "icons/default_good.icon"
  94. X                   };
  95. XPRIVATE    short    bad_bits[]   = {
  96. X#include    "icons/default_bad.icon"
  97. X                   };
  98. XPRIVATE    short    flash_bits[] = {
  99. X#include    "icons/default_flash.icon"
  100. X                   };
  101. XPRIVATE    short    mask_bits[] = {
  102. X#include    "icons/mask.icon"
  103. X                   };
  104. X
  105. XPRIVATE    char            *ct_usage = "usage: contool [-c <file>] [-f] [-i <file>] [-l] [-L <file>] [-n]\n";
  106. X
  107. XPRIVATE    Server_image        default_good_icon, good = NULL;
  108. XPRIVATE    Server_image        default_bad_icon, bad = NULL;
  109. XPRIVATE    Server_image        default_flash_icon, flash = NULL;
  110. XPRIVATE    Server_image        icon_mask;
  111. X
  112. XPRIVATE    int            bad_is_up;
  113. XPRIVATE    int            beep_count;
  114. XPRIVATE    int            blinking = FALSE;
  115. XPRIVATE    FILE            *command = NULL;
  116. XPRIVATE    Filter            *curr_filter = NULL;
  117. XPRIVATE    int            event_in_progress = FALSE;
  118. XPRIVATE    int            explicit_filters = FALSE;
  119. XPRIVATE    int            fork_into_background = FALSE;
  120. XPRIVATE    int            masking_works;
  121. XPRIVATE    FILE            *master = NULL;
  122. XPRIVATE    int            no_console = FALSE;
  123. XPRIVATE    int            old_time = 0;
  124. XPRIVATE    char            *program;
  125. XPRIVATE    FILE            *slave = NULL;
  126. XPRIVATE    int            filter_timeout = 0;
  127. X
  128. XPRIVATE    struct    itimerval    timer = {{0, 500000}, {0, 500000}};
  129. X
  130. X/************************************************************************/
  131. X/*    Manage piping console output to a command             */
  132. X/************************************************************************/
  133. X
  134. X/************************************************************************/
  135. XPRIVATE    start_command(cmd)
  136. X
  137. Xchar    *cmd;
  138. X
  139. X{
  140. X    if (command)
  141. X       pclose(command);
  142. X    if ((command = popen(cmd, "w")) == NULL)
  143. X       internal_error("could not execute \"%s\"", cmd);
  144. X}
  145. X
  146. X/************************************************************************/
  147. XPRIVATE    continue_command(buf)
  148. X
  149. Xchar    *buf;
  150. X
  151. X{
  152. X    if (command)
  153. X       fprintf(command, buf);
  154. X}
  155. X
  156. X/************************************************************************/
  157. XPRIVATE    end_command()
  158. X
  159. X{
  160. X    if (command)
  161. X       pclose(command);
  162. X}
  163. X
  164. X/************************************************************************/
  165. X/*    Some basic console utility routines                 */
  166. X/************************************************************************/
  167. X
  168. X/************************************************************************/
  169. XPRIVATE    stop_blinking()
  170. X
  171. X{
  172. X    if (filter_timeout <= 0)
  173. X       notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
  174. X    change_icon(good, good == default_good_icon);
  175. X    blinking = FALSE;
  176. X}
  177. X
  178. X/************************************************************************/
  179. XEXPORT    acquire_console()
  180. X
  181. X{
  182. X    if (slave)
  183. X       if (ioctl(fileno(slave), TIOCCONS, NULL) == -1)
  184. X          abend("%s: could not attach to /dev/console", program);
  185. X}
  186. X
  187. X/************************************************************************/
  188. XEXPORT    filters_changed()
  189. X
  190. X{
  191. X    curr_filter = NULL;
  192. X    xv_set(contool_base->base, FRAME_LEFT_FOOTER, "", NULL);
  193. X    end_command();
  194. X    filter_timeout = 0;
  195. X    if (!blinking && beep_count == 0)
  196. X       notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
  197. X}
  198. X
  199. X/************************************************************************/
  200. XEXPORT    adjust_window_limit()
  201. X
  202. X{    int    sw_len;
  203. X    char    *temp;
  204. X
  205. X    sw_len = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
  206. X    temp = (char *) malloc((unsigned) sw_len);
  207. X    xv_get(contool_base->display, TEXTSW_CONTENTS, 0, temp, sw_len);
  208. X    xv_set(contool_base->display, TEXTSW_MEMORY_MAXIMUM, defaults.max_size + defaults.max_size / 10, NULL);
  209. X    textsw_reset(contool_base->display, 0, 0);
  210. X    if (sw_len > defaults.max_size)
  211. X       textsw_insert(contool_base->display, temp + sw_len - defaults.max_size, defaults.max_size);
  212. X    else
  213. X       textsw_insert(contool_base->display, temp, sw_len);
  214. X    free(temp);
  215. X    reset_archive_size();
  216. X}
  217. X
  218. X/************************************************************************/
  219. X/*    Various small features                        */
  220. X/************************************************************************/
  221. X
  222. X/************************************************************************/
  223. XEXPORT    Menu_item    print_messages(item, op)
  224. X
  225. XMenu_item    item;
  226. XMenu_generate    op;
  227. X
  228. X{    int    size;
  229. X    char    *buf;
  230. X    FILE    *cmd;
  231. X
  232. X    if (op == MENU_NOTIFY) {
  233. X       if (is_empty(defaults.print_filter))
  234. X          error("You must specify a printer command in the Properties dialog");
  235. X       else if ((cmd = popen(defaults.print_filter, "w")) == NULL)
  236. X          error("Could not execute %s", defaults.print_filter);
  237. X       else {
  238. X          lets_get_busy(contool_base->base, TRUE, NULL);
  239. X          size = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
  240. X          buf = (char *) malloc(size);
  241. X          xv_get(contool_base->display, TEXTSW_CONTENTS, 0, buf, size);
  242. X          if (fwrite(buf, 1, size, cmd) != size)
  243. X             error("Could not write console contents to printer");
  244. X          pclose(cmd);
  245. X          free(buf);
  246. X          lets_get_busy(contool_base->base, FALSE, NULL);
  247. X          }
  248. X       }
  249. X    return item;
  250. X}
  251. X
  252. X/************************************************************************/
  253. XEXPORT    Menu_item    become_console(item, op)
  254. X
  255. XMenu_item    item;
  256. XMenu_generate    op;
  257. X
  258. X{
  259. X    if (op == MENU_NOTIFY)
  260. X       acquire_console();
  261. X    return item;
  262. X}
  263. X
  264. X/************************************************************************/
  265. XEXPORT    Menu_item    clear_messages(item, op)
  266. X
  267. XMenu_item    item;
  268. XMenu_generate    op;
  269. X
  270. X{
  271. X    if (op == MENU_NOTIFY) {
  272. X       textsw_reset(contool_base->display, 0, 0);
  273. X       old_time = 0;
  274. X       }
  275. X    return item;
  276. X}
  277. X
  278. X/************************************************************************/
  279. XEXPORT    Menu_item    reset_filter(item, op)
  280. X
  281. XMenu_item    item;
  282. XMenu_generate    op;
  283. X
  284. X{
  285. X    if (op == MENU_NOTIFY)
  286. X       filters_changed();
  287. X    return item;
  288. X}
  289. X
  290. X/************************************************************************/
  291. XEXPORT    Menu_item    save_to_archive(item, op)
  292. X
  293. XMenu_item    item;
  294. XMenu_generate    op;
  295. X
  296. X{
  297. X    if (op == MENU_NOTIFY)
  298. X       archive_messages();
  299. X    return(item);
  300. X}
  301. X
  302. X/************************************************************************/
  303. XPRIVATE    change_icon(image, use_mask)
  304. X
  305. XServer_image    image;
  306. Xint        use_mask;
  307. X
  308. X{    Icon    icon;
  309. X
  310. X    icon = (Icon) xv_get(contool_base->base, FRAME_ICON);
  311. X    xv_set(icon,
  312. X          ICON_IMAGE, image,
  313. X          ICON_MASK_IMAGE, NULL,
  314. X          XV_WIDTH, (int) xv_get(image, XV_WIDTH),
  315. X          XV_HEIGHT, (int) xv_get(image, XV_HEIGHT),
  316. X           NULL);
  317. X    if (masking_works && use_mask)
  318. X       xv_set(icon, ICON_MASK_IMAGE, icon_mask, NULL);
  319. X    xv_set(contool_base->base, FRAME_ICON, icon, NULL);
  320. X}
  321. X
  322. X/************************************************************************/
  323. XEXPORT    update_icons()
  324. X
  325. X{    char    msg[1024];
  326. X
  327. X    if (good && good != default_good_icon)
  328. X       xv_destroy(good);
  329. X    if (bad && bad != default_bad_icon)
  330. X       xv_destroy(bad);
  331. X    if (flash && flash != default_flash_icon)
  332. X       xv_destroy(flash);
  333. X
  334. X    good = (defaults.good_icon == NULL)? default_good_icon : load_icon(defaults.good_icon, msg);
  335. X    if (good == NULL) {
  336. X       internal_error("Cannot load default \"All is well\" icon %s: %s", defaults.good_icon, msg);
  337. X       good = default_good_icon;
  338. X       }
  339. X    bad = (defaults.bad_icon == NULL)? default_bad_icon : load_icon(defaults.bad_icon, msg);
  340. X    if (bad == NULL) {
  341. X       internal_error("Cannot load default \"Check console\" icon %s: %s", defaults.bad_icon, msg);
  342. X       bad = default_bad_icon;
  343. X       }
  344. X    flash = (defaults.flash_icon == NULL)? default_flash_icon : load_icon(defaults.flash_icon, msg);
  345. X    if (flash == NULL) {
  346. X       internal_error("Cannot load default \"Flash\" icon %s: %s", defaults.flash_icon, msg);
  347. X       flash = default_flash_icon;
  348. X       }
  349. X
  350. X    if (!blinking)
  351. X       change_icon(good, good == default_good_icon);
  352. X}
  353. X
  354. X/************************************************************************/
  355. X/*    Now, filter handlers                        */
  356. X/************************************************************************/
  357. X
  358. X/************************************************************************/
  359. XPRIVATE    internal_message(a, b, c, d, e, f)
  360. X
  361. Xint    a, b, c, d, e, f;
  362. X
  363. X{    char    buf[1024];
  364. X
  365. X    sprintf(buf, a, b, c, d, e, f);
  366. X    time_stamp();
  367. X    write_log(buf);
  368. X    do_insertion(buf, strlen(buf));
  369. X}
  370. X
  371. X/************************************************************************/
  372. XPRIVATE    internal_error(a, b, c, d, e, f)
  373. X
  374. Xint    a, b, c, d, e, f;
  375. X
  376. X{    char    buf[1024];
  377. X
  378. X    sprintf(buf, a, b, c, d, e, f);
  379. X    time_stamp();
  380. X    fprintf(stderr, "*** %s: %s\n", program, buf);
  381. X}
  382. X
  383. X/************************************************************************/
  384. XPRIVATE    load_filters()
  385. X
  386. X{    struct    stat    sb;
  387. X    static    int    load_time = 0;
  388. X
  389. X    if (access(filter_file, R_OK) == -1) {
  390. X       if (explicit_filters && load_time == 0) {
  391. X          internal_error("filter file %s cannot be accessed", filter_file);
  392. X          load_time = 1;
  393. X          }
  394. X       }
  395. X    else if (stat(filter_file, &sb) == 0 && sb.st_mtime > load_time)
  396. X       if (lex_init(filter_file)) {
  397. X          yyparse();
  398. X          if (!parse_errors_occured) {
  399. X             free_list(filters);
  400. X             free(parsed_defaults);
  401. X             filters = parsed_filters;
  402. X             internal_message("*** filters loaded from %s\n", filter_file);
  403. X             load_time = sb.st_mtime;
  404. X             }
  405. X          }
  406. X       else {
  407. X          internal_error("error accessing configuration file %s", filter_file);
  408. X          load_time = 1;
  409. X          }
  410. X}
  411. X
  412. X/************************************************************************/
  413. X/*    Various event handlers for the console frame            */
  414. X/************************************************************************/
  415. X
  416. X/************************************************************************/
  417. XPRIVATE    Notify_value    blink_proc(me, which)
  418. X
  419. Xint    *me;
  420. Xint    which;
  421. X
  422. X{
  423. X    if (event_in_progress)
  424. X       return(NOTIFY_DONE);
  425. X    if (beep_count > 0) {
  426. X       window_bell(contool_base->base);
  427. X       beep_count--;
  428. X       }
  429. X    if (blinking) {
  430. X       if (bad_is_up)
  431. X          change_icon(flash, flash == default_flash_icon);
  432. X       else
  433. X          change_icon(bad, bad == default_bad_icon);
  434. X       bad_is_up = !bad_is_up;
  435. X       }
  436. X    if (filter_timeout > 0)
  437. X       if (--filter_timeout <= 0)
  438. X          filters_changed();
  439. X    if (beep_count == 0 && !blinking && filter_timeout <= 0)
  440. X       notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
  441. X    return(NOTIFY_DONE);
  442. X}
  443. X
  444. X/************************************************************************/
  445. XPRIVATE    Notify_value    close_proc(frame, event, arg, type)
  446. X
  447. XFrame    frame;
  448. XEvent    *event;
  449. XNotify_arg    arg;
  450. XNotify_event_type    type;
  451. X
  452. X{
  453. X    event_in_progress = TRUE;
  454. X    if (event_action(event) == ACTION_OPEN) {
  455. X       if (blinking)
  456. X          stop_blinking();
  457. X       create_archive();
  458. X       }
  459. X    if (event_action(event) == ACTION_CLOSE && defaults.archive_style == ARCHIVE_ON_CLOSE)
  460. X       archive_messages();
  461. X    event_in_progress = FALSE;
  462. X    return(notify_next_event_func(frame, event, arg, type));
  463. X}
  464. X
  465. X/************************************************************************/
  466. XPRIVATE    Notify_value    destroy_proc(frame, status)
  467. X
  468. XFrame    frame;
  469. XDestroy_status    status;
  470. X
  471. X{
  472. X    if (status == DESTROY_CHECKING) {
  473. X       textsw_reset(contool_base->display, 0, 0);
  474. X       return(NOTIFY_DONE);
  475. X       }
  476. X    else
  477. X       return(notify_next_destroy_func(frame, status));
  478. X}
  479. X
  480. X/************************************************************************/
  481. XPRIVATE    Notify_value    signal_proc(frame, sig, when)
  482. X
  483. XFrame    frame;
  484. Xint    sig;
  485. XNotify_signal_mode    when;
  486. X
  487. X{
  488. X    if (sig == SIGUSR1)
  489. X       stop_blinking();
  490. X    else if (sig == SIGHUP)
  491. X       update_logging();
  492. X    return(NOTIFY_DONE);
  493. X}
  494. X
  495. X/************************************************************************/
  496. X/*    Routines which handle capturing and displaying messages        */
  497. X/************************************************************************/
  498. X
  499. X/************************************************************************/
  500. XPRIVATE    do_insertion(buf, len)
  501. X
  502. Xchar    *buf;
  503. Xint    len;
  504. X
  505. X{    int    sw_len;
  506. X    Textsw_index    first, last;
  507. X    char    *temp;
  508. X
  509. X    while ((int) xv_get(contool_base->display, TEXTSW_LENGTH) + len > defaults.max_size) {
  510. X       sw_len = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
  511. X       first = 1;
  512. X       last = TEXTSW_INFINITY;
  513. X       if (textsw_find_bytes(contool_base->display, &first, &last, "\n<<<", 4, 0) == -1 || first == 0)
  514. X          if (textsw_find_bytes(contool_base->display, &first, &last, "\n", 1, 0) == -1 || first == 0)
  515. X             first = (defaults.delete_amount < sw_len)? defaults.delete_amount : sw_len;
  516. X       temp = (char *) malloc((unsigned) sw_len);
  517. X       xv_get(contool_base->display, TEXTSW_CONTENTS, 0, temp, sw_len);
  518. X       textsw_reset(contool_base->display, 0, 0);
  519. X       textsw_insert(contool_base->display, temp + first, sw_len - first);
  520. X       free(temp);
  521. X       }
  522. X    xv_set(contool_base->display, TEXTSW_INSERTION_POINT, TEXTSW_INFINITY, 0);
  523. X    textsw_insert(contool_base->display, buf, len);
  524. X}
  525. X
  526. X/************************************************************************/
  527. XPRIVATE    time_stamp()
  528. X
  529. X{    int    t, pos;
  530. X    char    buf[5];
  531. X
  532. X       t = time(0);
  533. X       if (t - old_time >= defaults.stamp_resolution) {
  534. X          xv_set(contool_base->display, TEXTSW_INSERTION_POINT, TEXTSW_INFINITY, 0);
  535. X          pos = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
  536. X          if (pos != 0) {
  537. X             xv_get(contool_base->display, TEXTSW_CONTENTS, pos - 1, buf, 1);
  538. X             if (buf[0] != '\n')
  539. X                do_insertion("\n", 1);
  540. X             }
  541. X          do_insertion("\n<<< ", 5);
  542. X          do_insertion(ctime(&t), 24);
  543. X          do_insertion(" >>>\n", 5);
  544. X          old_time = t;
  545. X          }
  546. X}
  547. X
  548. X/************************************************************************/
  549. XPRIVATE    Notify_value    input_func(me, fd)
  550. X
  551. Xint    *me;
  552. Xint    fd;
  553. X
  554. X{    char    old_c, *s, *t, buf[1024];
  555. X    Filter    *f;
  556. X    int    count, do_blink = FALSE, do_open = FALSE;
  557. X    static    char    in_buf[INPUT_BUFFER_SIZE + 2];
  558. X    static    int    leftover = 0;
  559. X
  560. X    while ((count = read(fileno(master), in_buf + leftover, INPUT_BUFFER_SIZE - leftover)) >= 0) {
  561. X       if (count == 0 && slave == NULL)
  562. X          abend("%s: input source has reached EOF, exiting", program);
  563. X       in_buf[count + leftover] = '\0';
  564. X       leftover = 0;
  565. X       while (s = index(in_buf, '\015'))
  566. X          strcpy(s, s + 1);
  567. X       for (t = in_buf; *t; *s = old_c, t = s) {
  568. X          if (s = index(t, '\n')) {
  569. X             old_c = *++s;
  570. X             *s = '\0';
  571. X             }
  572. X          else {
  573. X             leftover = strlen(t);
  574. X             strcpy(in_buf, t);
  575. X             break;
  576. X             }
  577. X          if (!defaults.log_after)
  578. X             write_log(t);
  579. X          if (curr_filter == NULL) {
  580. X             load_filters();
  581. X             for (f = filters; f; f = f->next)
  582. X                if (f->start_re && match_exp(f->start_re, f->start_circf, t)) {
  583. X                   if (f->save) {
  584. X                      update_value(do_blink, f->flash);
  585. X                      update_value(beep_count, f->beep);
  586. X                      update_value(do_open, f->open);
  587. X                      if (f->stamp)
  588. X                         time_stamp();
  589. X                      do_insertion(t, strlen(t));
  590. X                      if (f->command) {
  591. X                         start_command(f->command);
  592. X                         continue_command(t);
  593. X                         if (f->stop == NULL)
  594. X                            end_command();
  595. X                         }
  596. X                      if (defaults.log_after && f->log)
  597. X                 write_log(t);
  598. X                      }
  599. X                   if (f->stop) {
  600. X                      curr_filter = f;
  601. X                      filter_timeout = f->timeout * 2;
  602. X                      sprintf(buf, "Filtering \"%s\"...", f->start);
  603. X                      xv_set(contool_base->base, FRAME_LEFT_FOOTER, buf, NULL);
  604. X                      }
  605. X                   break;
  606. X                   }
  607. X             if (f == NULL) {
  608. X                if (defaults.stamp)
  609. X                   time_stamp();
  610. X                if (defaults.command) {
  611. X                   start_command(defaults.command);
  612. X                   continue_command(t);
  613. X                   end_command();
  614. X                   }
  615. X            if (defaults.log_after && defaults.log)
  616. X                   write_log(t);
  617. X                do_insertion(t, strlen(t));
  618. X                update_value(do_blink, defaults.flash);
  619. X                update_value(do_open, defaults.open);
  620. X                update_value(beep_count, defaults.beep);
  621. X                }
  622. X             }
  623. X          else {
  624. X             if (curr_filter->save) {
  625. X                if (curr_filter->stamp)
  626. X                   time_stamp();
  627. X            if (defaults.log_after && curr_filter->log)
  628. X                   write_log(t);
  629. X            do_insertion(t, strlen(t));
  630. X            if (curr_filter->command)
  631. X               continue_command(t);
  632. X                }
  633. X             if (match_exp(curr_filter->stop_re, curr_filter->stop_circf, t)) {
  634. X                xv_set(contool_base->base, FRAME_LEFT_FOOTER, "", NULL);
  635. X                if (curr_filter->command)
  636. X                   end_command();
  637. X                curr_filter = NULL;
  638. X                }
  639. X             }
  640. X          }
  641. X       }
  642. X    xv_set(contool_base->display, TEXTSW_UPDATE_SCROLLBAR, 0);
  643. X    if (do_open)
  644. X       xv_set(contool_base->base, FRAME_CLOSED, FALSE, 0);
  645. X    if (do_blink)
  646. X       if (xv_get(contool_base->base, FRAME_CLOSED) && !blinking) {
  647. X          change_icon(bad, bad == default_bad_icon);
  648. X          xv_set(contool_base->base, WIN_SHOW, TRUE, 0);
  649. X          blinking = TRUE;
  650. X          bad_is_up = TRUE;
  651. X          notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
  652. X          }
  653. X    if (beep_count > 0 || blinking || filter_timeout > 0)
  654. X       notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
  655. X    return(NOTIFY_DONE);
  656. X}
  657. X
  658. X/************************************************************************/
  659. X/*    Routines which parse options, create windows, and main()    */
  660. X/************************************************************************/
  661. X
  662. X/************************************************************************/
  663. XPRIVATE    parse_options(argc, argv)
  664. X
  665. Xint    *argc;
  666. Xchar    **argv;
  667. X
  668. X{    char    *s, c, path[1024], *log_file = NULL, *p;
  669. X    int    log = FALSE, fd;
  670. X    static    char    cmdline[MAXPATHLEN + 10];
  671. X    struct    stat    sb;
  672. X
  673. X    sprintf(path, "%s/.contool", getenv("HOME"));
  674. X    filter_file = strsave(path);
  675. X
  676. X    cmdline[0] = NULL;
  677. X
  678. X    while ((c = getopt(argc, argv, "c:fi:lL:n?", &s)) != EOF)
  679. X       switch (c) {
  680. X          case 'c' : filter_file = expand_tilde(s);
  681. X                   explicit_filters = TRUE;
  682. X                 strcat(cmdline, " -c ");
  683. X             strcat(cmdline, s);
  684. X                   break;
  685. X          case 'f' : fork_into_background = TRUE;
  686. X                   strcat(cmdline, " -f");
  687. X                   break;
  688. X          case 'i' : fclose(master);
  689. X                   fclose(slave);
  690. X                   slave = NULL;
  691. X                   if (strcmp(s, "-") == 0)
  692. X                      master = stdin;
  693. X                   else {
  694. X                      p = expand_tilde(s);
  695. X                      if (stat(p, &sb) != 0)
  696. X                         abend("%s: cannot stat %s: %s", program, s, sys_errlist[errno]);
  697. X                      else if ((sb.st_mode & S_IFMT) != S_IFCHR && (sb.st_mode & S_IFMT) != S_IFIFO)
  698. X                         abend("%s: %s is not a FIFO or character special device", program, s);
  699. X                      else if ((fd = open(p, O_RDONLY | O_NDELAY)) < 0)
  700. X                         abend("%s: cannot open %s for reading: %s", program, s, sys_errlist[errno]);
  701. X                      else if ((master = fdopen(fd, "r")) == NULL)
  702. X                         abend("%s: cannot convert descriptor for %s to stream: %s", program, s, sys_errlist[errno]);
  703. X                      }
  704. X                   strcat(cmdline, " -i ");
  705. X                   strcat(cmdline, s);
  706. X                   break;
  707. X          case 'l' : log = TRUE;
  708. X                 strcat(cmdline, " -l");
  709. X                   break;
  710. X          case 'L' : log_file = expand_tilde(s);
  711. X                 strcat(cmdline, " -L ");
  712. X             strcat(cmdline, s);
  713. X                   break;
  714. X          case 'n' : no_console = TRUE;
  715. X                 strcat(cmdline, " -n");
  716. X                   break;
  717. X          case '?' : fprintf(stderr, ct_usage);
  718. X                   exit(0);
  719. X                   break;
  720. X          default  : fprintf(stderr, ct_usage);
  721. X                     exit(1);
  722. X          }
  723. X
  724. X    if (strlen(cmdline) > 0)
  725. X        xv_set(contool_base->base, WIN_CMD_LINE, cmdline, NULL);
  726. X
  727. X    if (lex_init(filter_file)) {
  728. X       yyparse();
  729. X       if (parsed_defaults)
  730. X          defaults = *parsed_defaults;
  731. X       if (log_file)
  732. X          defaults.log_file = log_file;
  733. X       if (log)
  734. X          enable_logging();
  735. X       adjust_window_limit();
  736. X       }
  737. X    else if (explicit_filters)
  738. X       error("Could not read configuration file %s", filter_file);
  739. X}
  740. X
  741. X/************************************************************************/
  742. Xmain(argc, argv)
  743. X
  744. Xint    argc;
  745. Xchar    **argv;
  746. X
  747. X{    char    buf[1024], *p, *path, *open_psuedo_tty();
  748. X    int    i;
  749. X    XWindowAttributes    attr;
  750. X    XClassHint    hints;
  751. X
  752. X    program = strsave(argv[0]);
  753. X
  754. X    path = open_psuedo_tty(&master, "r", &slave, "w");
  755. X    if (master == NULL)
  756. X       abend("%s: couldn't open any psuedo-tty", program);
  757. X    if (slave == NULL)
  758. X       abend("%s: couldn't open slave side of %s", program, path);
  759. X
  760. X    xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);
  761. X    INSTANCE = xv_unique_key();
  762. X
  763. X    contool_base = contool_base_objects_initialize(NULL, NULL);
  764. X    default_good_icon  = (Server_image) xv_create(NULL, SERVER_IMAGE,
  765. X                             XV_WIDTH, 64,
  766. X                             XV_HEIGHT, 64,
  767. X                             SERVER_IMAGE_BITS, good_bits,
  768. X                              NULL);
  769. X    default_bad_icon   = (Server_image) xv_create(NULL, SERVER_IMAGE,
  770. X                             XV_WIDTH, 64,
  771. X                             XV_HEIGHT, 64,
  772. X                             SERVER_IMAGE_BITS, bad_bits,
  773. X                              NULL);
  774. X    default_flash_icon = (Server_image) xv_create(NULL, SERVER_IMAGE,
  775. X                             XV_WIDTH, 64,
  776. X                             XV_HEIGHT, 64,
  777. X                             SERVER_IMAGE_BITS, flash_bits,
  778. X                              NULL);
  779. X    icon_mask          = (Server_image) xv_create(NULL, SERVER_IMAGE,
  780. X                             XV_WIDTH, 64,
  781. X                             XV_HEIGHT, 64,
  782. X                             SERVER_IMAGE_BITS, mask_bits,
  783. X                              NULL);
  784. X    disable_logging(contool_base);
  785. X
  786. X    XGetWindowAttributes(xv_get(contool_base->base, XV_DISPLAY), xv_get(xv_get(contool_base->base, XV_ROOT), XV_XID), &attr);
  787. X    masking_works = (attr.depth > 1);
  788. X
  789. X    hints.res_class = "Contool";
  790. X    hints.res_name = (p = rindex(program, '/'))? p + 1 : program;
  791. X    XSetClassHint(xv_get(contool_base->base, XV_DISPLAY), xv_get(contool_base->base, XV_XID), &hints);
  792. X
  793. X    parse_options(&argc, argv);
  794. X
  795. X    i = fcntl(fileno(master), F_GETFL, 0);
  796. X    i |= FNDELAY;
  797. X    if (fcntl(fileno(master), F_SETFL, i) == -1)
  798. X       abend("%s: could not force %s to non-blocking i/o", program);
  799. X
  800. X    load_filters();
  801. X    update_icons();
  802. X    if (!no_console)
  803. X       acquire_console();
  804. X    if (fork_into_background)
  805. X       if (fork() != 0)
  806. X          exit(0);
  807. X
  808. X    notify_set_input_func(contool_base->base, input_func, fileno(master));
  809. X    notify_interpose_destroy_func(contool_base->base, destroy_proc);
  810. X    notify_interpose_event_func(contool_base->base, close_proc, NOTIFY_SAFE);
  811. X    notify_set_signal_func(contool_base->base, signal_proc, SIGUSR1, NOTIFY_SYNC);
  812. X    notify_set_signal_func(contool_base->base, signal_proc, SIGHUP, NOTIFY_SYNC);
  813. X
  814. X    xv_main_loop(contool_base->base);
  815. X    exit(0);
  816. X}
  817. END_OF_FILE
  818. if test 23861 -ne `wc -c <'contool.c'`; then
  819.     echo shar: \"'contool.c'\" unpacked with wrong size!
  820. fi
  821. # end of 'contool.c'
  822. fi
  823. if test -f 'contool.info' -a "${1}" != "-c" ; then 
  824.   echo shar: Will not clobber existing file \"'contool.info'\"
  825. else
  826. echo shar: Extracting \"'contool.info'\" \(28621 characters\)
  827. sed "s/^X//" >'contool.info' <<'END_OF_FILE'
  828. X# 
  829. X# contool.info - User interface object help text.
  830. X# This file was generated by `gxv' from `contool.G'.
  831. X# DO NOT EDIT BY HAND.
  832. X# 
  833. X:contool_controls
  834. XThe contool control panel has buttons which let you load and store configuration data, adjust contool's configuration, and create and modify message filters.  Point at the desired button and press the Help key for more information about that set of functions.
  835. X# 
  836. X:file
  837. XThe File button provides various file-related services to contool users.  The associated menu has five entries.
  838. X
  839. X"Load Configuration" brings up the Load Configuration dialog.
  840. X
  841. X"Store Configuration" brings up the Store Configuration dialog.
  842. X
  843. X"Start Logging" starts logging messages to the log file specified in the Properties dialog.  If logging is already in effect, this menu item is disabled.
  844. X
  845. X"Stop Logging" stops logging.  If logging is not in effect, this menu item is disabled.
  846. X
  847. X"Print" prints the contents of the console use the print filter specified in the Properties dialog. 
  848. X
  849. X"About Contool" displays a brief history of contool, and allows users to send e-mail to contool's developer.
  850. X
  851. XThe default action is "Load Configuration".
  852. X# 
  853. X:view
  854. XThe View button provides three contool support functions:
  855. X
  856. X"Become Console" ensures that contool has the system console attribute.  Only one process under SunOS can own the console.  If some other process acquires this attribute, messages will no longer be routed to contool.  This selection will give the console attribute back to contool.
  857. X
  858. X"Clear Messages" clears the current console messages from the scrolling display.
  859. X
  860. X"Reset Filter" causes contool to stop processing a multi-line filter.  If the user has incorrectly specified the end pattern of a multi-line filter, contool may never stop processing that filter, preventing subsequent messages from being displayed.  This sleection cancels any multi-line fiter in effect.  If a multi-line filter is being processed, its starting pattern will be displayed in the left footer of the contool window.
  861. X
  862. XThe default selection is "Become Console".
  863. X# 
  864. X:edit
  865. XThe Edit button lets the user edit either the contool properties or the current filter set.
  866. X
  867. XThe "Filters" selection brings up the Filters dialog.
  868. X
  869. XThe "Properties" selection brings up the Properties dialog.
  870. X
  871. XThe default selection is "Filters".
  872. X# 
  873. X:display
  874. XThe contool console display contains the text of those messages which contool has been configured to display.  Some messages may be timestamped.  Which messages make it into the console is controlled by the Filters dialog; how many messages are retained is determined by the Properties dialog.
  875. X# 
  876. X:prop_controls
  877. XThe Properties dialog box lets you modify various default attributes of contool.  These attributes include how to handle messages which do not match any filter, message logging and printing, and icon images.
  878. X# 
  879. X:default_action
  880. XThe Default action setting determines what action contool will take when a message arrives that does not match any filter.
  881. X
  882. XIf "Beep" is selected, the machine bell will be rung the indicated number of times.
  883. X
  884. XIf "Command" is selected, the indicated command will be executed.  The contents of the message are written to the command's standard input.
  885. X
  886. XIf "Flash icon" is selected, contool's icon will flash, alternating between the "Check console" and "Flash" images specified in the contool Properties dialog box.
  887. X
  888. XIf "Log message" is selected, contool will write the message to the log file, provided that logging is enabled and occurs after filtering.
  889. X
  890. XIf "Open window" is selected, contool will open to a window (if iconic) and move in front of any obscuring windows.
  891. X
  892. XIf "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.
  893. X
  894. X# 
  895. X:default_beep_count
  896. XThis numeric text field determines the number of times the terminal bell will be rung when a message arrives that does not match any filter.
  897. X
  898. XThis item is only enabled if "Beep" is enabled in the "Default action" setting.
  899. X# 
  900. X:default_beep_times
  901. XThis numeric text field determines the number of times the terminal bell will be rung when a message arrives that does not match any filter.
  902. X
  903. XThis item is only enabled if "Beep" is enabled in the "Default action" setting.
  904. X# 
  905. X:default_command
  906. XThis text field determines the command that will be exedcuted when a message arrives that does not match any filter.  The contents of the message are written to standard input of the executing command.
  907. X
  908. XThis item is only enabled if "Command" is enabled in the "Default action" setting.
  909. X# 
  910. X:log_file
  911. XThe Log file text field contains the path of the file to which messages are written if logging is enabled.
  912. X
  913. XMessages are always appended to the file, preserving any previous contents.
  914. X
  915. XTyping a space in this field will cause file name completion to occur, expanding the current pathname to match, as much as possible, any existing files with the same name.
  916. X# 
  917. X:log_style
  918. XThe Log messages setting determines whether messages will be written to the log before or after filtering.
  919. X
  920. XIf "Before filtering" is selected, everything received by contool is written to the log.
  921. X
  922. XIf "After filtering" is selected, only those messages that do not match any filter, or that match a filter whose match action is to save the message, are written to the log.
  923. X# 
  924. X:archive_style
  925. XThe Archive messages setting determines when messages will be moved from the main contool display window into the message archive.
  926. X
  927. XIf "Manually" is selected, messages will only be moved to the archive when the user explicitly selects "Archive Messages" from the View menu in the main contool window.
  928. X
  929. XIf "When closing contool" is selected, messages will be moved to the archive whenever the user closes the main contool window.  This makes it easier to determine which messages in the main contool window are current, since all previously viewed messages were copied to the archive the last time contool was closed.
  930. X
  931. XEven if you select "When closing contool" for this setting, you can always explicitly move the messages to the archive by selecting "Archive Messages" from the View menu in the main contool window.
  932. X
  933. XArchived messages can be viewed by selecting "Archive..." from the View menu in the main contool window.
  934. X# 
  935. X:print_filter
  936. XThe Print filter text field specifies the command which will be used to print the console when "Print" is selected from the contool "File" menu.
  937. X
  938. XThis command should route its standard input to a printer.
  939. X# 
  940. X:good_icon
  941. XThe "All is well" icon text field should contain the path of a file containing the image to be used by contool when it is not flashing its icon.  The image should have been produced using iconedit(1).
  942. X
  943. XIf this field is blank, the default icon is used.
  944. X# 
  945. X:bad_icon
  946. XThe "Check console" icon text field should contain the path of a file containing the image to be used by contool when it is flashing its icon.  The image should have been produced using iconedit(1).  The image will be alternated with the "Flash" image to produce a blinking effect.
  947. X
  948. XIf this field is blank, the default icon is used.
  949. X# 
  950. X:flash_icon
  951. XThe "Flash" icon text field should contain the path of a file containing the image to be used by contool when it is flashing its icon.  The image should have been produced using iconedit(1).  The image will be alternated with the "Check console" image to produce a blinking effect.
  952. X
  953. XIf this field is blank, the default icon is used.
  954. X# 
  955. X:stamp_resolution
  956. XThe Timestamp resolution numeric text item specifies the number of seconds that must elapse before contool will write a new timestamp to the console.  Even if a filter requires that a timestamp be written, the stamp will only be inserted if the specified time has transpired.  This keeps the console from becoming clogged with a large number of similar timestamps.
  957. X# 
  958. X:message2
  959. XThe Timestamp resolution numeric text item specifies the number of seconds that must elapse before contool will write a new timestamp to the console.  Even if a filter requires that a timestamp be written, the stamp will only be inserted if the specified time has transpired.  This keeps the console from becoming clogged with a large number of similar timestamps.
  960. X# 
  961. X:max_message
  962. XThe Maximum message text numeric field determines the maximum number of characters contool will keep in the console display.  If inserting a new message would exceed this amount, contool will remove text from the beginning fo the display to make room.  The amount of text removed is determined by the "Overflow deletion amount" value.
  963. X# 
  964. X:message3
  965. XThe Maximum message text numeric field determines the maximum number of characters contool will keep in the console display.  If inserting a new message would exceed this amount, contool will remove text from the beginning fo the display to make room.  The amount of text removed is determined by the "Overflow deletion amount" value.
  966. X# 
  967. X:delete_amount
  968. XThe Overflow deletion amount numeric field determines how much text will be removed from the start of the console to make room for a new message whose insertion would cause the console the exceed the "Maximum message text" size.
  969. X
  970. XContool will attempt to remove whole messages from the console in order to retain an orderly appearance.
  971. X# 
  972. X:message4
  973. XThe Overflow deletion amount numeric field determines how much text will be removed from the start of the console to make room for a new message whose insertion would cause the console the exceed the "Maximum message text" size.
  974. X
  975. XContool will attempt to remove whole messages from the console in order to retain an orderly appearance.
  976. X# 
  977. X:props_apply
  978. XThe Apply button causes the values displayed in the Properties dialog to become the current contool properties.  Before Apply is pressed, changes made in this dialog do not affect contool.
  979. X
  980. XEven after pressing Apply, the changes are not written to the contool configuration file.  If you wish your changes to remaina cross invocations of contool, use the "Save Configuration" dialog to write the properties to the configuration file.
  981. X# 
  982. X:props_reset
  983. XThe Reset button restores the values in the Properties dialog to match the current values in use by contool.  Any changes made to these values and not applied to contool are discarded.
  984. X# 
  985. X:filter_controls
  986. XThis is the contool filter editing dialog.  You use this dialog to add, delete, and modify console message filters.
  987. X# 
  988. X:filter_list
  989. XThis scrolling list displays the current contool filter set.  Each line corresponds to one filter.
  990. X
  991. XThe starting pattern for each filter is shown in the list, preceded by a small glyph which indicates whether the filter is a single-line or multi-line filter.
  992. X
  993. XTo see the other attributes of a single filter, select that filter with the mouse.  The attributes will be displayed in the Filter dialog box.
  994. X
  995. XIf you select more than one filter, the remainder of the dialog box will be grayed out.  The dialog box is also disabled if no filter is selected.
  996. X# 
  997. X:filter_insert
  998. XThe Insert button inserts a new, blank filter into the filter list.  The menu associated with the button allows you to specify where the new filter will be inserted.
  999. X
  1000. XThe insert positions are at the top of the list, the bottom of the list, and before or after the current selection.  These last choices are only enabled if exactly one filter in the list is selected.  The default position is at the bottom of the list.
  1001. X
  1002. XAfter inserting the new filter, any other selected filters are deselected, and the new filter is selected.  You can then define the attributes of this new filter, and update the filter using the Update button.
  1003. X# 
  1004. X:filter_edit
  1005. XThe Edit button lets you modify the current filter list.  The menu associated with this button provides Cut, Copy, Paste, and Delete operations.
  1006. X
  1007. XThe Cut operation removes the selected filters from the list and places them on the clipboard.  You can place these filters back into the list using the Paste operation.
  1008. X
  1009. XThe Copy operation places a copy of the selected filters onto the clipboard.  The Paste operation will paste the copied filters into the list.
  1010. X
  1011. XThe Paste operation pastes filters on the clipboard into the filter list.  The Paste submenu provides four posting positions: at the top of the list, the bottom of the list, and before or after the current selection.  The last two choices are only enabled if exactly one filter in the list is selected.  The default position is at the bottom of the list.
  1012. X
  1013. XThe Delete operation removes the selected filters from the list.  The filters are not placed on the clipboard.  Once deleted, filters cannot be recovered with the Paste operation.
  1014. X
  1015. XThe Cut, Copy, and Delete operations are only enabled when one or more filters in the list are selected.  The Paste operation is only enabled after a Cut or Copy operation has placed filters on the clipboard.
  1016. X
  1017. XThe default edit operation is Cut.
  1018. X# 
  1019. X:filter_update
  1020. XThe Update button applies the current filter attributes displayed in the Filters dialog box to the currently selected filter.  The only way to modify a filter is to select it, change its attributes, and click the Update button.
  1021. X
  1022. XThe Update button is only enabled when exactly one filter in the list is selected.
  1023. X
  1024. XYou must use Update to make changes to a filter take effect.  Clciking the Apply button does not perform an Update function on the current filter.
  1025. X# 
  1026. X:filter_type
  1027. XThe Type setting determines whether the currently selected filter will match one or several lines of text written to the console.
  1028. X
  1029. XIf "Single line filter" is selected, the "Pattern" text field is enabled, and must contain a regular expression describing the line of text to be matched by this filter.
  1030. X
  1031. XIf "Multi-line filter" is selected, both "Pattern" and "End pattern" are enabled.  The "Pattern" field should contain a pattern which will match the first line of a multi-line filter.  The "End pattern" must match the last line of the multi-line filter.  All text between the first and last lines is considered part of the filtered text.
  1032. X# 
  1033. X:start
  1034. XThe Pattern text field contains a regular expression (see ed(1), for more on regular expressions) which will match the first line of a message written to the console.  For single line filters, this is the only line matched by the filter.  For multi-line filters, lines of text beginning with the first line and continuing until a line matches the "End pattern" are considered part of the filtered text.
  1035. X# 
  1036. X:stop
  1037. XThe 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.
  1038. X# 
  1039. X:filter_timeout
  1040. XThis 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.
  1041. X
  1042. XA timeout value of zero indicates that no timeout will be in effect.
  1043. X
  1044. XThis item is only enabled if "Type" is set to "Multi-line filter".
  1045. X# 
  1046. X:filter_timeout_units
  1047. XThis 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.
  1048. X
  1049. XA timeout value of zero indicates that no timeout will be in effect.
  1050. X
  1051. XThis item is only enabled if "Type" is set to "Multi-line filter".
  1052. X# 
  1053. X:comment
  1054. XThe 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.
  1055. X
  1056. XThis field is optional, and can be left empty.  Let your conscience be your guide...
  1057. X# 
  1058. X:ignore
  1059. XThe When matched selection determines what contool does with a message once it has matched a filter.
  1060. X
  1061. XIf "Save message" is selected, the actions selected in the "When saved" setting are performed, and the message text is written to the  console.
  1062. X
  1063. XIf "Ignore message" is selected, "When saved" is disabled and the message text is discarded.
  1064. X# 
  1065. X:action
  1066. XThe When saved setting determines what action contool will take when a particular filter matches a console message.
  1067. X
  1068. XIf "Beep" is selected, the machine bell will be rung the indicated number of times.
  1069. X
  1070. XIf "Command" is selected, the indicated command will be executed.  The contents of the message are written to the command's standard input.
  1071. X
  1072. XIf "Flash icon" is selected, contool's icon will flash, alternating between the "Check console" and "Flash" images specified in the contool Properties dialog box.
  1073. X
  1074. XIf "Log message" is selected, contool will write the message to the log file, provided that logging is enabled and occurs after filtering.
  1075. X
  1076. XIf "Open window" is selected, contool will open to a window (if iconic) and move in front of any obscuring windows.
  1077. X
  1078. XIf "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.
  1079. X
  1080. XWhen a new filter is created, the save actions are set to match the default message actions defined in the Properties dialog box.
  1081. X# 
  1082. X:filter_beep_count
  1083. XThis numeric text field determines the number of times the terminal bell will be rung when a message arrives matching the current filter.
  1084. X
  1085. XThis item is only enabled if "When matched" is set to "Save message" and "Beep" is enabled in the "When saved" setting.
  1086. X# 
  1087. X:filter_beep_times
  1088. XThis numeric text field determines the number of times the terminal bell will be rung when a message arrives matching the current filter.
  1089. X
  1090. XThis item is only enabled if "When matched" is set to "Save message" and "Beep" is enabled in the "When saved" setting.
  1091. X# 
  1092. X:filter_command
  1093. XThis text field determines the command that will be exedcuted when a message arrives matching the current filter.  The contents of the message are written to standard input of the executing command.
  1094. X
  1095. XThis item is only enabled if "When matched" is set to "Save message" and "Command" is enabled in the "When saved" setting.
  1096. X# 
  1097. X:filters_apply
  1098. XThe 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.
  1099. X
  1100. XEven 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.
  1101. X# 
  1102. X:filters_apply_and_save
  1103. XThe 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.
  1104. X
  1105. XBefore this button is pressed, any additions, deletions, or changes made to the filters remain local to the Filters dialog box.
  1106. X
  1107. X# 
  1108. X:filters_reset
  1109. XThe 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.
  1110. X
  1111. XChanges made to the filters are local to the Filters dialog box.  You can discard your work and start fresh with the existing filter set by pressing the Reset button.
  1112. X# 
  1113. X:load_controls
  1114. XThe Load Configuration dialog lets the user load tool properties and/or filter definitions from a configuration file.
  1115. X# 
  1116. X:load_type
  1117. XThe Load selection lets the user choose which items are to be loaded from the configuration file.
  1118. X
  1119. XIf "Tool properties" is selected, contool properties will be loaded from the file.
  1120. X
  1121. XIf "Filter definitions" is selected, new filters will be loaded from the file, replacing any existing filters.
  1122. X# 
  1123. X:load_file
  1124. XThe Configuration file text field must contain the name of the desired configuration file.
  1125. X
  1126. XTyping a space in this field will cause file name completion to occur, expanding the current pathname to match, as much as possible, any existing files with the same name.
  1127. X# 
  1128. X:accept_load
  1129. XThe Load button causes the selected items to be read from the configuration file.  Existing properties and/or filters are replaced by those read from the file.
  1130. X# 
  1131. X:store_controls
  1132. XThe Store Configuration dialog lets the user store tool properties and/or filter definitions in a configuration file.
  1133. X# 
  1134. X:store_type
  1135. XThe Store selection lets the user choose which items are to be stored in the configuration file.
  1136. X
  1137. XIf "Tool properties" is selected, contool properties will be written to the file.
  1138. X
  1139. XIf "Filter definitions" is selected, new filters will be written to the file.
  1140. X# 
  1141. X:store_file
  1142. XThe Configuration file text field must contain the name of the desired configuration file.
  1143. X
  1144. XTyping a space in this field will cause file name completion to occur, expanding the current pathname to match, as much as possible, any existing files with the same name.
  1145. X# 
  1146. X:accept_store
  1147. XThe Store button writes the desired items to the configuration file.  The entire file is overwritten with the data.  Thus, a file containing properties and filters will be completely rewritten, even if you only write the filters to it.
  1148. X# 
  1149. X:about_controls
  1150. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1151. X# 
  1152. X:message1
  1153. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1154. X# 
  1155. X:message5
  1156. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1157. X# 
  1158. X:message6
  1159. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1160. X# 
  1161. X:message7
  1162. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1163. X# 
  1164. X:message8
  1165. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1166. X# 
  1167. X:message9
  1168. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1169. X# 
  1170. X:message10
  1171. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1172. X# 
  1173. X:message11
  1174. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1175. X# 
  1176. X:message12
  1177. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1178. X# 
  1179. X:message13
  1180. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1181. X# 
  1182. X:message14
  1183. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1184. X# 
  1185. X:message16
  1186. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1187. X# 
  1188. X:message17
  1189. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1190. X# 
  1191. X:message18
  1192. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1193. X# 
  1194. X:message19
  1195. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1196. X# 
  1197. X:message20
  1198. XThis window gives you some details about the development of contool, encourages you to correspond with the developer to improve future versions of contool, and delineates the restrictions placed on the contool source code.
  1199. X# 
  1200. X:send_mail
  1201. XClicking this button will open another window in which you can compose and send mail to the developer of contool.
  1202. X# 
  1203. X:mail_controls
  1204. XThis 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.
  1205. X# 
  1206. X:message21
  1207. XThis 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.
  1208. X# 
  1209. X:message22
  1210. XThis 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.
  1211. X# 
  1212. X:address
  1213. XThis 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.
  1214. X
  1215. XIf you select the third item, a text field will appear, allowing you to enter an appropriate e-mail address.
  1216. X# 
  1217. X:fixed_address
  1218. XThis 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.
  1219. X
  1220. XIf you select the third item, a text field will appear, allowing you to enter an appropriate e-mail address.
  1221. X# 
  1222. X:other_address
  1223. XThis 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.
  1224. X# 
  1225. X:message
  1226. XUse this window to type text that will be mailed to the contool developer.
  1227. X# 
  1228. X:mail_controls1
  1229. XThis 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.
  1230. X# 
  1231. X:accept_send
  1232. XClicking this button will send your mail message to contool's developer.
  1233. X# 
  1234. X:archive_controls
  1235. XThe archive control panel has buttons which let you clear and print the messagea archive.  Messages are moved from the main contool window to the archive either at the user's discretion by selecting "Archive Messages" from the View menu in the main contool window, or automatically whenever the contool window is closed.  The "Archive messages" setting in the contool properties dialog controls message archiving.
  1236. X# 
  1237. X:clear
  1238. XThe Clear button removes any messages stored in the archive.  Once removed, the messages cannot be recovered.
  1239. X# 
  1240. X:print
  1241. XThe Print button prints the messages in the archive, using the print filter specified in the contool properties dialog.
  1242. X# 
  1243. X:archive
  1244. XThe archive display contains all the messages that have been moved from the main contool window to the message archive.  Messages are moved from the main contool window to the archive either at the user's discretion by selecting "Archive Messages" from the View menu in the main contool window, or automatically whenever the contool window is closed.  The "Archive messages" setting in the contool properties dialog controls message archiving.
  1245. END_OF_FILE
  1246. if test 28621 -ne `wc -c <'contool.info'`; then
  1247.     echo shar: \"'contool.info'\" unpacked with wrong size!
  1248. fi
  1249. # end of 'contool.info'
  1250. fi
  1251. echo shar: End of archive 2 \(of 5\).
  1252. cp /dev/null ark2isdone
  1253. MISSING=""
  1254. for I in 1 2 3 4 5 ; do
  1255.     if test ! -f ark${I}isdone ; then
  1256.     MISSING="${MISSING} ${I}"
  1257.     fi
  1258. done
  1259. if test "${MISSING}" = "" ; then
  1260.     echo You have unpacked all 5 archives.
  1261.     rm -f ark[1-9]isdone
  1262. else
  1263.     echo You still need to unpack the following archives:
  1264.     echo "        " ${MISSING}
  1265. fi
  1266. ##  End of shell archive.
  1267. exit 0
  1268. -- 
  1269. --
  1270. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1271. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1272. Sunnyvale, California 94086            at&t: 408/522-9236
  1273.