summaryrefslogtreecommitdiff
path: root/zwgc
diff options
context:
space:
mode:
authorGravatar Greg Hudson <ghudson@mit.edu>1997-09-14 18:12:16 +0000
committerGravatar Greg Hudson <ghudson@mit.edu>1997-09-14 18:12:16 +0000
commitce6018836c422c86a729ba39fe5433ec11b87b02 (patch)
treecc2e6601489384fcf41e0565e8906822897b46c8 /zwgc
parentac16f380e349fa39ec7e26bccb5456cb300006a5 (diff)
Pull in sources from zephyr locker. See /mit/zephyr/repository for
detailed change information.
Diffstat (limited to 'zwgc')
-rw-r--r--zwgc/Dictionary/Imakefile32
-rw-r--r--zwgc/Imakefile117
-rw-r--r--zwgc/Makefile.in140
-rw-r--r--zwgc/Memory/Imakefile19
-rw-r--r--zwgc/String/Imakefile22
-rw-r--r--zwgc/String/new_string.c.old197
-rw-r--r--zwgc/X_driver.c36
-rw-r--r--zwgc/X_fonts.c10
-rw-r--r--zwgc/X_gram.c34
-rw-r--r--zwgc/browser.c3
-rw-r--r--zwgc/buffer.c4
-rw-r--r--zwgc/character_class.c4
-rw-r--r--zwgc/dictionary.c (renamed from zwgc/Dictionary/dictionary.c)4
-rw-r--r--zwgc/dictionary.h (renamed from zwgc/Dictionary/dictionary.h)0
-rw-r--r--zwgc/display.c11
-rw-r--r--zwgc/error.c4
-rw-r--r--zwgc/eval.c8
-rw-r--r--zwgc/exec.c9
-rw-r--r--zwgc/file.c7
-rw-r--r--zwgc/formatter.c52
-rwxr-xr-xzwgc/instantiate (renamed from zwgc/generate_instance)17
-rw-r--r--zwgc/lexer.c6
-rw-r--r--zwgc/main.c39
-rw-r--r--zwgc/main.h6
-rw-r--r--zwgc/mux.c12
-rw-r--r--zwgc/new_memory.c (renamed from zwgc/Memory/new_memory.c)18
-rw-r--r--zwgc/new_memory.h (renamed from zwgc/Memory/new_memory.h)0
-rw-r--r--zwgc/new_string.c (renamed from zwgc/String/new_string.c)7
-rw-r--r--zwgc/new_string.h (renamed from zwgc/String/new_string.h)0
-rw-r--r--zwgc/node.c6
-rw-r--r--zwgc/node.h93
-rw-r--r--zwgc/notice.c6
-rw-r--r--zwgc/parser.y8
-rw-r--r--zwgc/port.c47
-rw-r--r--zwgc/regexp.c30
-rw-r--r--zwgc/standard_ports.c22
-rw-r--r--zwgc/string_dictionary_aux.c (renamed from zwgc/Dictionary/string_dictionary_aux.c)1
-rw-r--r--zwgc/string_dictionary_aux.h (renamed from zwgc/Dictionary/string_dictionary_aux.h)0
-rw-r--r--zwgc/subscriptions.c3
-rw-r--r--zwgc/substitute.c1
-rw-r--r--zwgc/text_operations.c4
-rw-r--r--zwgc/tty_filter.c71
-rw-r--r--zwgc/ulong.h24
-rw-r--r--zwgc/unsigned_long.h5
-rw-r--r--zwgc/variables.c6
-rw-r--r--zwgc/xcut.c11
-rw-r--r--zwgc/xerror.c10
-rw-r--r--zwgc/xerror.h2
-rw-r--r--zwgc/xmark.c8
-rw-r--r--zwgc/xrevstack.c12
-rw-r--r--zwgc/xselect.c10
-rw-r--r--zwgc/xshow.c10
-rw-r--r--zwgc/zephyr.c60
-rw-r--r--zwgc/zephyr.vars.in (renamed from zwgc/zephyr.vars)2
-rw-r--r--zwgc/zwgc.131
-rw-r--r--zwgc/zwgc.desc18
56 files changed, 565 insertions, 754 deletions
diff --git a/zwgc/Dictionary/Imakefile b/zwgc/Dictionary/Imakefile
deleted file mode 100644
index 2bae6c7..0000000
--- a/zwgc/Dictionary/Imakefile
+++ /dev/null
@@ -1,32 +0,0 @@
-/**/# Copyright 1988, 1993 Massachusetts Institute of Technology.
-/**/#
-/**/# For copying and distribution information, see the file
-/**/# "mit-copyright.h".
-/**/#
-/**/# $Id$
-
-OBJS = string_dictionary_aux.o int_dictionary.o string_dictionary.o
-SRCS = string_dictionary_aux.c int_dictionary.c string_dictionary.c
-
-XDEFS = -I../String -I../Memory
-
-all:: string_dictionary.h dictionary_spec $(OBJS)
-depend:: $(SRCS)
-
-/**/# Automatically generate a spec file from the template include file:
-dictionary_spec: dictionary.h
- cat dictionary.h | grep "^.\*" | grep -v "^ \*/" | sed 's/.\*//' > dictionary_spec
-
-/**/# Generate a int dictionary instance:
-int_dictionary.c int_dictionary.h: dictionary.c dictionary.h
- ../generate_instance . dictionary int
-
-/**/# Generate a string dictionary instance:
-string_dictionary.c string_dictionary.h: dictionary.c dictionary.h
- ../generate_instance . dictionary string new_string.h
-
-clean::
- $(RM) $(OBJS) dictionary_spec int_dictionary.c string_dictionary.c \
- int_dictionary.h string_dictionary.h
-
-string_dictionary_aux.o: string_dictionary.h
diff --git a/zwgc/Imakefile b/zwgc/Imakefile
deleted file mode 100644
index 21dca3a..0000000
--- a/zwgc/Imakefile
+++ /dev/null
@@ -1,117 +0,0 @@
-/**/# Copyright 1988, 1993 Massachusetts Institute of Technology.
-/**/#
-/**/# For copying and distribution information, see the file
-/**/# "mit-copyright.h".
-/**/#
-/**/# $Id$
-
-#ifdef _AIX
-TERMCAP = -lcurses
-#else
-TERMCAP = -ltermcap
-#endif
-
-#ifdef macII
-OSLIBS = -lc -lPW
-#endif
-#ifdef SOLARIS
-OSLIBS = -lgen
-#endif
-
-#ifdef __NetBSD__
-OSDEFS=-DPOSIX_REGEXP
-#endif
-
-LIBS = $(ZLIB) $(LIB_X) $(TERMCAP) $(OSLIBS) $(OSLIBS)
-
-SRCS = port_dictionary.c pointer_dictionary.c ulong_dictionary.c \
- parser.y lexer.c node.c exec.c buffer.c main.c zephyr.c X_driver.c\
- substitute.c port.c xshow.c \
- mux.c eval.c subscriptions.c notice.c xcut.c regexp.c\
- character_class.c text_operations.c file.c error.c variables.c\
- formatter.c X_fonts.c X_gram.c tty_filter.c standard_ports.c\
- xselect.c xmark.c xrevstack.c xerror.c
-
-OBJS = parser.o lexer.o node.o exec.o buffer.o main.o zephyr.o X_driver.o\
- substitute.o port_dictionary.o port.o xshow.o pointer_dictionary.o\
- mux.o eval.o subscriptions.o notice.o xcut.o regexp.o\
- character_class.o text_operations.o file.o error.o variables.o\
- formatter.o X_fonts.o X_gram.o tty_filter.o standard_ports.o\
- xselect.o xmark.o xrevstack.o xerror.o ulong_dictionary.o \
- $(LIBRARIES)
-
-LIBRARIES = ./String/new_string.o\
- ./Dictionary/string_dictionary.o\
- ./Dictionary/string_dictionary_aux.o\
- ./Dictionary/int_dictionary.o\
- ./Memory/new_memory.o
-
-GENSRCS= port_dictionary.c pointer_dictionary.c ulong_dictionary.c
-
-GENERATED= $(GENSRCS) \
- port_dictionary.h pointer_dictionary.h ulong_dictionary.h \
- char_stack.h string_stack.h xmode_stack.h \
- y.tab.h
-
-XDEFS = -I./Memory -I./String -I./Dictionary -DREVSTACK \
- -DDEFDESC=\"$(ZLIBDIR)/zwgc.desc\" \
- -DAPPDEFDATABASE=\"$(ZLIBDIR)/zwgc_resources\" \
- -DZWGCPATH=\"$(ATHBINDIR)/zwgc\" \
- -DSGI_DESKS $(OSDEFS)
-
-SUBDIRS = Memory String Dictionary
-
-do_subdirs_imakefile($(SUBDIRS))
-foreach_subdirs(clean,$(SUBDIRS))
-foreach_subdirs(all,$(SUBDIRS))
-foreach_subdirs(depend,$(SUBDIRS))
-
-zprogram(zwgc,$(LIBS))
-install_man(zwgc.1,zwgc.1)
-
-install_file(zwgc.desc,$(ZLIBDIR))
-install_file(zwgc_resources,$(ZLIBDIR))
-install_file(zephyr.vars,$(ATHCONFDIR))
-
-YFLAGS=-d
-
-/**/# use implicit yacc rule for the following:
-parser.o: parser.y
-y.tab.h: parser.o
-
-/**/# How to generate a port dictionary:
-port_dictionary.c port_dictionary.h: Dictionary/dictionary.c Dictionary/dictionary.h
- ./generate_instance ./Dictionary dictionary port port.h
-
-/**/# How to generate a pointer dictionary:
-pointer_dictionary.c pointer_dictionary.h: Dictionary/dictionary.c Dictionary/dictionary.h
- ./generate_instance ./Dictionary dictionary pointer pointer.h
-
-/**/# How to generate a ulong dictionary:
-ulong_dictionary.c ulong_dictionary.h: Dictionary/dictionary.c Dictionary/dictionary.h
- ./generate_instance ./Dictionary dictionary ulong ulong.h
-
-/**/# How to generate a char stack:
-char_stack.h: stack.h
- ./generate_instance . stack char
-
-/**/# How to generate a string stack:
-string_stack.h: stack.h
- ./generate_instance . stack string
-
-/**/# How to generate a xmode stack:
-xmode_stack.h: stack.h
- ./generate_instance . stack xmode
-
-clean::
- $(RM) $(GENERATED)
-
-eval.c eval.o: port.h string_stack.h
-exec.c exec.o: port.h string_stack.h
-lexer.c: y.tab.h
-main.c main.o: port.h string_stack.h
-port.c port.o: port_dictionary.h
-standard_ports.c standard_ports.o: port.h string_stack.h
-text_operations.c text_operations.o: char_stack.h
-xshow.c xshow.o: pointer_dictionary.h xmode_stack.h
-X_driver.c X_driver.o: ulong_dictionary.h
diff --git a/zwgc/Makefile.in b/zwgc/Makefile.in
new file mode 100644
index 0000000..a7e55cb
--- /dev/null
+++ b/zwgc/Makefile.in
@@ -0,0 +1,140 @@
+SHELL = /bin/sh
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+datadir=@datadir@
+confdir=@confdir@
+sbindir=@sbindir@
+lsbindir=@lsbindir@
+
+includedir=${prefix}/include
+mandir=${prefix}/man
+libdir=${exec_prefix}/lib
+bindir=${exec_prefix}/bin
+
+srcdir=@srcdir@
+top_srcdir=@top_srcdir@
+BUILDTOP=../..
+VPATH=@srcdir@
+CC=@CC@
+YACC=@YACC@
+INSTALL=@INSTALL@
+INSTANTIATE=${srcdir}/instantiate
+
+DEBUG=-O
+CFLAGS=${DEBUG} -DDATADIR=\"${datadir}\" -I${top_srcdir}/h \
+ -I${BUILDTOP}/h -I${srcdir} -I. @X_CFLAGS@ @CPPFLAGS@
+YFLAGS=-d
+LDFLAGS=${DEBUG} -L${BUILDTOP}/lib/zephyr @ET_LDFLAGS@ @X_LIBS@ @LDFLAGS@
+LIBS=-lzephyr @LIBS@ -lcom_err @X_PRE_LIBS@ @ZWGC_LIBX11@ @X_EXTRA_LIBS@ \
+ @TLIB@ @RLIB@
+
+OBJS= port_dictionary.o pointer_dictionary.o unsigned_long_dictionary.o \
+ string_dictionary.o int_dictionary.o string_dictionary_aux.o \
+ parser.o lexer.o node.o exec.o buffer.o main.o zephyr.o X_driver.o \
+ substitute.o port.o xshow.o mux.o eval.o subscriptions.o notice.o \
+ xcut.o regexp.o character_class.o text_operations.o file.o error.o \
+ variables.o formatter.o X_fonts.o X_gram.o tty_filter.o \
+ standard_ports.o xselect.o xmark.o xrevstack.o xerror.o \
+ new_string.o new_memory.o
+
+all: zwgc
+
+zwgc: ${OBJS} ${BUILDTOP}/lib/zephyr/libzephyr.a @ETDEP@
+ ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}
+
+port_dictionary.c port_dictionary.h: dictionary.c dictionary.h
+ ${INSTANTIATE} ${srcdir} dictionary port port.h
+
+pointer_dictionary.c pointer_dictionary.h: dictionary.c dictionary.h
+ ${INSTANTIATE} ${srcdir} dictionary pointer pointer.h
+
+unsigned_long_dictionary.c unsigned_long_dictionary.h: dictionary.c \
+ dictionary.h
+ ${INSTANTIATE} ${srcdir} dictionary unsigned_long unsigned_long.h
+
+string_dictionary.c string_dictionary.h: dictionary.c dictionary.h
+ ${INSTANTIATE} ${srcdir} dictionary string new_string.h
+
+int_dictionary.c int_dictionary.h: dictionary.c dictionary.h
+ ${INSTANTIATE} ${srcdir} dictionary int
+
+char_stack.h: stack.h
+ ${INSTANTIATE} ${srcdir} stack char
+
+string_stack.h: stack.h
+ ${INSTANTIATE} ${srcdir} stack string
+
+xmode_stack.h: stack.h
+ ${INSTANTIATE} ${srcdir} stack xmode
+
+check:
+
+install: zwgc
+ ${INSTALL} -m 755 -s zwgc ${DESTDIR}${bindir}
+ ${INSTALL} -m 644 ${srcdir}/zwgc.1 ${DESTDIR}${mandir}/man1
+ ${INSTALL} -m 644 ${srcdir}/zwgc.desc ${DESTDIR}${datadir}
+ ${INSTALL} -m 644 ${srcdir}/zwgc_resources ${DESTDIR}${datadir}
+ ${INSTALL} -m 644 zephyr.vars ${DESTDIR}${confdir}
+
+clean:
+ rm -f ${OBJS} zwgc port_dictionary.[ch] pointer_dictionary.[ch]
+ rm -f unsigned_long_dictionary.[ch] string_dictionary.[ch]
+ rm -f int_dictionary.[ch] char_stack.h string_stack.h xmode_stack.h
+
+${OBJS}: ${top_srcdir}/h/sysdep.h ${BUILDTOP}/h/config.h
+zephyr.o: ${BUILDTOP}/h/zephyr/zephyr.h ${BUILDTOP}/h/zephyr/zephyr_err.h
+
+port_dictionary.o: port.h string_stack.h new_string.h new_memory.h
+pointer_dictionary.o: pointer.h new_string.h new_memory.h
+unsigned_long_dictionary.o: new_string.h new_memory.h
+string_dictionary.o: new_string.h new_memory.h
+int_dictionary.o: new_string.h new_memory.h
+X_driver.o: X_driver.h new_memory.h formatter.h mux.h variables.h error.h
+X_driver.o: X_gram.h xselect.h unsigned_long_dictionary.h
+X_fonts.o: X_fonts.h new_memory.h new_string.h error.h pointer_dictionary.h
+X_fonts.o: zwgc.h
+X_gram.o: X_gram.h xmark.h zwgc.h X_driver.h X_fonts.h error.h new_string.h
+X_gram.o: xrevstack.h xerror.h xselect.h
+browser.o: zwgc.h
+buffer.o: new_memory.h buffer.h
+character_class.o: character_class.h
+display.o: new_memory.h new_string.h variables.h display.h
+eval.o: new_memory.h node.h eval.h substitute.h port.h buffer.h regexp.h
+eval.o: text_operations.h zwgc.h variables.h
+exec.o: new_memory.h exec.h eval.h node.h buffer.h port.h variables.h notice.h
+file.o: new_memory.h new_string.h error.h
+formatter.o: new_memory.h char_stack.h string_dictionary.h formatter.h
+formatter.o: text_operations.h
+lexer.o: new_memory.h new_string.h int_dictionary.h lexer.h parser.h y.tab.h
+main.o: new_memory.h zwgc.h parser.h node.h exec.h zephyr.h notice.h
+main.o: subscriptions.h file.h mux.h port.h variables.h main.h
+mux.o: mux.h error.h zwgc.h pointer.h
+new_memory.o: new_memory.h int_dictionary.h
+new_string.o: new_memory.h
+node.o: new_memory.h node.h
+notice.o: new_memory.h error.h variables.h notice.h
+port.o: new_string.h port_dictionary.h port.h notice.h variables.h
+regexp.o: regexp.h
+standard_ports.o: new_memory.h port.h variables.h error.h main.h
+string_dictionary_aux.o: new_memory.h string_dictionary.h
+subscriptions.o: new_memory.h new_string.h int_dictionary.h zwgc.h
+subscriptions.o: subscriptions.h error.h file.h main.h
+substitute.o: new_memory.h lexer.h substitute.h
+text_operations.o: new_memory.h text_operations.h char_stack.h
+tty_filter.o: new_memory.h new_string.h string_dictionary_aux.h formatter.h
+tty_filter.o: zwgc.h error.h
+variables.o: new_memory.h notice.h string_dictionary_aux.h variables.h
+xcut.o: new_memory.h new_string.h X_gram.h zwgc.h xselect.h xmark.h error.h
+xcut.o: xrevstack.h
+xerror.o: mux.h
+xmark.o: X_gram.h X_fonts.h xmark.h new_string.h
+xrevstack.o: X_gram.h zwgc.h
+xselect.o: new_string.h xselect.h
+xshow.o: pointer_dictionary.h new_memory.h formatter.h variables.h zwgc.h
+xshow.o: X_fonts.h X_gram.h xmode_stack.h
+zephyr.o: new_string.h zephyr.h error.h mux.h subscriptions.h variables.h
+zephyr.o: pointer.h X_driver.h
+
+.PHONY: all check install clean
+
diff --git a/zwgc/Memory/Imakefile b/zwgc/Memory/Imakefile
deleted file mode 100644
index 5d01802..0000000
--- a/zwgc/Memory/Imakefile
+++ /dev/null
@@ -1,19 +0,0 @@
-/**/# Copyright 1988, 1993 Massachusetts Institute of Technology.
-/**/#
-/**/# For copying and distribution information, see the file
-/**/# "mit-copyright.h".
-/**/#
-/**/# $Id$
-
-OBJS = new_memory.o
-SRCS = new_memory.c
-
-all:: memory_spec $(OBJS)
-
-/**/# Automatically generate a spec file from the template include file:
-memory_spec: new_memory.h
- cat new_memory.h | grep "^.\*" | grep -v "^ \*/" | sed 's/.\*//' > memory_spec
-
-clean::
- $(RM) $(OBJS) memory_spec
-
diff --git a/zwgc/String/Imakefile b/zwgc/String/Imakefile
deleted file mode 100644
index e47f681..0000000
--- a/zwgc/String/Imakefile
+++ /dev/null
@@ -1,22 +0,0 @@
-/**/# Copyright 1988, 1993 Massachusetts Institute of Technology.
-/**/#
-/**/# For copying and distribution information, see the file
-/**/# "mit-copyright.h".
-/**/#
-/**/# $Id$
-
-
-OBJS = new_string.o
-SRCS = new_string.c
-
-XDEFS= -I../Memory
-
-all:: string_spec $(OBJS)
-
-/**/# Automatically generate a spec file from the template include file:
-string_spec: new_string.h
- cat new_string.h | grep "^.\*" | grep -v "^ \*/" | sed 's/.\*//' > string_spec
-
-clean::
- $(RM) $(OBJS) string_spec
-
diff --git a/zwgc/String/new_string.c.old b/zwgc/String/new_string.c.old
deleted file mode 100644
index 5009b06..0000000
--- a/zwgc/String/new_string.c.old
+++ /dev/null
@@ -1,197 +0,0 @@
-/* This file is part of the Project Athena Zephyr Notification System.
- * It is one of the source files comprising zwgc, the Zephyr WindowGram
- * client.
- *
- * Created by: Marc Horowitz <marc@athena.mit.edu>
- *
- * $Source$
- * $Author$
- *
- * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- * For copying and distribution information, see the file
- * "mit-copyright.h".
- */
-
-#if (!defined(lint) && !defined(SABER))
-static char rcsid_new_string_c[] = "$Id$";
-#endif
-
-/*
- * string - a module providing operations on C strings. (i.e., char *'s)
- *
- * Overview:
- *
- * A string is a standard C string. I.e., a char pointer to a
- * null-terminated sequence of characters. 0 is NOT considered a valid
- * string! Various operations are available. See the string_spec file
- * for details.
- *
- * Note: This module assumes that malloc NEVER returns 0 for reasonable
- * requests. It is the users responsibility to either ensure that
- * this happens or supply a version of malloc with error
- * handling.
- *
- * Some strings are mutable.
- */
-
-#ifdef DEBUG
-#define assert(x) if (!(x)) abort()
-#else
-#define assert(x)
-#endif
-
-#include <ctype.h>
-#include "new_memory.h"
-
-#include <strings.h>
-
-#define string_Length(s) strlen(s)
-typedef char *string;
-
-/*
- * string string_CreateFromData(char *data, int length):
- * Requires: data[0], data[1], ..., data[length-1] != 0
- * Effects: Takes the first length characters at data and
- * creates a string containing them. The returned string
- * is on the heap & must be freed eventually.
- * I.e., if passed "foobar" and 3, it would return
- * string_Copy("foo").
- */
-
-string string__CreateFromData(data, length)
- char *data;
- int length;
-{
- string result;
-
- assert(length>=0);
-
- result = (string)malloc(length+1);
- assert(result);
-
- (void) memcpy(result, data, length);
- result[length] = 0;
-
- return(result);
-}
-
-/*
- * string string_Copy(string s):
- * Effects: Returns a copy of s on the heap. The copy must be
- * freed eventually.
- */
-
-string string__Copy(s)
- string s;
-{
- int length;
- string result;
-
- assert(s);
-
- length = string_Length(s)+1;
- result = (string)malloc(length);
- assert(result);
-
- (void) memcpy(result, s, length);
- return(result);
-}
-
-/*
- * string string_Concat(string a, b):
- * Effects: Returns a string equal to a concatenated to b.
- * The returned string is on the heap and must be
- * freed eventually. I.e., given "abc" and "def",
- * returns string_Copy("abcdef").
- */
-
-string string__Concat(a, b)
- string a, b;
-{
- string result;
- int a_length, b_size, result_size;
-
- a_length = string_Length(a);
- b_size = string_Length(b)+1;
- result_size = a_length+b_size;
- result = (string)malloc(result_size);
- assert(result);
-
- (void) memcpy(result, a, a_length);
- (void) memcpy(result+a_length, b, b_size);
-
- return(result);
-}
-
-/*
- * string string_Concat2(string a, b):
- * Modifies: a
- * Requires: a is on the heap, b does not point into a.
- * Effects: Equivalent to:
- * string temp;
- * temp = string_Concat(a,b);
- * free(a);
- * return(temp);
- * only faster. I.e., uses realloc instead of malloc+memcpy.
- */
-
-string string__Concat2(a, b)
- string a, b;
-{
- int a_length = string_Length(a);
- int b_size = string_Length(b)+1;
-
-#ifdef DEBUG_MEMORY
- assert(memory__on_heap_p(a));
-#endif
-
- a = (string)realloc(a, a_length+b_size);
- assert(a);
- (void) memcpy(a+a_length, b, b_size);
-
- return(a);
-}
-
-/*
- * string string_Downcase(string s):
- * Modifies: s
- * Effects: Modifies s by changing every uppercase character in s
- * to the corresponding lowercase character. Nothing else
- * is changed. I.e., "FoObAr19." is changed to "foobar19.".
- * S is returned as a convenience.
- */
-
-string string_Downcase(s)
- string s;
-{
- char *ptr;
-
- for (ptr=s; *ptr; ptr++) {
- if (isupper(*ptr))
- *ptr = tolower(*ptr);
- }
-
- return(s);
-}
-
-/*
- * string string_Upcase(string s):
- * Modifies: s
- * Effects: Modifies s by changing every lowercase character in s
- * to the corresponding uppercase character. Nothing else
- * is changed. I.e., "FoObAr19." is changed to "FOOBAR19.".
- * S is returned as a convenience.
- */
-
-string string_Upcase(s)
- string s;
-{
- char *ptr;
-
- for (ptr=s; *ptr; ptr++) {
- if (islower(*ptr))
- *ptr = toupper(*ptr);
- }
-
- return(s);
-}
diff --git a/zwgc/X_driver.c b/zwgc/X_driver.c
index 96aa2c1..ba118b7 100644
--- a/zwgc/X_driver.c
+++ b/zwgc/X_driver.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_X_driver_c[] = "$Id$";
+static const char rcsid_X_driver_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -24,7 +26,8 @@ static char rcsid_X_driver_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <stdio.h>
+#ifndef X_DISPLAY_MISSING
+
#include "X_driver.h"
#include <X11/Xresource.h>
#include "new_memory.h"
@@ -34,7 +37,7 @@ static char rcsid_X_driver_c[] = "$Id$";
#include "error.h"
#include "X_gram.h"
#include "xselect.h"
-#include "ulong_dictionary.h"
+#include "unsigned_long_dictionary.h"
char *app_instance;
@@ -54,14 +57,6 @@ Display *dpy = NULL;
*
*/
-#ifndef APPDEFDATABASE
-#define APPDEFDATABASE "/usr/athena/lib/zephyr/zwgc_resources"
-#endif
-
-/*
- *
- */
-
#ifndef APPNAME
#define APPNAME "zwgc"
#endif
@@ -158,7 +153,7 @@ int get_bool_resource(name, class, default_value)
return(result);
}
-static ulong_dictionary color_dict = NULL;
+static unsigned_long_dictionary color_dict = NULL;
/* Requires: name points to color name or hex string. name must be free'd
* eventually by the caller.
@@ -175,14 +170,14 @@ unsigned long x_string_to_color(name,def)
char *name;
unsigned long def;
{
- ulong_dictionary_binding *binding;
+ unsigned_long_dictionary_binding *binding;
int exists;
XColor xc;
if (name == NULL)
return(def);
- binding = ulong_dictionary_Define(color_dict,name,&exists);
+ binding = unsigned_long_dictionary_Define(color_dict,name,&exists);
if (exists) {
return((unsigned long) binding->value);
@@ -192,7 +187,7 @@ unsigned long x_string_to_color(name,def)
if (XAllocColor(dpy,
DefaultColormapOfScreen(DefaultScreenOfDisplay(dpy)),
&xc)) {
- binding->value = (ulong) xc.pixel;
+ binding->value = (unsigned long) xc.pixel;
return(xc.pixel);
} else {
ERROR2("Error in XAllocColor on \"%s\": using default color\n",
@@ -202,7 +197,7 @@ unsigned long x_string_to_color(name,def)
ERROR2("Error in XParseColor on \"%s\": using default color\n",
name);
}
- ulong_dictionary_Delete(color_dict,binding);
+ unsigned_long_dictionary_Delete(color_dict,binding);
return(def);
}
/*NOTREACHED*/
@@ -248,6 +243,7 @@ int open_display_and_load_resources(pargc, argv)
{
XrmDatabase temp_db1, temp_db2, temp_db3;
char *filename, *res, *xdef;
+ char dbasename[128];
extern char *getenv();
/* Initialize X resource manager: */
@@ -269,7 +265,8 @@ int open_display_and_load_resources(pargc, argv)
return(1);
/* Read in our application-specific resources: */
- temp_db1 = XrmGetFileDatabase(APPDEFDATABASE);
+ sprintf(dbasename, "%s/zwgc_resources", DATADIR);
+ temp_db1 = XrmGetFileDatabase(dbasename);
/*
* Get resources from the just opened display:
@@ -371,7 +368,7 @@ int X_driver_init(drivername, notfirst, pargc, argv)
app_instance=string_Copy(temp?temp+1:argv[0]);
- color_dict = ulong_dictionary_Create(37);
+ color_dict = unsigned_long_dictionary_Create(37);
xshowinit();
x_gram_init(dpy);
@@ -408,3 +405,6 @@ char *X_driver(text)
free_desc(desc);
return(NULL);
}
+
+#endif /* X_DISPLAY_MISSING */
+
diff --git a/zwgc/X_fonts.c b/zwgc/X_fonts.c
index 23b9cc1..51647d8 100644
--- a/zwgc/X_fonts.c
+++ b/zwgc/X_fonts.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_X_fonts_c[] = "$Id$";
+static const char rcsid_X_fonts_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -24,7 +26,8 @@ static char rcsid_X_fonts_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <stdio.h>
+#ifndef X_DISPLAY_MISSING
+
#include "X_fonts.h"
#include "new_memory.h"
#include "new_string.h"
@@ -297,3 +300,6 @@ XFontStruct *get_font(dpy,style,substyle,size,face)
exit(1);
#endif
}
+
+#endif /* X_DISPLAY_MISSING */
+
diff --git a/zwgc/X_gram.c b/zwgc/X_gram.c
index 79586cd..8b8a5af 100644
--- a/zwgc/X_gram.c
+++ b/zwgc/X_gram.c
@@ -12,17 +12,20 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_X_gram_c[] = "$Id$";
+static const char rcsid_X_gram_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
+#ifndef X_DISPLAY_MISSING
+
#include "X_gram.h"
#include "xmark.h"
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
-#include <X11/Xatom.h>
#include "zwgc.h"
#include "X_driver.h"
#include "X_fonts.h"
@@ -52,10 +55,6 @@ static int border_width = 1;
static int cursor_code = XC_sailboat;
static int set_transient;
static int enable_delete;
-#ifdef SGI_DESKS
-static int global_4dwm;
-static Atom desks_hints, desks_always_global;
-#endif
static char *title_name,*icon_name;
static Cursor cursor;
static Window group_leader; /* In order to have transient windows,
@@ -144,18 +143,6 @@ void x_gram_init(dpy)
set_transient = get_bool_resource("transient", "Transient", 0);
enable_delete = get_bool_resource("enableDelete", "EnableDelete", 1);
-#ifdef SGI_DESKS
- global_4dwm = get_bool_resource("global", "Global", 1);
-
- if (global_4dwm)
- {
- desks_hints = XInternAtom(dpy, "_SGI_DESKS_HINTS", False);
-
- desks_always_global = XInternAtom(dpy, "_SGI_DESKS_ALWAYS_GLOBAL",
- False);
- }
-#endif
-
temp = get_string_resource("borderWidth", "BorderWidth");
/* <<<>>> */
if (temp && atoi(temp)>=0)
@@ -324,13 +311,7 @@ void x_gram_create(dpy, gram, xalign, yalign, xpos, ypos, xsize, ysize,
x_set_icccm_hints(dpy,w,title_name,icon_name,&sizehints,&wmhints,0);
}
-
-#ifdef SGI_DESKS
- if (global_4dwm)
- (void)XChangeProperty(dpy, w,
- desks_hints, XA_ATOM, 32, PropModeAppend,
- (char *)&desks_always_global, 1);
-#endif
+
XSaveContext(dpy, w, desc_context, (caddr_t)gram);
@@ -501,3 +482,6 @@ void x_gram_expose(dpy,w,gram,event)
XDestroyRegion(region);
}
}
+
+#endif /* X_DISPLAY_MISSING */
+
diff --git a/zwgc/browser.c b/zwgc/browser.c
index 5d94644..4fb7dcc 100644
--- a/zwgc/browser.c
+++ b/zwgc/browser.c
@@ -18,8 +18,7 @@ static char rcsid_browser_c[] = "$Header$";
#include <zephyr/mit-copyright.h>
-#include <stdio.h>
-#include <sys/types.h>
+#include <sysdep.h>
#include <sys/socket.h>
#include <sys/un.h>
#include "zwgc.h"
diff --git a/zwgc/buffer.c b/zwgc/buffer.c
index adf6803..f6d5db3 100644
--- a/zwgc/buffer.c
+++ b/zwgc/buffer.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_buffer_c[] = "$Id$";
+static const char rcsid_buffer_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
diff --git a/zwgc/character_class.c b/zwgc/character_class.c
index 2a3f2c6..3a99286 100644
--- a/zwgc/character_class.c
+++ b/zwgc/character_class.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_character_class_c[] = "$Id$";
+static const char rcsid_character_class_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
diff --git a/zwgc/Dictionary/dictionary.c b/zwgc/dictionary.c
index f9962f3..6474a82 100644
--- a/zwgc/Dictionary/dictionary.c
+++ b/zwgc/dictionary.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_dictionary_c[] = "$Id$";
+static const char rcsid_dictionary_c[] = "$Id$";
#endif
/*
diff --git a/zwgc/Dictionary/dictionary.h b/zwgc/dictionary.h
index 3299825..3299825 100644
--- a/zwgc/Dictionary/dictionary.h
+++ b/zwgc/dictionary.h
diff --git a/zwgc/display.c b/zwgc/display.c
index 27ce268..0631326 100644
--- a/zwgc/display.c
+++ b/zwgc/display.c
@@ -24,7 +24,7 @@ static char rcsid_display_c[] = "$Header$";
/* */
/****************************************************************************/
-#include <stdio.h>
+#include <sysdep.h>
#include "new_memory.h"
#include "new_string.h"
#include "variables.h"
@@ -34,21 +34,26 @@ static char rcsid_display_c[] = "$Header$";
* driver_table - <<<>>>
*/
-extern void X_driver();
extern void tty_driver();
extern void plain_driver();
extern void raw_driver();
-extern int X_driver_init();
extern int tty_driver_init();
+#ifndef X_DISPLAY_MISSING
+extern int X_driver_init();
+extern void X_driver();
+#endif
+
static struct driver_info {
string driver_name;
void (*driver)();
int (*driver_init)();
void (*driver_reset)();
} driver_table[] = {
+#ifndef X_DISPLAY_MISSING
{"X", X_driver, X_driver_init, X_driver_reset},
+#endif
{"tty", tty_driver, tty_driver_init, NULL},
{"plain", plain_driver, NULL, NULL},
{"raw", raw_driver, NULL, NULL},
diff --git a/zwgc/error.c b/zwgc/error.c
index f24e97a..2ade086 100644
--- a/zwgc/error.c
+++ b/zwgc/error.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_error_c[] = "$Id$";
+static const char rcsid_error_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
diff --git a/zwgc/eval.c b/zwgc/eval.c
index 650838b..ab59a61 100644
--- a/zwgc/eval.c
+++ b/zwgc/eval.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_eval_c[] = "$Id$";
+static const char rcsid_eval_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -139,6 +141,7 @@ string eval_expr(expr)
case SUBSTITUTE_OPCODE:
case PROTECT_OPCODE:
case VERBATIM_OPCODE:
+ case STYLESTRIP_OPCODE:
case GETENV_OPCODE:
case UPCASE_OPCODE:
case DOWNCASE_OPCODE:
@@ -162,6 +165,9 @@ string eval_expr(expr)
case VERBATIM_OPCODE:
return(verbatim(first,0));
+ case STYLESTRIP_OPCODE:
+ return(stylestrip(first));
+
case GETENV_OPCODE:
result = getenv(first);
if (!result)
diff --git a/zwgc/exec.c b/zwgc/exec.c
index 27ff1d5..7fac477 100644
--- a/zwgc/exec.c
+++ b/zwgc/exec.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_exec_c[] = "$Id$";
+static const char rcsid_exec_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -34,10 +36,6 @@ static char rcsid_exec_c[] = "$Id$";
#include "variables.h"
#include "notice.h"
-#if !defined(__STDC__) && !defined(const)
-#define const
-#endif
-
static int exec_subtree(), exec_fields();
/****************************************************************************/
@@ -371,6 +369,7 @@ static struct _Opstuff {
{ exec_noop }, /* substitute */
{ exec_noop }, /* protect */
{ exec_noop }, /* verbatim */
+ { exec_noop }, /* stylestrip */
{ exec_noop }, /* getenv */
{ exec_noop }, /* upcase */
{ exec_noop }, /* downcase */
diff --git a/zwgc/file.c b/zwgc/file.c
index 2f048dd..39067cf 100644
--- a/zwgc/file.c
+++ b/zwgc/file.c
@@ -12,15 +12,14 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_file_c[] = "$Id$";
+static const char rcsid_file_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <stdio.h>
#include <pwd.h>
#include "new_memory.h"
#include "new_string.h"
diff --git a/zwgc/formatter.c b/zwgc/formatter.c
index 03ee3d0..c74bc7d 100644
--- a/zwgc/formatter.c
+++ b/zwgc/formatter.c
@@ -12,16 +12,15 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_formatter_c[] = "$Id$";
+static const char rcsid_formatter_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
#include <zephyr/zephyr.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
#include "new_memory.h"
#include "char_stack.h"
#include "string_dictionary.h"
@@ -375,6 +374,51 @@ string protect(str)
return(temp);
}
+/* str points to a string. return value is another string
+ which is the original with all styles removed. */
+string stylestrip(str)
+ string str;
+{
+ int templen = 0, otherchar;
+ char *temp = (char *) malloc(string_Length(str) + 1);
+ char_stack chs;
+ string ostr = str;
+
+ chs = char_stack_create();
+
+ while (*str) {
+ if (*str == '@') {
+ int len = env_length(str + 1);
+ if (len != -1) {
+ otherchar = 0;
+ if ((len == 4 && !strncasecmp(str + 1, "font", 4))
+ || (len == 5 && !strncasecmp(str + 1, "color", 5)))
+ otherchar = 0x80;
+ otherchar |= otherside(str[len + 1]);
+ char_stack_push(chs, otherchar);
+ str += len + 2;
+ continue;
+ }
+ }
+ if (!char_stack_empty(chs) && *str == (char_stack_top(chs) & 0x7f)) {
+ char_stack_pop(chs);
+ str++;
+ continue;
+ }
+ if (!char_stack_empty(chs) && (char_stack_top(chs) & 0x80))
+ str++;
+ else
+ temp[templen++] = *str++;
+ }
+ temp[templen] = 0;
+
+ while (!char_stack_empty(chs))
+ char_stack_pop(chs);
+ free(ostr);
+
+ return(temp);
+}
+
void free_desc(desc)
desctype *desc;
{
diff --git a/zwgc/generate_instance b/zwgc/instantiate
index 0a42621..dae134d 100755
--- a/zwgc/generate_instance
+++ b/zwgc/instantiate
@@ -12,7 +12,7 @@
#
if [ "$1" = "" ]; then
- echo "Usage: generate_instance <srcdir> <stack|dictionary> <name> [<include file>]"
+ echo "Usage: generate_instance <srcdir> <type> <name> [<include file>]"
exit 1
fi
@@ -21,22 +21,19 @@ type=$2
name=$3
incfile=$4
-if [ ! -f ${source}/${type}.h ]; then
- echo "$0: unable to open ${source}/${type}.h"
- exit 2
-fi
-
-case $type in
-dictionary)
+if [ "$type" != "stack" ]; then
if [ ! -f ${source}/${type}.c ]; then
echo "$0: unable to open ${source}/${type}.c"
exit 2
fi
sed "s/TYPE_T/$name/g" ${source}/${type}.c > ${name}_${type}.c
- ;;
-esac
+fi
if [ "$incfile" != "" ]; then
echo "#include \"$incfile\"" > ${name}_${type}.h
fi
+if [ ! -f ${source}/${type}.h ]; then
+ echo "$0: unable to open ${source}/${type}.h"
+ exit 2
+fi
sed "s/TYPE_T/$name/g" ${source}/${type}.h >> ${name}_${type}.h
diff --git a/zwgc/lexer.c b/zwgc/lexer.c
index 5ee3f81..23276e9 100644
--- a/zwgc/lexer.c
+++ b/zwgc/lexer.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_lexer_c[] = "$Id$";
+static const char rcsid_lexer_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -24,7 +26,6 @@ static char rcsid_lexer_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <stdio.h>
#include "new_memory.h"
#include "new_string.h"
#include "int_dictionary.h"
@@ -158,6 +159,7 @@ static struct keyword_info keywords[] = {
{ "rspan", RSPAN },
{ "set", SET },
{ "show", SHOW },
+ { "stylestrip", STYLESTRIP },
{ "substitute", SUBSTITUTE },
{ "then", THEN },
{ "upcase", UPCASE },
diff --git a/zwgc/main.c b/zwgc/main.c
index 52be870..1b842cb 100644
--- a/zwgc/main.c
+++ b/zwgc/main.c
@@ -12,15 +12,16 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_main_c[] = "$Id$";
+static const char rcsid_main_c[] = "$Id$";
#endif
+#include <sys/resource.h>
#include <zephyr/mit-copyright.h>
#include <zephyr/zephyr.h>
-#include <stdio.h>
-#include <signal.h>
#include "new_memory.h"
#include "zwgc.h"
#include "parser.h"
@@ -36,7 +37,7 @@ static char rcsid_main_c[] = "$Id$";
#include "main.h"
extern void notice_handler();
-static void setup_signals(), detach();
+static void setup_signals(), detach(), signal_exit();
/*
* Global zwgc-wide variables:
@@ -46,7 +47,7 @@ static void setup_signals(), detach();
int zwgc_debug = 0;
#endif
-static char *zwgc_version_string = "0.4.7";
+static char *zwgc_version_string = "1.0";
/*
* description_filename_override - <<<>>>
@@ -55,6 +56,12 @@ static char *zwgc_version_string = "0.4.7";
static char *description_filename_override = NULL;
/*
+ * progname - <<<>>> export!
+ */
+
+char *progname = NULL;
+
+/*
* subscriptions_filename_override - <<<>>> export!
*/
@@ -109,10 +116,12 @@ static void fake_startup_packet()
static void read_in_description_file()
{
FILE *input_file;
+ char defdesc[128];
/* var_clear_all_variables(); <<<>>> */
- input_file = locate_file(description_filename_override, USRDESC, DEFDESC);
+ sprintf(defdesc, "%s/%s", DATADIR, DEFDESC);
+ input_file = locate_file(description_filename_override, USRDESC, defdesc);
if (input_file)
program = parse_file(input_file);
else
@@ -192,6 +201,8 @@ int main(argc, argv)
register char **current;
int dofork = 1;
+ progname = argv[0];
+
/*
* Process "-f <filename>", "-subfile <filename>", "-nofork",
* "-reenter" (which is ignored) and (if DEBUG) "-debug"
@@ -309,6 +320,8 @@ void notice_handler(notice)
free(class);
free(instance);
free(recipient);
+ } else if (!strcasecmp(control_opcode, USER_EXIT)) {
+ signal_exit();
} else
printf("zwgc: unknown control opcode %s.\n", control_opcode);
@@ -347,15 +360,11 @@ static void signal_exit()
mux_end_loop_p = 1;
}
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-
/* clean up ALL the waiting children, in case we get hit with
multiple SIGCHLD's at once, and don't process in time. */
-static void signal_child()
+static RETSIGTYPE signal_child()
{
-#ifdef POSIX
+#ifdef HAVE_WAITPID
int status;
#else
union wait status;
@@ -364,7 +373,7 @@ static void signal_child()
int pid, old_errno = errno;
do {
-#ifdef POSIX
+#ifdef HAVE_WAITPID
pid = waitpid(-1, &status, WNOHANG);
#else
pid = wait3(&status, WNOHANG, (struct rusage *)0);
@@ -376,7 +385,7 @@ static void signal_child()
static void setup_signals(dofork)
int dofork;
{
-#ifdef POSIX
+#ifdef _POSIX_VERSION
struct sigaction sa;
sigemptyset(&sa.sa_mask);
@@ -433,7 +442,7 @@ static void detach()
register int i;
/* to try to get SIGHUP on user logout */
-#if defined(POSIX) && !defined(ultrix)
+#if defined(_POSIX_VERSION) && !defined(ultrix)
(void) setpgid(0, tcgetpgrp(1));
#else
(void) setpgrp(0, getpgrp(getppid()));
diff --git a/zwgc/main.h b/zwgc/main.h
index 73b49eb..0af201e 100644
--- a/zwgc/main.h
+++ b/zwgc/main.h
@@ -19,6 +19,7 @@
#ifndef main_MODULE
#define main_MODULE
+extern char *progname;
extern char *subscriptions_filename_override;
/*
@@ -34,10 +35,11 @@ extern void usage();
#define USRDESC ".zwgc.desc"
-/* DEFDESC points to where the system default description is stored */
+/* DEFDESC points to a file (relative to the data directory) which has the
+ * system default description file */
#ifndef DEFDESC
-#define DEFDESC "/usr/athena/lib/zephyr/zwgc.desc"
+#define DEFDESC "zwgc.desc"
#endif
#endif
diff --git a/zwgc/mux.c b/zwgc/mux.c
index a682267..221ae8b 100644
--- a/zwgc/mux.c
+++ b/zwgc/mux.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_mux_c[] = "$Id$";
+static const char rcsid_mux_c[] = "$Id$";
#endif
/****************************************************************************/
@@ -22,12 +24,6 @@ static char rcsid_mux_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/file.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdio.h>
#include <zephyr/zephyr.h>
#include "mux.h"
#include "error.h"
@@ -201,7 +197,7 @@ static int check_tty()
if (tty < 0) return 0;
-#if defined(POSIX) || defined(SUNOS)
+#if defined(_POSIX_VERSION)
result = ( ((pgrp = tcgetpgrp(tty)) < 0) ? 0 : 1 );
#else
result = ( (ioctl(tty, TIOCGPGRP, &pgrp) < 0) ? 0 : 1 );
diff --git a/zwgc/Memory/new_memory.c b/zwgc/new_memory.c
index 7fb2732..541712a 100644
--- a/zwgc/Memory/new_memory.c
+++ b/zwgc/new_memory.c
@@ -12,12 +12,14 @@
* "mit-copyright.h".
*/
-#if !defined(SABER) && (defined(DEBUG) || defined(MEMORY_DEBUG))
+#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static char rcsid_new_memory_c[] = "$Id$";
+static const char rcsid_new_memory_c[] = "$Id$";
#endif
+#if !defined(SABER) && (defined(DEBUG) || defined(MEMORY_DEBUG))
+
/*
* memory - module wrapping debugging code around normal malloc/free/etc.
* routines.
@@ -33,14 +35,6 @@ static char rcsid_new_memory_c[] = "$Id$";
/*
*
*/
-extern char *malloc();
-extern char *realloc();
-char *calloc();
-extern int free();
-
-/*
- *
- */
#ifdef DEBUG
#define assert(x) if (!(x)) abort()
#else
@@ -52,8 +46,6 @@ extern int free();
*/
#ifdef DEBUG_MEMORY
-#include <stdio.h>
-
extern void record_request();
char *current_module = 0;
int current_line = -1;
@@ -165,7 +157,7 @@ void memory__free(ptr)
#ifdef DEBUG_MEMORY
-#include "../Dictionary/int_dictionary.h"
+#include "int_dictionary.h"
static int request_off = 0;
static int_dictionary requests = 0;
diff --git a/zwgc/Memory/new_memory.h b/zwgc/new_memory.h
index 5c213b7..5c213b7 100644
--- a/zwgc/Memory/new_memory.h
+++ b/zwgc/new_memory.h
diff --git a/zwgc/String/new_string.c b/zwgc/new_string.c
index aca7746..6c3896b 100644
--- a/zwgc/String/new_string.c
+++ b/zwgc/new_string.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_new_string_c[] = "$Id$";
+static const char rcsid_new_string_c[] = "$Id$";
#endif
/*
@@ -40,11 +42,8 @@ static char rcsid_new_string_c[] = "$Id$";
#define assert(x)
#endif
-#include <ctype.h>
#include "new_memory.h"
-#include <string.h>
-
#define string_Length(s) strlen(s)
typedef char *string;
diff --git a/zwgc/String/new_string.h b/zwgc/new_string.h
index 3b5eae9..3b5eae9 100644
--- a/zwgc/String/new_string.h
+++ b/zwgc/new_string.h
diff --git a/zwgc/node.c b/zwgc/node.c
index ede0187..b44aacf 100644
--- a/zwgc/node.c
+++ b/zwgc/node.c
@@ -12,13 +12,14 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_node_c[] = "$Id$";
+static const char rcsid_node_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
-#include <stdio.h>
#include "new_memory.h"
#include "node.h"
@@ -267,6 +268,7 @@ static string how_to_print[] = {
"substitute(%1)",
"protect(%1)",
"verbatim(%1)",
+ "stylestrip(%1)",
"getenv(%1)",
"upcase(%1)",
"downcase(%1)",
diff --git a/zwgc/node.h b/zwgc/node.h
index 35ac013..c98433d 100644
--- a/zwgc/node.h
+++ b/zwgc/node.h
@@ -40,52 +40,53 @@
#define SUBSTITUTE_OPCODE 12
#define PROTECT_OPCODE 13
#define VERBATIM_OPCODE 14
-#define GETENV_OPCODE 15
-#define UPCASE_OPCODE 16
-#define DOWNCASE_OPCODE 17
-#define ZVAR_OPCODE 18
-#define GET_OPCODE 19
-
-#define LANY_OPCODE 20
-#define RANY_OPCODE 21
-#define LBREAK_OPCODE 22
-#define RBREAK_OPCODE 23
-#define LSPAN_OPCODE 24
-#define RSPAN_OPCODE 25
-
-#define LAST_EXPR_OPCODE 25
-
-#define NOOP_OPCODE 26
-#define SET_OPCODE 27
-#define FIELDS_OPCODE 28
-
-#define PRINT_OPCODE 29
-#define CLEARBUF_OPCODE 30
-
-#define APPENDPORT_OPCODE 31
-#define EXECPORT_OPCODE 32
-#define INPUTPORT_OPCODE 33
-#define OUTPUTPORT_OPCODE 34
-#define PUT_OPCODE 35
-#define CLOSEINPUT_OPCODE 36
-#define CLOSEOUTPUT_OPCODE 37
-#define CLOSEPORT_OPCODE 38
-
-#define EXEC_OPCODE 39
-
-#define IF_STMT_OPCODE 40
-#define CASE_OPCODE 41
-#define WHILE_OPCODE 42
-#define BREAK_OPCODE 43
-#define EXIT_OPCODE 44
-
-#define IF_OPCODE 45
-#define ELSEIF_OPCODE 46
-#define ELSE_OPCODE 47
-#define MATCHLIST_OPCODE 48
-#define DEFAULT_OPCODE 49
-
-#define NUMBER_OF_OPCODES 50
+#define STYLESTRIP_OPCODE 15
+#define GETENV_OPCODE 16
+#define UPCASE_OPCODE 17
+#define DOWNCASE_OPCODE 18
+#define ZVAR_OPCODE 19
+#define GET_OPCODE 20
+
+#define LANY_OPCODE 21
+#define RANY_OPCODE 22
+#define LBREAK_OPCODE 23
+#define RBREAK_OPCODE 24
+#define LSPAN_OPCODE 25
+#define RSPAN_OPCODE 26
+
+#define LAST_EXPR_OPCODE 26
+
+#define NOOP_OPCODE 27
+#define SET_OPCODE 28
+#define FIELDS_OPCODE 29
+
+#define PRINT_OPCODE 30
+#define CLEARBUF_OPCODE 31
+
+#define APPENDPORT_OPCODE 32
+#define EXECPORT_OPCODE 33
+#define INPUTPORT_OPCODE 34
+#define OUTPUTPORT_OPCODE 35
+#define PUT_OPCODE 36
+#define CLOSEINPUT_OPCODE 37
+#define CLOSEOUTPUT_OPCODE 38
+#define CLOSEPORT_OPCODE 39
+
+#define EXEC_OPCODE 40
+
+#define IF_STMT_OPCODE 41
+#define CASE_OPCODE 42
+#define WHILE_OPCODE 43
+#define BREAK_OPCODE 44
+#define EXIT_OPCODE 45
+
+#define IF_OPCODE 46
+#define ELSEIF_OPCODE 47
+#define ELSE_OPCODE 48
+#define MATCHLIST_OPCODE 49
+#define DEFAULT_OPCODE 50
+
+#define NUMBER_OF_OPCODES 51
typedef struct _Node {
int opcode; /* Read-only */
diff --git a/zwgc/notice.c b/zwgc/notice.c
index 543f272..4e14946 100644
--- a/zwgc/notice.c
+++ b/zwgc/notice.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_notice_c[] = "$Id$";
+static const char rcsid_notice_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -308,7 +310,7 @@ char *decode_notice(notice)
* Convert host notice sent from to ascii:
*/
if (notice->z_sender_addr.s_addr) {
- fromhost = gethostbyaddr(&(notice->z_sender_addr),
+ fromhost = gethostbyaddr((char *) &(notice->z_sender_addr),
sizeof(struct in_addr), AF_INET);
var_set_variable("fromhost", fromhost ? fromhost->h_name :
inet_ntoa(notice->z_sender_addr));
diff --git a/zwgc/parser.y b/zwgc/parser.y
index 31d21db..22b8a47 100644
--- a/zwgc/parser.y
+++ b/zwgc/parser.y
@@ -13,8 +13,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_parser_y[] = "$Id$";
+static const char rcsid_parser_y[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -56,7 +58,7 @@ static Node *the_program;
%token ELSE ELSEIF ENDCASE ENDIF ENDWHILE EXEC EXECPORT EXIT
%token FIELDS GET GETENV IF INPUTPORT LANY LBREAK LSPAN
%token MATCH NOOP NOT OUTPUTPORT PRINT PROTECT VERBATIM PUT RANY RBREAK
-%token RSPAN SET SHOW SUBSTITUTE THEN UPCASE WHILE ZVAR
+%token RSPAN SET SUBSTITUTE THEN UPCASE WHILE ZVAR STYLESTRIP
%type <node> expr varname string
%type <node> exprlist comma_exprlist varnamelist
@@ -132,6 +134,8 @@ expr : '(' expr ')'
{ $$ = node_create_unary(ZVAR_OPCODE, $3); }
| GET '(' expr ')'
{ $$ = node_create_unary(GET_OPCODE, $3); }
+ | STYLESTRIP '(' expr ')'
+ { $$ = node_create_unary(STYLESTRIP_OPCODE, $3); }
| LANY '(' expr ',' expr ')'
{ $$ = node_create_binary(LANY_OPCODE, $3, $5 ); }
diff --git a/zwgc/port.c b/zwgc/port.c
index c30bfad..6ed3919 100644
--- a/zwgc/port.c
+++ b/zwgc/port.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_port_c[] = "$Id$";
+static const char rcsid_port_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -24,41 +26,12 @@ static char rcsid_port_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <stdio.h>
-#include <fcntl.h>
#include "new_string.h"
#include "port_dictionary.h"
#include "port.h"
#include "notice.h"
#include "variables.h"
-/*
- * <<<>>>
- */
-
-#if defined(SUNOS) || defined(vax)
-extern int errno, sys_nerr;
-extern char *sys_errlist[];
-
-string perror_to_string(errno)
- int errno;
-{
- if (errno>=0 && errno<sys_nerr)
- return(sys_errlist[errno]);
-
- /* <<<>>> */
- return("illegal error number returned in errno!");
-}
-#else
-#include <errno.h>
-
-string perror_to_string(errno)
- int errno;
-{
- return(strerror(errno));
-}
-#endif
-
/****************************************************************************/
/* */
/* Port methods (internal): */
@@ -369,7 +342,7 @@ static string get_file(p, error_p)
errno = 0;
if (!fgets(buffer, 9999, p->data.file.input_connector)) {
if (errno)
- *error_p = perror_to_string(errno);
+ *error_p = strerror(errno);
else
*error_p = "Attempt to read past end of file";
@@ -393,7 +366,7 @@ static char *put_file(p, text, length)
fflush(p->data.file.output_connector);
if (errno)
- return(perror_to_string(errno));
+ return(strerror(errno));
return(NULL);
}
@@ -408,7 +381,7 @@ static char *close_file_input(p)
}
if (errno)
- return(perror_to_string(errno));
+ return(strerror(errno));
return(NULL);
}
@@ -423,7 +396,7 @@ static char *close_file_output(p)
}
if (errno)
- return(perror_to_string(errno));
+ return(strerror(errno));
return(NULL);
}
@@ -518,7 +491,7 @@ void create_file_append_port(name, filename)
out = fopen(filename, "a");
(void) umask(oumask);
if (out == NULL) {
- var_set_variable("error", perror_to_string(errno));
+ var_set_variable("error", strerror(errno));
return;
}
@@ -534,7 +507,7 @@ void create_file_input_port(name, filename)
errno = 0;
in = fopen(filename, "r");
if (in == NULL) {
- var_set_variable("error", perror_to_string(errno));
+ var_set_variable("error", strerror(errno));
return;
}
@@ -554,7 +527,7 @@ void create_file_output_port(name, filename)
out = fopen(filename, "w");
(void) umask(oumask);
if (out == NULL) {
- var_set_variable("error", perror_to_string(errno));
+ var_set_variable("error", strerror(errno));
return;
}
diff --git a/zwgc/regexp.c b/zwgc/regexp.c
index f6f5854..f874e45 100644
--- a/zwgc/regexp.c
+++ b/zwgc/regexp.c
@@ -12,19 +12,19 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_regexp_c[] = "$Id$";
+static const char rcsid_regexp_c[] = "$Id$";
#endif
-#include <stdio.h>
-#include "regexp.h"
-
#ifdef SOLARIS
#include <libgen.h>
#endif
-#ifdef POSIX_REGEXP
-#include <sys/types.h>
+#include "regexp.h"
+
+#ifdef HAVE_REGCOMP
#include <regex.h>
int ed_regexp_match_p(test_string, pattern)
@@ -35,13 +35,14 @@ int ed_regexp_match_p(test_string, pattern)
int retval;
char errbuf[512];
- if (retval = regcomp(&RE, pattern, REG_EXTENDED|REG_NOSUB)) {
+ retval = regcomp(&RE, pattern, REG_NOSUB);
+ if (retval != 0) {
regerror(retval, &RE, errbuf, sizeof(errbuf));
fprintf(stderr,"%s in regcomp %s\n",errbuf,pattern);
return(0);
}
retval = regexec(&RE, test_string, 0, NULL, 0);
- if (retval && retval != REG_NOMATCH) {
+ if (retval != 0 && retval != REG_NOMATCH) {
regerror(retval, &RE, errbuf, sizeof(errbuf));
fprintf(stderr,"%s in regexec %s\n",errbuf,pattern);
regfree(&RE);
@@ -52,8 +53,8 @@ int ed_regexp_match_p(test_string, pattern)
}
#else
-extern char *re_comp();
-extern int re_exec();
+char *re_comp();
+int re_exec();
int ed_regexp_match_p(test_string, pattern)
string test_string;
@@ -75,12 +76,11 @@ int ed_regexp_match_p(test_string, pattern)
}
#endif
-/*
- * This is for AUX.
- * It is a wrapper around the C library regexp functions.
- */
+#if !defined(HAVE_RE_COMP) && !defined(HAVE_REGCOMP)
-#if defined(_AUX_SOURCE) || defined(SOLARIS)
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
static char *re;
diff --git a/zwgc/standard_ports.c b/zwgc/standard_ports.c
index 72c6206..d0664dd 100644
--- a/zwgc/standard_ports.c
+++ b/zwgc/standard_ports.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_standard_ports_c[] = "$Id$";
+static const char rcsid_standard_ports_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -24,22 +26,20 @@ static char rcsid_standard_ports_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <stdio.h>
#include "new_memory.h"
#include "port.h"
#include "variables.h"
#include "error.h"
+#include "main.h"
#include <zephyr/zephyr.h>
-#ifndef ZWGCPATH
-#define ZWGCPATH "/usr/etc/zwgc"
-#endif
-
extern string tty_filter();
-extern char *X_driver();
+extern int tty_filter_init();
+#ifndef X_DISPLAY_MISSING
+extern char *X_driver();
extern int X_driver_init();
-extern int tty_filter_init();
+#endif
extern void usage();
@@ -128,8 +128,12 @@ static struct standard_port_info {
char *(*function)();
int setup_arg;
} standard_port_info_table[] = {
+#ifndef X_DISPLAY_MISSING
{ "X", DEFAULT_OK, X_driver_init, OUTPUT_PROC, X_driver, 0},
{ "tty", DEFAULT_NOTOK, tty_filter_init, OUTPUT_PROC, tty_driver, 0},
+#else
+{ "tty", DEFAULT_OK, tty_filter_init, OUTPUT_PROC, tty_driver, 0},
+#endif
{ "plain", DEFAULT_NOTOK, tty_filter_init, OUTPUT_PROC, plain_driver, 0},
{ "stdout", DEFAULT_NOTOK, NULL, OUTPUT_DESC, NULL, 1},
{ "stderr", DEFAULT_NOTOK, NULL, OUTPUT_DESC, NULL, 2},
@@ -281,7 +285,7 @@ void init_standard_ports(pargc, argv)
if (fallback == -1) /* complain, since indeterminate */
ERROR2(
"To receive Zephyrgrams, (type `%s -ttymode').\n",
- ZWGCPATH);
+ progname);
exit(1);
}
} else
diff --git a/zwgc/Dictionary/string_dictionary_aux.c b/zwgc/string_dictionary_aux.c
index c17c157..b257397 100644
--- a/zwgc/Dictionary/string_dictionary_aux.c
+++ b/zwgc/string_dictionary_aux.c
@@ -32,6 +32,7 @@ static char rcsid_string_dictionary_aux_c[] = "$Id$";
* in a string_dictionary.
*/
+#include <sysdep.h>
#include "new_memory.h"
#include "string_dictionary.h"
diff --git a/zwgc/Dictionary/string_dictionary_aux.h b/zwgc/string_dictionary_aux.h
index 2098095..2098095 100644
--- a/zwgc/Dictionary/string_dictionary_aux.h
+++ b/zwgc/string_dictionary_aux.h
diff --git a/zwgc/subscriptions.c b/zwgc/subscriptions.c
index ff18c06..c3d8c10 100644
--- a/zwgc/subscriptions.c
+++ b/zwgc/subscriptions.c
@@ -22,9 +22,8 @@ static char rcsid_subscriptions_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <stdio.h>
+#include <sysdep.h>
#include <zephyr/zephyr.h>
-#include <sys/param.h>
#include <netdb.h>
#include "new_memory.h"
#include "new_string.h"
diff --git a/zwgc/substitute.c b/zwgc/substitute.c
index 92805d9..03d619e 100644
--- a/zwgc/substitute.c
+++ b/zwgc/substitute.c
@@ -18,6 +18,7 @@ static char rcsid_substitute_c[] = "$Id$";
#include <zephyr/mit-copyright.h>
+#include <sysdep.h>
#include "new_memory.h"
#include "lexer.h"
#include "substitute.h"
diff --git a/zwgc/text_operations.c b/zwgc/text_operations.c
index 2ebd170..7eba386 100644
--- a/zwgc/text_operations.c
+++ b/zwgc/text_operations.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_text_operations_c[] = "$Id$";
+static const char rcsid_text_operations_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
diff --git a/zwgc/tty_filter.c b/zwgc/tty_filter.c
index 25221f8..a75f082 100644
--- a/zwgc/tty_filter.c
+++ b/zwgc/tty_filter.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_tty_filter_c[] = "$Id$";
+static const char rcsid_tty_filter_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -24,9 +26,6 @@ static char rcsid_tty_filter_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <stdio.h>
-#include <ctype.h>
-#include <termios.h>
#include "new_memory.h"
#include "new_string.h"
#include "string_dictionary_aux.h"
@@ -68,11 +67,14 @@ static char code_buf[10240], *code_buf_pos = code_buf, *code;
@u "us"/"ue" termcap entry.
*/
-#define TD_SET(k,v) (string_dictionary_Define(termcap_dict,(k),&ex)->value = (v))
-#define EAT_PADDING(var) (code = code_buf_pos, tputs(var, 1, tty_outc), *code_buf_pos++ = 0, var = code)
+#define TD_SET(k,v) (string_dictionary_Define(termcap_dict, (k), &ex)->value \
+ = (v))
+#define EXPAND(k) (code = code_buf_pos, tputs(tmp, 1, tty_outc), \
+ *code_buf_pos++ = 0, TD_SET(k, code))
-static int tty_outc(c)
-int c;
+static int
+tty_outc(c)
+ int c;
{
*code_buf_pos++ = c;
return 0;
@@ -90,9 +92,15 @@ char **argv;
int ex;
string_dictionary_binding *b;
int isrealtty = string_Eq(drivername, "tty");
+#ifdef HAVE_TERMIOS_H
struct termios tbuf;
- ospeed = (tcgetattr(0, &tbuf) == 0) ? cfgetospeed(&tbuf) : 2400;
+ ospeed = (tcgetattr(STDIN_FILENO, &tbuf) == 0) ? cfgetospeed(&tbuf) : 2400;
+#else
+ struct sgttyb sgttyb;
+
+ ospeed = (ioctl(0, TIOCGETP, &sgttyb) == 0) ? sgttyb.sg_ospeed : 2400;
+#endif
if (termcap_dict == (string_dictionary) NULL)
termcap_dict = string_dictionary_Create(7);
@@ -119,46 +127,39 @@ char **argv;
/* Step 1: get all of {rv,bold,u,bell,blink} that are available. */
+ /* We cheat here, and ignore the padding (if any) specified for
+ the mode-change strings (it's a real pain to do "right") */
+
tmp = tgetstr("pc", &p);
PC = (tmp) ? *tmp : 0;
if (tmp = tgetstr("md",&p)) { /* bold ? */
- EAT_PADDING(tmp);
- TD_SET("B.bold",tmp);
+ EXPAND("B.bold");
tmp = tgetstr("me",&p);
- EAT_PADDING(tmp);
- TD_SET("E.bold",tmp);
+ EXPAND("E.bold");
}
if (tmp = tgetstr("mr",&p)) { /* reverse video? */
- EAT_PADDING(tmp);
- TD_SET("B.rv",tmp);
+ EXPAND("B.rw");
tmp = tgetstr("me",&p);
- EAT_PADDING(tmp);
- TD_SET("E.rv",tmp);
+ EXPAND("E.rw");
}
if (tmp = tgetstr("bl",&p)) { /* Bell ? */
- TD_SET("B.bell",tmp);
- TD_SET("E.bell",NULL);
+ EXPAND("B.bell");
+ TD_SET("E.bell", NULL);
}
if (tmp = tgetstr("mb",&p)) { /* Blink ? */
- EAT_PADDING(tmp);
- TD_SET("B.blink",tmp);
+ EXPAND("B.blink");
tmp = tgetstr("me",&p);
- EAT_PADDING(tmp);
- TD_SET("E.blink",tmp);
+ EXPAND("E.blink");
}
if (tmp = tgetstr("us",&p)) { /* Underline ? */
- EAT_PADDING(tmp);
- TD_SET("B.u",tmp);
+ EXPAND("B.u");
tmp = tgetstr("ue",&p);
- EAT_PADDING(tmp);
- TD_SET("E.u", tmp);
+ EXPAND("E.u");
}
if (tmp = tgetstr("so",&p)) { /* Standout ? */
- EAT_PADDING(tmp);
- TD_SET("B.so",tmp);
+ EXPAND("B.so");
tmp = tgetstr("se",&p);
- EAT_PADDING(tmp);
- TD_SET("E.so", tmp);
+ EXPAND("E.so");
}
}
/* Step 2: alias others to the nearest substitute */
@@ -388,6 +389,8 @@ static int calc_max_line_width(info)
int right = 0;
for (; info; info=info->next) {
+ if (info->ignore)
+ continue;
switch (info->alignment) {
case 'l':
left += info->len;
@@ -434,11 +437,11 @@ string tty_filter(text, use_fonts)
desctype *desc;
int number_of_strs;
int number_of_lines;
- tty_str_info *info;
+ tty_str_info *info, *info_head;
int max_line_width;
desc = disp_get_cmds(text_copy, &number_of_strs, &number_of_lines);
- info = convert_desc_to_tty_str_info(desc);
+ info_head = info = convert_desc_to_tty_str_info(desc);
free_desc(desc);
#ifdef DEBUG
@@ -537,7 +540,7 @@ string tty_filter(text, use_fonts)
}
}
- free_info(info);
+ free_info(info_head);
free(text_copy);
if (number_of_lines &&
(result_so_far[string_Length(result_so_far)-1] != '\n'))
diff --git a/zwgc/ulong.h b/zwgc/ulong.h
deleted file mode 100644
index 95269a5..0000000
--- a/zwgc/ulong.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* This file is part of the Project Athena Zephyr Notification System.
- * It is one of the source files comprising zwgc, the Zephyr WindowGram
- * client.
- *
- * Created by: Marc Horowitz <marc@athena.mit.edu>
- *
- * $Source$
- * $Author$
- * $Id$
- *
- * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- * For copying and distribution information, see the file
- * "mit-copyright.h".
- */
-#ifndef ulong_MODULE
-#define ulong_MODULE
-
-#include <sys/types.h>
-
-#if defined(ultrix) || defined(vax) || defined(SUNOS) || defined(__NetBSD__)
-typedef unsigned long ulong;
-#endif
-
-#endif
diff --git a/zwgc/unsigned_long.h b/zwgc/unsigned_long.h
new file mode 100644
index 0000000..a9a74f1
--- /dev/null
+++ b/zwgc/unsigned_long.h
@@ -0,0 +1,5 @@
+/* $Id$
+ * $Source$
+ */
+
+#define unsigned_long unsigned long
diff --git a/zwgc/variables.c b/zwgc/variables.c
index 2f9f13c..99b18d0 100644
--- a/zwgc/variables.c
+++ b/zwgc/variables.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_variables_c[] = "$Id$";
+static const char rcsid_variables_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -24,8 +26,6 @@ static char rcsid_variables_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <stdio.h>
-#include <ctype.h>
#include "new_memory.h"
#include "notice.h"
#include "string_dictionary_aux.h"
diff --git a/zwgc/xcut.c b/zwgc/xcut.c
index 50893d6..aee164e 100644
--- a/zwgc/xcut.c
+++ b/zwgc/xcut.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_xcut_c[] = "$Id$";
+static const char rcsid_xcut_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -24,13 +26,13 @@ static char rcsid_xcut_c[] = "$Id$";
/* */
/****************************************************************************/
+#ifndef X_DISPLAY_MISSING
+
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include <sys/time.h>
#include "new_memory.h"
#include "new_string.h"
#include "X_gram.h"
-#include <stdio.h>
#include "zwgc.h"
#include "xselect.h"
#include "xmark.h"
@@ -362,3 +364,6 @@ void xcut(dpy,event,desc_context)
XFlush(dpy);
}
+
+#endif
+
diff --git a/zwgc/xerror.c b/zwgc/xerror.c
index 58283a8..d40f986 100644
--- a/zwgc/xerror.c
+++ b/zwgc/xerror.c
@@ -12,14 +12,17 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_xerror_c[] = "$Id$";
+static const char rcsid_xerror_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
+#ifndef X_DISPLAY_MISSING
+
#include <X11/Xlib.h>
-#include <stdio.h>
#include "mux.h"
int xerror_happened;
@@ -46,3 +49,6 @@ void end_xerror_trap(dpy)
XSync(dpy,False);
XSetErrorHandler(NULL);
}
+
+#endif
+
diff --git a/zwgc/xerror.h b/zwgc/xerror.h
index 0e17936..c6e801a 100644
--- a/zwgc/xerror.h
+++ b/zwgc/xerror.h
@@ -16,7 +16,7 @@
#define _XERROR_H_
#if (!defined(lint) && !defined(SABER))
-static char rcsid_xerror_h[] = "$Id$";
+static const char rcsid_xerror_h[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
diff --git a/zwgc/xmark.c b/zwgc/xmark.c
index 7b32a80..a6e68f3 100644
--- a/zwgc/xmark.c
+++ b/zwgc/xmark.c
@@ -18,13 +18,16 @@ static char rcsid_xmark_c[] = "$Id$";
#include <zephyr/mit-copyright.h>
+#include <sysdep.h>
+
+#ifndef X_DISPLAY_MISSING
+
#include <X11/X.h>
#include <X11/Xlib.h>
#include "X_gram.h"
#include "X_fonts.h"
#include "xmark.h"
#include "new_string.h"
-#include <stdio.h>
int markblock[3] = { -1 , -1 , -1 };
int markchar[3] = { -1 , -1 , -1 };
@@ -383,3 +386,6 @@ char *xmarkGetText()
return(text_so_far);
}
+
+#endif /* X_DISPLAY_MISSING */
+
diff --git a/zwgc/xrevstack.c b/zwgc/xrevstack.c
index ae22da7..d594b6e 100644
--- a/zwgc/xrevstack.c
+++ b/zwgc/xrevstack.c
@@ -12,15 +12,18 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_xrevstack_c[] = "$Id$";
+static const char rcsid_xrevstack_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
-#ifdef REVSTACK
+#ifndef X_DISPLAY_MISSING
+
+#ifndef TRUEREVSTACK
#include "X_gram.h"
-#include <stdio.h>
x_gram *bottom_gram = NULL;
x_gram *unlinked = NULL;
@@ -260,3 +263,6 @@ x_gram *gram;
}
#endif /* TRUEREVSTACK */
+
+#endif /* X_DISPLAY_MISSING */
+
diff --git a/zwgc/xselect.c b/zwgc/xselect.c
index 59ed16c..2d12b4b 100644
--- a/zwgc/xselect.c
+++ b/zwgc/xselect.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_xselect_c[] = "$Id$";
+static const char rcsid_xselect_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -21,7 +23,8 @@ static char rcsid_xselect_c[] = "$Id$";
/* xselect.c - ICCCM compliant cut-and-paste */
/* also includes some other ICCCMisms, such as the WM_PROTOCOL handling */
-#include <stdio.h>
+#ifndef X_DISPLAY_MISSING
+
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
@@ -204,3 +207,6 @@ void xselGiveUpOwnership(dpy,w)
ownership_end=ownership_start; /* Is this right? what should I use? */
}
+
+#endif /* X_DISPLAY_MISSING */
+
diff --git a/zwgc/xshow.c b/zwgc/xshow.c
index 402368d..27a9df1 100644
--- a/zwgc/xshow.c
+++ b/zwgc/xshow.c
@@ -12,13 +12,16 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_xshow_c[] = "$Id$";
+static const char rcsid_xshow_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
-#include <stdio.h>
+#ifndef X_DISPLAY_MISSING
+
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
@@ -572,3 +575,6 @@ void x_get_input(dpy)
xhandleevent(dpy, event.xany.window, &event);
}
}
+
+#endif /* X_DISPLAY_MISSING */
+
diff --git a/zwgc/zephyr.c b/zwgc/zephyr.c
index f8d7389..ded5e01 100644
--- a/zwgc/zephyr.c
+++ b/zwgc/zephyr.c
@@ -12,8 +12,10 @@
* "mit-copyright.h".
*/
+#include <sysdep.h>
+
#if (!defined(lint) && !defined(SABER))
-static char rcsid_zephyr_c[] = "$Id$";
+static const char rcsid_zephyr_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -24,7 +26,6 @@ static char rcsid_zephyr_c[] = "$Id$";
/* */
/****************************************************************************/
-#include <stdio.h>
#include <zephyr/zephyr.h>
#include <sys/socket.h>
#include "new_string.h"
@@ -34,6 +35,9 @@ static char rcsid_zephyr_c[] = "$Id$";
#include "subscriptions.h"
#include "variables.h"
#include "pointer.h"
+#ifndef X_DISPLAY_MISSING
+#include "X_driver.h"
+#endif
#ifdef DEBUG
extern int zwgc_debug;
@@ -42,37 +46,6 @@ extern int zwgc_debug;
/*
* Internal Routine:
*
- * char *parse_exposure_level(string text)
- * Effects: Compares text to each of the standard zephyr
- * exposure levels ignoring case. If it matches,
- * returns the corresponding magic constant for
- * use with ZSetLocation. (i.e., returns EXPOSE_OPSTAFF
- * for "opstaff", etc.) If it does not match, returns
- * NULL.
- */
-
-static char *parse_exposure_level(text)
- string text;
-{
- if (!strcasecmp(text, EXPOSE_NONE))
- return (EXPOSE_NONE);
- else if (!strcasecmp(text, EXPOSE_OPSTAFF))
- return (EXPOSE_OPSTAFF);
- else if (!strcasecmp(text, EXPOSE_REALMVIS))
- return (EXPOSE_REALMVIS);
- else if (!strcasecmp(text, EXPOSE_REALMANN))
- return (EXPOSE_REALMANN);
- else if (!strcasecmp(text, EXPOSE_NETVIS))
- return (EXPOSE_NETVIS);
- else if (!strcasecmp(text, EXPOSE_NETANN))
- return (EXPOSE_NETANN);
- else
- return(NULL);
-}
-
-/*
- * Internal Routine:
- *
* string get_zwgc_port_number_filename()
* Effects: Returns the filename that the zwgc port # is/should be
* stored in, based on the user's uid & the environment
@@ -136,6 +109,7 @@ void zephyr_init(notice_handler)
unsigned short port = 0; /* Use any old port */
char *temp;
char *exposure;
+ char *tty = NULL;
FILE *port_file;
/*
@@ -150,7 +124,14 @@ void zephyr_init(notice_handler)
*/
temp = get_zwgc_port_number_filename();
errno = 0;
- port_file = fopen(temp, "w+");
+ port_file = fopen(temp, "r");
+ if (port_file) {
+ fprintf(stderr, "zwgc: windowgram file already exists. If you are\n");
+ fprintf(stderr, "zwgc: not already running zwgc, delete %s\n", temp);
+ fprintf(stderr, "zwgc: and try again.\n");
+ exit(1);
+ }
+ port_file = fopen(temp, "w");
if (port_file) {
fprintf(port_file, "%d\n", port);
fclose(port_file);
@@ -159,6 +140,15 @@ void zephyr_init(notice_handler)
perror("");
}
+ /* Set hostname and tty for locations. If we support X, use the
+ * display string for the tty name. */
+#ifndef X_DISPLAY_MISSING
+ if (dpy)
+ tty = DisplayString(dpy);
+#endif
+ error_code = ZInitLocationInfo(NULL, tty);
+ TRAP( error_code, "while initializing location information" );
+
/*
* Retrieve the user's desired exposure level (from the zephyr variable
* "exposure"), convert it to the proper internal form then
@@ -167,7 +157,7 @@ void zephyr_init(notice_handler)
* EXPOSE_NONE.
*/
if (temp = ZGetVariable("exposure")) {
- if (!(exposure = parse_exposure_level(temp))) {
+ if (!(exposure = ZParseExposureLevel(temp))) {
ERROR2("invalid exposure level %s, using exposure level none instead.\n", temp);
exposure = EXPOSE_NONE;
}
diff --git a/zwgc/zephyr.vars b/zwgc/zephyr.vars.in
index 75a0a72..c1a7fb9 100644
--- a/zwgc/zephyr.vars
+++ b/zwgc/zephyr.vars.in
@@ -20,4 +20,4 @@ exposure = realm-visible
# Initialization programs.
-initprogs = /etc/athena/zinit
+initprogs = @INITPROGS@
diff --git a/zwgc/zwgc.1 b/zwgc/zwgc.1
index 233694e..379b13f 100644
--- a/zwgc/zwgc.1
+++ b/zwgc/zwgc.1
@@ -17,6 +17,14 @@
.el \\*(]X\h@|\\n()Iu+\\n()Ru@\c
.}f
..
+.de }N
+.if \\n()E .br
+.di
+.if "\\n()E"0" .}f
+.if "\\n()E"1" .}1
+.if "\\n()E"2" .}2
+.nr )E 0
+..
' # tagged paragraph (paragraph with hanging label, but no para spacing)
.de TQ
.if !"\\$1"" .nr )I \\$1n
@@ -314,6 +322,9 @@ Returns the value of \fIexpr\fR, converted to upper case.
Returns a string that will be displayed exactly as \fIexpr\fR looks.
Anything which could be mistaken for an environment is quoted.
.TP
+.BI stylestrip (expr)
+Returns \fIexpr\fR with all environments stripped out.
+.TP
.BI zvar (expr)
Returns the value of the zephyr variable \fIexpr\fR,
or the empty
@@ -333,7 +344,7 @@ String concatenation of
.IB expr1 " == " expr2
True if the two expressions are equal, false otherwise.
.TP
-.IB expr " =~ " expr2
+.IB expr1 " =~ " expr2
True if the regular expression pattern
.IR expr2 " matches " expr1.
.TP
@@ -821,15 +832,6 @@ WM_DELETE_WINDOW as contents.
EnableDelete
Secondary value to enable WM_DELETE_WINDOW protocol on zgrams [default False]
.TP
-global
-(logical) If true, zwgc creates a _SGI_DESKS_HINTS property on all zgrams, with
-_SGI_DESKS_ALWAYS_GLOBAL as contents. This results in zgrams appearing
-on all desks in SGI's 4Dwm window manager. Otherwise, zgrams appear and
-remain on whatever desk is in use at the time.
-.TP
-Global
-Secondary value to set _SGI_DESKS_HINTS property on zgrams [default True]
-.TP
minTimeToLive
Primary value which specifies the minimum amount of time (``minimum time to
live'') a WindowGram must be on-screen (in milliseconds) until it can
@@ -1000,7 +1002,14 @@ For an example of X resources, see
The X selection code can highlight the wrong portions of messages
containing formatted text placed with the @center() or @right()
directives.
-
+.PP
+If you are using Kerberos support and get new tickets (using
+``kinit''), you must send a subscription notice to the server (using a
+command such as ``zctl load /dev/null'') or all received Zephyr
+notices will appear to be unauthentic. (If all received Zephyr
+notices appear to be forged, your tickets have probably expired, in
+which case you must get new tickets and then run ``zctl load
+/dev/null''.)
.SH FILES
.TQ 15
$HOME/.zwgc.desc
diff --git a/zwgc/zwgc.desc b/zwgc/zwgc.desc
index 01a2e62..796eaf0 100644
--- a/zwgc/zwgc.desc
+++ b/zwgc/zwgc.desc
@@ -87,14 +87,18 @@ match "WG_CTL_CLASS"
# put
# exit
match "message"
- case $instance
- match "PERSONAL"
- set type = "Personal"
- match "URGENT"
- set type = "Urgent"
- default
+ if (downcase($recipient) == downcase($user)) then
+ case $instance
+ match "PERSONAL"
+ set type = "Personal"
+ match "URGENT"
+ set type = "Urgent"
+ default
+ set type = $instance
+ endcase
+ else
set type = "Instance "+$instance
- endcase
+ endif
fields signature body
if ($body == "") then