contool port (from FreeBSD)

This commit is contained in:
ian 1998-09-24 00:58:57 +00:00
parent 509a0fdd11
commit 1fb3996c88
12 changed files with 304 additions and 0 deletions

24
sysutils/contool/Makefile Normal file
View File

@ -0,0 +1,24 @@
# $Id: Makefile,v 1.1.1.1 1998/09/24 00:58:57 ian Exp $
# $OpenBSD: Makefile,v 1.1.1.1 1998/09/24 00:58:57 ian Exp $
#
DISTNAME= contool-3.3a
CATEGORIES= sysutils
MASTER_SITES= ftp://ftp.kfu.com/pub/
#MAINTAINER= nsayer@quack.kfu.com
MAINTAINER= ian@openbsd.org
LIB_DEPENDS= xview\\.3\\.:${PORTSDIR}/x11/xview-lib
NO_CDROM= "source code cannot be sold, nor can you incorporate the source code into a product which is subsequently sold"
NO_WRKSUBDIR= yes
USE_IMAKE= yes
pre-install:
@${MKDIR} ${PREFIX}/lib/help
post-install:
@${CAT} ${PKGDIR}/MESSAGE
.include <bsd.port.mk>

View File

@ -0,0 +1 @@
MD5 (contool-3.3a.tar.gz) = 678863da68be6a1370f204c071426351

View File

@ -0,0 +1,20 @@
--- Imakefile.orig Thu Feb 24 09:55:24 1994
+++ Imakefile Sun Jan 5 13:58:56 1997
@@ -1,14 +1,14 @@
# Mailer you use. Solaris 2.x users, change this to /usr/bin/mailx
-MAILER = /usr/ucb/mail
+MAILER = /usr/bin/mail
# Where you installed Open Windows
-OPENWINHOME = /usr/openwin
+OPENWINHOME = ${PREFIX}
# Paths to be searched for icons
ICON_PATH = .:./icons:/usr/local/images:$(OPENWINHOME)/include/images:$(INCDIR)/bitmaps
# Where to install the help file
-HELPDIR = /usr/local/lib/help
+HELPDIR = $(OPENWINHOME)/lib/help
# Where your XView libraries are installed. If running under
# SunOS 4.x, use the first version. If using Solaris 2.x with

View File

@ -0,0 +1,28 @@
--- contool.c.orig Thu Feb 24 09:55:30 1994
+++ contool.c Sun Jan 5 13:48:41 1997
@@ -284,6 +284,9 @@
EXPORT acquire_console()
{ int console;
+#if (defined(BSD) && (BSD >= 199306))
+ int i;
+#endif
#ifdef SVR4
if (slave > 0) {
@@ -293,8 +296,15 @@
abend("%s: could not attach to /dev/console: %s", program, sys_errlist[errno]);
}
#else
+#if (defined(BSD) && (BSD >= 199306))
+ i=1;
+#endif
if (slave > 0)
+#if (defined(BSD) && (BSD >= 199306))
+ if (ioctl(slave, TIOCCONS, &i) == -1)
+#else
if (ioctl(slave, TIOCCONS, NULL) == -1)
+#endif
abend("%s: could not attach to /dev/console: %s", program, sys_errlist[errno]);
#endif
}

View File

@ -0,0 +1,20 @@
--- manifest.h.orig Thu Feb 24 09:55:52 1994
+++ manifest.h Sun Jan 5 13:52:40 1997
@@ -23,6 +23,9 @@
/* */
/************************************************************************/
+/* for BSD definition */
+#include <sys/param.h>
+
#define TRUE 1
#define FALSE 0
@@ -38,5 +41,7 @@
#define cond_free(x) {if (x) free(x);}
PUBLIC int errno;
+#if !(defined(BSD) && (BSD >= 199103))
PUBLIC char *sys_errlist[];
+#endif

View File

@ -0,0 +1,10 @@
--- expand.c.orig Thu Feb 24 09:55:35 1994
+++ expand.c Sun Jan 5 12:25:09 1997
@@ -17,6 +17,7 @@
/* without prior permission from Harris Corporation. */
/************************************************************************/
+#include <sys/types.h>
#include <dirent.h>
#include <pwd.h>
#include <stdlib.h>

View File

@ -0,0 +1,35 @@
--- filters.c.orig Thu Feb 24 09:55:37 1994
+++ filters.c Sun Jan 5 13:51:25 1997
@@ -25,12 +25,17 @@
#include <stdio.h>
#include <string.h>
+#include <sys/param.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/notice.h>
#include <xview/xv_xrect.h>
+#if (defined(BSD) && (BSD >= 199306))
+#include <regex.h>
+#endif
+
#include "manifest.h"
#include "contool.h"
#include "contool_ui.h"
@@ -122,8 +127,14 @@
{
cond_free(f->start);
+#if (defined(BSD) && (BSD >= 199306))
+ regfree(f->start_re);
+#endif
cond_free(f->start_re);
cond_free(f->stop);
+#if (defined(BSD) && (BSD >= 199306))
+ regfree(f->stop_re);
+#endif
cond_free(f->stop_re);
cond_free(f->command);
cond_free(f->comment);

View File

@ -0,0 +1,122 @@
--- regexp.c.orig Thu Feb 24 09:55:47 1994
+++ regexp.c Sun Jan 5 12:25:10 1997
@@ -17,22 +17,14 @@
/* without prior permission from Harris Corporation. */
/************************************************************************/
+#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include "manifest.h"
#include "contool.h"
-PRIVATE regexp_error();
-
-#define INIT register char *expbuf = ep, *sp = instring;
-#define GETC() (*sp++)
-#define PEEKC() (*sp)
-#define UNGETC(c) (--sp)
-#define RETURN(p) {memcpy(sp = (char *) malloc(p - expbuf), expbuf, p - expbuf); return(sp);}
-#define ERROR(val) {regexp_error(val, instring); return(NULL);}
-
-#include <regexp.h>
+#include <regex.h>
PRIVATE char error_message[512];
@@ -49,37 +41,10 @@
p = str + strlen(str) - 1;
if (p >= str && *p == '\n')
*p = '\0';
- circf = circ;
- result = step(str, exp);
+ result = regexec((regex_t*)exp, str, 0, NULL, 0);
if (p >= str && *p == '\0')
*p = '\n';
- return(result);
-}
-
-/************************************************************************/
-PRIVATE regexp_error(val, string)
-
-int val;
-char *string;
-
-{ char *msg;
-
- switch (val) {
- case 11 : msg = "range endpoint too large";
- case 16 : msg = "bad number";
- case 25 : msg = "\"\\digit\" out of range";
- case 36 : msg = "illegal or missing delimiter";
- case 41 : msg = "no remembered search string";
- case 42 : msg = "\\(\\) imbalance";
- case 43 : msg = "too many \\(";
- case 44 : msg = "more than 2 numbers given in \\{\\}";
- case 45 : msg = "} expected after \\";
- case 46 : msg = "first number exceeds second in \\{\\}";
- case 49 : msg = "[] imbalance";
- case 50 : msg = "regular expression overflow";
- default : msg = "regular expression error";
- }
- sprintf(error_message, "%s in %s", msg, string);
+ return(!result);
}
/************************************************************************/
@@ -109,34 +74,40 @@
char *start;
char *stop;
-{ char rbuf[1024], *sre, *ere;
- int sc, ec;
+{
- sre = ere = NULL;
+ int errcod;
+ regex_t *sre, *ere;
+
+ sre = (regex_t*) malloc(sizeof(regex_t));
+ ere = (regex_t*) malloc(sizeof(regex_t));
if (start) {
- if ((sre = compile(fix_control_chars(start), rbuf, rbuf+1024, '\0')) == NULL)
+ if (errcod = regcomp(sre, fix_control_chars(start), REG_NOSUB)) {
+ regerror(errcod, sre, error_message, 512);
+ strcat(error_message, " in ");
+ strcat(error_message,fix_control_chars(start));
return(error_message);
- sc = circf;
+ }
}
if (stop) {
- if ((ere = compile(fix_control_chars(stop), rbuf, rbuf+1024, '\0')) == NULL) {
- cond_free(sre);
+ if (errcod = regcomp(ere, fix_control_chars(stop), REG_NOSUB)) {
+ regerror(errcod, ere, error_message, 512);
+ strcat(error_message," in ");
+ strcat(error_message,fix_control_chars(stop));
return(error_message);
}
- ec = circf;
}
if (filter) {
filter->start = start;
filter->stop = stop;
- filter->start_re = sre;
- filter->stop_re = ere;
- filter->start_circf = sc;
- filter->stop_circf = ec;
+ filter->start_re = (char *) sre;
+ filter->stop_re = (char *) ere;
}
else {
+ regfree(sre);
+ regfree(ere);
cond_free(sre);
- if (ere)
- cond_free(ere);
+ cond_free(ere);
}
return(NULL);
}

View File

@ -0,0 +1 @@
Console tool for openlook

View File

@ -0,0 +1,13 @@
Contool will capture and display system console messages with timestamps.
It is a replacement for the standard X console. Contool will flash its
icon and beep when messages are written to the icon, so you can keep it
closed on your desktop until a message arrives. You can modify this
beeping and flashing behavior; see the man page for more details.
You can instruct contool to filter and ignore certain common console
messages, or act upon them. The man page explains how to create a file of
filters in ~/.contool; the included sample.filter is how my filters are set
up. You can modify this to suit yourself, and copy it to ~/.contool.
(port maintained by nsayer@quack.kfu.com)

View File

@ -0,0 +1,27 @@
from the About box:
Contool 3.3a
Copyright 1988 - 1994
Chuck Musciano and Harris Corporation
<chuck@trantor.harris-atd.com>
All Rights Reserved
Contool has been released for private, not-for-profit use, and the copyright
on the source code is retained by myself and Harris Corporation, my employer.
This means that you can give the source code to anyone but you cannot sell
any part of the source code, nor can you incorporate any part of the source
code into a product which is subsequently sold.
from the README
---------------
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation, and that the name of Chuck Musciano and Harris Corporation
not be used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission. Chuck Musciano and
Harris Corporation make no representations about the suitability of this
software for any purpose. It is provided "as is" without express or
implied warranty. This software may not be sold without the prior explicit
permission of Harris Corporation.

View File

@ -0,0 +1,3 @@
bin/contool
lib/help/contool.info
man/man1/contool.1.gz