xwrits-2.21/README 644 41346 41346 3475 7465621475 7102 XWRITS VERSION 2.21 =================== ABOUT XWRITS ------------ Xwrits was written when my wrists really hurt. They don't any more -- most of the time. Please see the man page (xwrits.1) for more information. The man page is on the Web at . MAKING XWRITS ------------- All you need is an ANSI C compiler, such as gcc, and X11R4/5/6 libraries and includes. Just type `./configure', then `make'. If `./configure' can't find your X includes and libraries, you need to tell it where they are. You do this with the `--x-includes=DIRECTORY' and `--x-libraries=DIRECTORY' options. If `./configure' can't find your C compiler, set the CC environment variable to the right compiler before running configure. `./configure' accepts the usual options. See `INSTALL' for more details. COPYRIGHT --------- Source and pictures copyright 1994-2001 Eddie Kohler: kohler@icir.org and http://www.icir.org/kohler/ This package is distributed under the GNU General Public License, Version 2, or, at your discretion, any later version. The GNU General Public License is available via the Web at . The GPL is designed to allow you to alter and redistribute the package, as long as you do not deny that freedom to others. Xwrits uses the currently-patented GIF file format to store its images. It is, nevertheless, compatible with the GPL, because only GIF writing/compression is patented, not GIF reading. Xwrits is not distributed with, and does not link with, any GIF writing or compression code. BUGS, SUGGESTIONS, ETC. ----------------------- Please write me if you have trouble building or running xwrits, or if you have any suggestions, or if you know some rude finger gestures not listed in `GESTURES'. Again that email address is: kohler@icir.org xwrits-2.21/stamp-h.in 644 41346 41346 12 7465621507 10037 timestamp xwrits-2.21/INSTALL 644 41346 41346 16446 6533415430 7260 Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. xwrits-2.21/Makefile.am 644 41346 41346 5172 7465602241 10240 ## Process this file with automake to produce Makefile.in AUTOMAKE_OPTIONS = no-dependencies foreign check-news bin_PROGRAMS = xwrits noinst_PROGRAMS = giftoc man_MANS = xwrits.1 CFLAGS = @CFLAGS@ @X_CFLAGS@ LDADD = @LIBOBJS@ xwrits_LDADD = $(LDADD) @X_LIBS@ @X_PRE_LIBS@ -lX11 @X_EXT_LIBS@ @X_EXTRA_LIBS@ -lm xwrits_SOURCES = fmalloc.c \ gif.h giffunc.c gifread.c gifx.h gifx.c \ xwrits.h clock.c hands.c lock.c main.c pictures.c rest.c \ schedule.c warning.c giftoc_SOURCES = giftoc.c BUILT_SOURCES = colorpic.c monopic.c xwrits_DEPENDENCIES = @LIBOBJS@ giftoc_DEPENDENCIES = @LIBOBJS@ giffunc.o gifread.o giftoc.o gifx.o: gif.h config.h pictures.o: pictures.c colorpic.c monopic.c clock.o lock.o main.o pictures.o rest.o schedule.o warning.o: xwrits.h config.h COLOR_PIC = color/bars.gif color/lock.gif \ color/clenchl.gif color/spreadl.gif color/fingerl.gif color/restl.gif \ color/okl.gif color/clenchi.gif color/spreadi.gif color/fingeri.gif \ color/resti.gif color/oki.gif color/koreanl.gif color/koreani.gif \ color/germanl.gif color/germani.gif MONO_PIC = mono/barsm.gif mono/lockm.gif \ mono/clenchlm.gif mono/spreadlm.gif mono/fingerlm.gif mono/restlm.gif \ mono/oklm.gif mono/clenchim.gif mono/spreadim.gif mono/fingerim.gif \ mono/restim.gif mono/okim.gif colorpic.c: $(COLOR_PIC) giftoc ./giftoc -makename -dir $(srcdir) $(COLOR_PIC) > $@ monopic.c: $(MONO_PIC) giftoc ./giftoc -makename -dir $(srcdir) $(MONO_PIC) > $@ EXTRA_DIST = GESTURES xwrits.1 logo.gif rpm.spec MOSTLYCLEANFILES = colorpic.c monopic.c dist-hook: @mkdir $(distdir)/color $(distdir)/mono @d=`cd $(distdir)/color; pwd` && cd $(srcdir) && cp -p $(COLOR_PIC) $$d @d=`cd $(distdir)/mono; pwd` && cd $(srcdir) && cp -p $(MONO_PIC) $$d srclinks: for i in fmalloc.c strerror.c ; do \ ln -sf ~/src/edlib/$$i $$i ; done for i in gif.h giffunc.c gifread.c giftoc.c gifx.h gifx.c ; do \ ln -sf ~/src/giflib/$$i $$i ; done versionize: perl -pi -e "s/^\\.ds V.*/.ds V $(VERSION)/;" xwrits.1 perl -pi -e "s/^Version: .*/Version: $(VERSION)/; s/$(PACKAGE)-[\w.]+\.tar\.gz/$(PACKAGE)-$(VERSION).tar.gz/;" rpm.spec rpm: dist buildarch=`rpm --showrc | awk '/^build arch/ { print $$4; }'` ; \ mkdir -p /tmp/rpm-xw/SOURCES /tmp/rpm-xw/RPMS/$$buildarch \ /tmp/rpm-xw/BUILD ; \ echo 'include: /usr/lib/rpm/rpmrc' > /tmp/rpm-xw/rc ; \ echo 'macrofiles: /usr/lib/rpm/macros:/tmp/rpm-xw/macros' >> /tmp/rpm-xw/rc ; \ echo '%_topdir /tmp/rpm-xw' > /tmp/rpm-xw/macros ; \ cp logo.gif $(PACKAGE)-$(VERSION).tar.gz /tmp/rpm-xw/SOURCES ; \ rpm --rcfile /tmp/rpm-xw/rc -bb rpm.spec ; \ cp /tmp/rpm-xw/RPMS/$$buildarch/*.rpm . rm -rf /tmp/rpm-xw .PHONY: srclinks versionize rpm xwrits-2.21/Makefile.in 644 41346 41346 34575 7465621504 10305 # Makefile.in generated automatically by automake 1.4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : CC = @CC@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ X_EXT_LIBS = @X_EXT_LIBS@ AUTOMAKE_OPTIONS = no-dependencies foreign check-news bin_PROGRAMS = xwrits noinst_PROGRAMS = giftoc man_MANS = xwrits.1 CFLAGS = @CFLAGS@ @X_CFLAGS@ LDADD = @LIBOBJS@ xwrits_LDADD = $(LDADD) @X_LIBS@ @X_PRE_LIBS@ -lX11 @X_EXT_LIBS@ @X_EXTRA_LIBS@ -lm xwrits_SOURCES = fmalloc.c gif.h giffunc.c gifread.c gifx.h gifx.c xwrits.h clock.c hands.c lock.c main.c pictures.c rest.c schedule.c warning.c giftoc_SOURCES = giftoc.c BUILT_SOURCES = colorpic.c monopic.c xwrits_DEPENDENCIES = @LIBOBJS@ giftoc_DEPENDENCIES = @LIBOBJS@ COLOR_PIC = color/bars.gif color/lock.gif color/clenchl.gif color/spreadl.gif color/fingerl.gif color/restl.gif color/okl.gif color/clenchi.gif color/spreadi.gif color/fingeri.gif color/resti.gif color/oki.gif color/koreanl.gif color/koreani.gif color/germanl.gif color/germani.gif MONO_PIC = mono/barsm.gif mono/lockm.gif mono/clenchlm.gif mono/spreadlm.gif mono/fingerlm.gif mono/restlm.gif mono/oklm.gif mono/clenchim.gif mono/spreadim.gif mono/fingerim.gif mono/restim.gif mono/okim.gif EXTRA_DIST = GESTURES xwrits.1 logo.gif rpm.spec MOSTLYCLEANFILES = colorpic.c monopic.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ xwrits_OBJECTS = fmalloc.o giffunc.o gifread.o gifx.o clock.o hands.o \ lock.o main.o pictures.o rest.o schedule.o warning.o xwrits_LDFLAGS = giftoc_OBJECTS = giftoc.o giftoc_LDADD = $(LDADD) giftoc_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ man1dir = $(mandir)/man1 MANS = $(man_MANS) NROFF = nroff DIST_COMMON = README ./stamp-h.in INSTALL Makefile.am Makefile.in NEWS \ acconfig.h aclocal.m4 config.h.in configure configure.in install-sh \ missing mkinstalldirs strerror.c DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best SOURCES = $(xwrits_SOURCES) $(giftoc_SOURCES) OBJECTS = $(xwrits_OBJECTS) $(giftoc_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status $(ACLOCAL_M4): configure.in cd $(srcdir) && $(ACLOCAL) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) config.h: stamp-h @if test ! -f $@; then \ rm -f stamp-h; \ $(MAKE) stamp-h; \ else :; fi stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=config.h \ $(SHELL) ./config.status @echo timestamp > stamp-h 2> /dev/null $(srcdir)/config.h.in: $(srcdir)/stamp-h.in @if test ! -f $@; then \ rm -f $(srcdir)/stamp-h.in; \ $(MAKE) $(srcdir)/stamp-h.in; \ else :; fi $(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h cd $(top_srcdir) && $(AUTOHEADER) @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null mostlyclean-hdr: clean-hdr: distclean-hdr: -rm -f config.h maintainer-clean-hdr: mostlyclean-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) distclean-binPROGRAMS: maintainer-clean-binPROGRAMS: install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) list='$(bin_PROGRAMS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done mostlyclean-noinstPROGRAMS: clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) distclean-noinstPROGRAMS: maintainer-clean-noinstPROGRAMS: .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: xwrits: $(xwrits_OBJECTS) $(xwrits_DEPENDENCIES) @rm -f xwrits $(LINK) $(xwrits_LDFLAGS) $(xwrits_OBJECTS) $(xwrits_LDADD) $(LIBS) giftoc: $(giftoc_OBJECTS) $(giftoc_DEPENDENCIES) @rm -f giftoc $(LINK) $(giftoc_LDFLAGS) $(giftoc_OBJECTS) $(giftoc_LDADD) $(LIBS) install-man1: $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done install-man: $(MANS) @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-man1 uninstall-man: @$(NORMAL_UNINSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist -rm -rf $(distdir) GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz mkdir $(distdir)/=build mkdir $(distdir)/=inst dc_install_base=`cd $(distdir)/=inst && pwd`; \ cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) dist -rm -rf $(distdir) @banner="$(distdir).tar.gz is ready for distribution"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ echo "$$dashes" dist: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) dist-all: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) distdir: $(DISTFILES) @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1; \ fi -rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am all-recursive-am: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive install-exec-am: install-binPROGRAMS install-exec: install-exec-am install-data-am: install-man install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall: uninstall-am all-am: Makefile $(PROGRAMS) $(MANS) config.h all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ mostlyclean-noinstPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-hdr clean-binPROGRAMS clean-noinstPROGRAMS \ clean-compile clean-tags clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-hdr distclean-binPROGRAMS \ distclean-noinstPROGRAMS distclean-compile \ distclean-tags distclean-generic clean-am distclean: distclean-am -rm -f config.status maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ maintainer-clean-noinstPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am -rm -f config.status .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile install-man1 uninstall-man1 install-man \ uninstall-man tags mostlyclean-tags distclean-tags clean-tags \ maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ installcheck-am installcheck all-recursive-am install-exec-am \ install-exec install-data-am install-data install-am install \ uninstall-am uninstall all-redirect all-am all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean giffunc.o gifread.o giftoc.o gifx.o: gif.h config.h pictures.o: pictures.c colorpic.c monopic.c clock.o lock.o main.o pictures.o rest.o schedule.o warning.o: xwrits.h config.h colorpic.c: $(COLOR_PIC) giftoc ./giftoc -makename -dir $(srcdir) $(COLOR_PIC) > $@ monopic.c: $(MONO_PIC) giftoc ./giftoc -makename -dir $(srcdir) $(MONO_PIC) > $@ dist-hook: @mkdir $(distdir)/color $(distdir)/mono @d=`cd $(distdir)/color; pwd` && cd $(srcdir) && cp -p $(COLOR_PIC) $$d @d=`cd $(distdir)/mono; pwd` && cd $(srcdir) && cp -p $(MONO_PIC) $$d srclinks: for i in fmalloc.c strerror.c ; do \ ln -sf ~/src/edlib/$$i $$i ; done for i in gif.h giffunc.c gifread.c giftoc.c gifx.h gifx.c ; do \ ln -sf ~/src/giflib/$$i $$i ; done versionize: perl -pi -e "s/^\\.ds V.*/.ds V $(VERSION)/;" xwrits.1 perl -pi -e "s/^Version: .*/Version: $(VERSION)/; s/$(PACKAGE)-[\w.]+\.tar\.gz/$(PACKAGE)-$(VERSION).tar.gz/;" rpm.spec rpm: dist buildarch=`rpm --showrc | awk '/^build arch/ { print $$4; }'` ; \ mkdir -p /tmp/rpm-xw/SOURCES /tmp/rpm-xw/RPMS/$$buildarch \ /tmp/rpm-xw/BUILD ; \ echo 'include: /usr/lib/rpm/rpmrc' > /tmp/rpm-xw/rc ; \ echo 'macrofiles: /usr/lib/rpm/macros:/tmp/rpm-xw/macros' >> /tmp/rpm-xw/rc ; \ echo '%_topdir /tmp/rpm-xw' > /tmp/rpm-xw/macros ; \ cp logo.gif $(PACKAGE)-$(VERSION).tar.gz /tmp/rpm-xw/SOURCES ; \ rpm --rcfile /tmp/rpm-xw/rc -bb rpm.spec ; \ cp /tmp/rpm-xw/RPMS/$$buildarch/*.rpm . rm -rf /tmp/rpm-xw .PHONY: srclinks versionize rpm # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xwrits-2.21/NEWS 644 41346 41346 31443 7465621461 6730 Xwrits NEWS Version 2.21 6.May.2002 * Add support for Xinerama. Requested by Orion Hodson . Version 2.20 17.Apr.2002 * Add `title' option. Suggested, and patch provided, by Dale Thatcher . * Finally fix `--multiscreen' option. Thanks to Orion Hodson for lending his multihead machine. Version 2.19 8.Feb.2002 * The escalation "clock" corresponding to `after=TIME' options proceeds even after you cancel a break by deleting all the xwrits windows. Therefore, you can no longer prevent escalation by deleting xwrits windows with your window manager. * Locking code works with large `lock-picture's. Reported by Carlos O'Donell Jr. . * Add `bars-picture' option. If you specify your own `lock-picture', then `bars-picture' defaults to a black screen. Say `bars-picture="&bars"' to get the old behavior. * Add `+verbose' option for debugging. * Xwrits checks whether other clients pay attention to KeyRelease events, as well as KeyPress events. This may improve its interaction with certain window managers. For example, xwrits seemed to come up less frequently than it should when I was using KDE. * `--multiscreen' still doesn't seem to work, but I don't know why. Version 2.18 21.Dec.2001 * Fix `--multiscreen' option. Reported by Jamie Zawinski . Version 2.17 18.Dec.2001 * Add `--multiscreen' option. Requested by Jamie Zawinski . Version 2.16 23.Aug.2001 * Choose font more carefully, to avoid null pointer dereferences. Problem reported by Sharif Nassar . Version 2.15 18.Apr.2001 * Xwrits processes play nicely with one another. For example, two xwrits processes with `+top' no longer fight each other to get to the top of the window stack; and xwrits processes inform one another when you click on a window to take a break. Requested by Thomer M. Gil , who runs two xwrits processes at once: one for microbreaks, one for longer breaks. Version 2.14 15.Feb.2001 * Fixed new crash when `+lock' and `+breakclock' were both supplied. Reported by Chris Keane . * Fixed time-adjusting code when the system clock jumps backwards: Do not use the remaining-timeout value to calculate how much the system clock has changed. The symptom was that xwrits windows would stop animating if the system clock jumped backwards (even by a little bit). Version 2.13 11.Feb.2001 * Documented multiple `breaktime' specifications. This lets you, for example, make a break longer depending on how long you waited to take it. See the ESCALATION section of the manual page. These were added in an earlier version, but never documented. * The escalation "clock" corresponding to `after=TIME' options proceeds even while xwrits thinks you're resting. Therefore, you can no longer prevent escalation by clicking on the xwrits window (making it think you're resting) and then typing some more. Requested by Conrad Hughes . * Bug fix: The `breakclock' always counts down from the end of the break. Previously, it counted back from a random time when `+mouse' was true. Reported by Tijn Porcelijn . * Hopefully fixed bugs that were causing xwrits to crash on Chris Keane . * Bug fix: Erasing messages on the lock screen didn't completely work if the hand picture was in the way. This resulted in unreadable displays. Fixed. * Hopefully fixed bugs that caused animation to stop sometimes. * The lock screen now shows how many characters of your unlock password you've typed. Version 2.12 14.Nov.2000 * Changed Alarm structure into a doubly linked list. May improve performance when there are many xwrits windows. Version 2.11 29.Jan.2000 * Fixed bug: destroying xwrits windows with the window manager could corrupt memory and eventually cause a crash. Reported by Anders Melchiorsen . Version 2.10 5.Jan.2000 * Xwrits can simultaneously monitor multiple displays (and report problems on all of them). Just give the `display' option multiple times. * Added `lock-picture' option. * Fixed bug: default `canceltime' could be longer than `typetime'. * Fixed bug: sometimes the warning window picture would stop being animated. Version 2.9 30.Dec.1999 * `german' is now its own beast: an animated gesture suggested by Andreas Stenger . * When `+quota' is on and you take a quota break, xwrits lengthens your typing time by that amount, as well as shortening your break time by that amount. Now a break cycle -- the time from when one break is over, until when the next break is over -- is the same length of time (typetime plus breaktime) whether or not `+quota' is in use. Suggested by Justin Wells . * Added `minbreaktime' for use with `+quota'. It defaults to half the break length or the quota time, whichever is longer. Suggested by Justin Wells . * Added `canceltime' option. This is the amount of time that you are allowed to type if you cancel a break (by deleting all xwrits windows with the window manager). Suggested, again, by Justin Wells . * Made GIF records read-only. This should result in slightly better memory performance in all cases, and especially for people running more than one xwrits at once. Version 2.9b1 10.Aug.1999 * Added `+quota' option. With `+quota=TIME' on, if you leave your workstation idle for more than TIME, xwrits will subtract that idle time from the length of the next break. Requested by Justin Wells . * Xwrits always monitors your key presses, even with `-idle'. Sort of requested by Malcolm Ross Kinsella Ryan . * Changed semantics of `+idle=IDLETIME'. Now the IDLETIME argument is the amount of time that must pass before an idle period is treated like a break. Something like this was requested by Peter Boult . * Pressing the mouse button on an xwrits window counts as a key press. * Thickened index finger on `+finger=korean' picture. * Added `german', `japanese', and `russian' as synonyms for `+finger=korean'. Version 2.8 9.Aug.1999 * Added the `+cheat' option to allow limited cheating during a break. * Extended `+finger' to `+finger=CULTURE', and included a rude Korean gesture (`+finger=korean'). * You can set the mouse motion detector's sensitivity with `+mouse[=SENSITIVITY]'. Default sensitivity has been raised to 15 pixels. Requested by Radoslaw Stachowiak . * Changed the way times are parsed for consistency. Now a fractional number like `2.5' means 2.5 minutes, not 2.5 seconds. You can still get 2.5 seconds with `:2.5'. A clarification of the time situation was originally requested by Sam Ockman . * Fixed bugs in `+multiply': iconifying a multiplied warning window would cause a crash, and new warning windows wouldn't have clocks attached. * Fixed bugs in picture loading code: multiple `flashtime' options had no effect since 2.8b1. Version 2.8b2 4.Aug.1999 * Xwrits can finally monitor your mouse movements with the `+mouse' option. I've been meaning to implement this feature for years. It has been requested by Radoslaw Stachowiak , Justin Wells , Chris Brand , Mark Lewis , Alex Westner , Peter Boult , Malcolm Ross Kinsella Ryan , Sam Ockman , and possibly others. * You can specify your own GIF pictures or animations for the warning, resting, and ready windows with the `--warning-picture', `--rest-picture', and `--ready-picture' options. I've been meaning to implement this feature for a while, too. Tom Murphy also requested it. * Various code cleanups and some bug fixes. Version 2.8b1 3.Aug.1999 * Fixed bugs related to the count of how many hands were actively visible. This surfaced in several ways: too few multiplied windows, deleting xwrits windows could cause a segmentation fault, and so forth. Bug reported by Darko Marinov . * Different `+top' behavior: now warning windows look at the window stacking order and try to keep themselves on top. * Simplified clock drawing mechanism. * Updated GIF library to 0.9999. Version 2.7.3 28.Dec.1998 * Updated GIF library to 0.99; moved to config.h-based configuration. * Use the failing-malloc library to avoid problems with some systems' bad realloc() definitions. Version 2.7.2 16.Dec.1998 * Another bug fix in code for adjusting break length (sometimes it wouldn't notice that a break should be over, and would incorrectly start flashing when you typed). * Finally, real `--help'! Version 2.7.1 9.Dec.1998 * Fixed bug where breaks would often be dramatically shortened for no good reason. (The problem: there were several static variables named last_key_time, instead of one global variable.) Version 2.7 7.Dec.1998 * Xwrits will adjust the length it wants you to rest depending on how long it's been since you last typed. Bug reported by A.T. Hofkamp . * Xwrits now behaves robustly when the system time is adjusted backwards. * The xwrits package now uses automake. Version 2.6.5 6.Oct.1998 * Makefiles: Fixed vpath builds and problems with old `make's (makes which didn't support $< in explicit rules). Version 2.6.4 26.Sep.1998 * Added `--help' (well, `help') to conform to GNU program behavior standards. * Makefiles: Added `make uninstall' target, enabled `./configure's program name transformations, made VPATH builds possible. Version 2.6.3 7.Sep.1998 * No user-visible changes (fixed configuration bugs and renamed some variables). Version 2.6.2 17.Aug.1998 * Bug fix: If `idle' was off, the warning window would never appear (it was waiting for a key press -- stupid, since it wasn't listening for any key presses). Bug reported by Malcolm Ross Kinsella Ryan . Version 2.6.1 8.Jun.1998 * Fixed the clock, which will now disappear properly instead of leaving a black square (even in mono). Version 2.6 29.May.1998 * Made and included pictures for monochromatic screens and added `mono' option. * Bug fixes for `lock', `clock' and `breakclock'. * Restored the time argument to `idle'. Version 2.6b8 27.May.1998 * Added support for --long-options and --version. * Fixed race condition in schedule.c, which could result in losing keystrokes. Bug reported by Gregory Galperin . Version 2.6b7 23.May.1998 * Clock improvements: fixed problem with black-on-black clock on 24-plane displays (it had to do with visual selection: WhitePixel wasn't white since the Visual was not the default). Also improved clock appearance and made it appear more like when it's supposed to. Bug reported by Erez Zadok . Version 2.6b6 5.May.1998 * Improved the configure script to use for u_int32_t, etc. when possible. * Fixed bug in gifx.c: on a 24-plane display, any picture came out all black. (The problem: implementation-specific behavior of <<; specifically, I expected 1<<32 == 0 for 32-bit ints.) Bug reported by Alexander Konstantinou and Matthew Lewis . * Added visual searching: xwrits will now use a TrueColor visual if available. Version 2.6b4 5.May.1998 * Updated GIF library to 0.9, the version used in Gifsicle. This has temporarily broken support for monochrome displays, but will hopefully fix other bugs some people have experienced. Version 2.6b3 24.Nov.1997 * Fixed installation and improved the configure script. Version 2.6b2 * Fixed bug with freeing memory multiple times. Works better on Linux now. Thanks to Albert L. Ting for a patch. Version 2.5 13.Nov.1995 * The most important change is the +idle option, on by default, which makes xwrits slightly smarter than an alarm clock. The code has also been completely reorganized around the Alarm concept, which makes it much cleaner. Version 2 * Many, many more options have been added. The code has been cleaned up a great deal, and also expanded a great deal. Comments should still be added to the code. * Xwrits no longer uses XPM files. Instead, it uses GIF files, with some proprietary extensions. The GIF files are compiled into C files, then object files, and read from memory. This makes xwrits a much, much smaller executable, faster, and more portable. Version 1 Summer 1994 * Original distribution. xwrits-2.21/acconfig.h 644 41346 41346 2041 7465601711 10117 /* Process this file with autoheader to produce config.h.in */ #ifndef CONFIG_H #define CONFIG_H /* How many arguments does gettimeofday() take? */ #undef GETTIMEOFDAY_PROTO /* Get the [u]int*_t typedefs */ #undef NEED_SYS_TYPES_H #ifdef NEED_SYS_TYPES_H # include #endif #undef HAVE_INTTYPES_H #ifdef HAVE_INTTYPES_H # include #endif #undef uint16_t #undef uint32_t #undef int32_t @TOP@ @BOTTOM@ /* Define if Xinerama is available. */ #undef HAVE_XINERAMA #ifdef __cplusplus extern "C" { #endif /* Use the clean-failing malloc library in fmalloc.c */ #include #define xmalloc(s) fail_die_malloc((s),__FILE__,__LINE__) #define xrealloc(p,s) fail_die_realloc((p),(s),__FILE__,__LINE__) #define xfree free void *fail_die_malloc(size_t, const char *, int); void *fail_die_realloc(void *, size_t, const char *, int); /* Prototype strerror() if we don't have it. */ #ifndef HAVE_STRERROR char *strerror(int errno); #endif #ifdef __cplusplus } /* Get rid of inline macro under C++ */ # undef inline #endif #endif xwrits-2.21/aclocal.m4 644 41346 41346 10454 7465621504 10066 dnl aclocal.m4 generated automatically by aclocal 1.4 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 1 dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN(AM_INIT_AUTOMAKE, [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] AC_SUBST(VERSION) dnl test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) # # Check to make sure that the build environment is sane. # AC_DEFUN(AM_SANITY_CHECK, [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "[$]*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "[$]*" != "X $srcdir/configure conftestfile" \ && test "[$]*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "[$]2" = conftestfile ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi rm -f conftest* AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. AC_DEFUN(AM_MISSING_PROG, [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if ($2 --version) < /dev/null > /dev/null 2>&1; then $1=$2 AC_MSG_RESULT(found) else $1="$3/missing $2" AC_MSG_RESULT(missing) fi AC_SUBST($1)]) # Like AC_CONFIG_HEADER, but automatically create stamp file. AC_DEFUN(AM_CONFIG_HEADER, [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. dnl This file resides in the same directory as the config header dnl that is generated. We must strip everything past the first ":", dnl and everything past the last "/". AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, <>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, <>; do case " <<$>>CONFIG_HEADERS " in *" <<$>>am_file "*<<)>> echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx ;; esac am_indx=`expr "<<$>>am_indx" + 1` done<<>>dnl>>) changequote([,]))]) xwrits-2.21/config.h.in 644 41346 41346 3077 7465601720 10232 /* config.h.in. Generated automatically from configure.in by autoheader. */ /* Process this file with autoheader to produce config.h.in */ #ifndef CONFIG_H #define CONFIG_H /* How many arguments does gettimeofday() take? */ #undef GETTIMEOFDAY_PROTO /* Get the [u]int*_t typedefs */ #undef NEED_SYS_TYPES_H #ifdef NEED_SYS_TYPES_H # include #endif #undef HAVE_INTTYPES_H #ifdef HAVE_INTTYPES_H # include #endif #undef uint16_t #undef uint32_t #undef int32_t /* Define to empty if the keyword does not work. */ #undef const /* Define as __inline if that's what the C compiler calls it. */ #undef inline /* Define if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Define if you have the strerror function. */ #undef HAVE_STRERROR /* Define if you have the header file. */ #undef HAVE_INTTYPES_H /* Name of package */ #undef PACKAGE /* Version number of package */ #undef VERSION /* Define if Xinerama is available. */ #undef HAVE_XINERAMA #ifdef __cplusplus extern "C" { #endif /* Use the clean-failing malloc library in fmalloc.c */ #include #define xmalloc(s) fail_die_malloc((s),__FILE__,__LINE__) #define xrealloc(p,s) fail_die_realloc((p),(s),__FILE__,__LINE__) #define xfree free void *fail_die_malloc(size_t, const char *, int); void *fail_die_realloc(void *, size_t, const char *, int); /* Prototype strerror() if we don't have it. */ #ifndef HAVE_STRERROR char *strerror(int errno); #endif #ifdef __cplusplus } /* Get rid of inline macro under C++ */ # undef inline #endif #endif xwrits-2.21/configure 755 41346 41346 251442 7465621504 10161 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --enable-warnings compile with -Wall" ac_help="$ac_help --with-x use the X Window System" # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=xwrits.h # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:560: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 echo "configure:613: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "$*" != "X $srcdir/configure conftestfile" \ && test "$*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { echo "configure: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" 1>&2; exit 1; } fi test "$2" = conftestfile ) then # Ok. : else { echo "configure: error: newly created file is older than distributed files! Check your system clock" 1>&2; exit 1; } fi rm -f conftest* echo "$ac_t""yes" 1>&6 if test "$program_transform_name" = s,x,x,; then program_transform_name= else # Double any \ or $. echo might interpret backslashes. cat <<\EOF_SED > conftestsed s,\\,\\\\,g; s,\$,$$,g EOF_SED program_transform_name="`echo $program_transform_name|sed -f conftestsed`" rm -f conftestsed fi test "$program_prefix" != NONE && program_transform_name="s,^,${program_prefix},; $program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" # sed with no file args requires a program. test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo "configure:670: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftestmake <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftestmake fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$ac_t""yes" 1>&6 SET_MAKE= else echo "$ac_t""no" 1>&6 SET_MAKE="MAKE=${MAKE-make}" fi PACKAGE=xwrits VERSION=2.21 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } fi cat >> confdefs.h <> confdefs.h <&6 echo "configure:716: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (aclocal --version) < /dev/null > /dev/null 2>&1; then ACLOCAL=aclocal echo "$ac_t""found" 1>&6 else ACLOCAL="$missing_dir/missing aclocal" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 echo "configure:729: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoconf --version) < /dev/null > /dev/null 2>&1; then AUTOCONF=autoconf echo "$ac_t""found" 1>&6 else AUTOCONF="$missing_dir/missing autoconf" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 echo "configure:742: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (automake --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake echo "$ac_t""found" 1>&6 else AUTOMAKE="$missing_dir/missing automake" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 echo "configure:755: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoheader --version) < /dev/null > /dev/null 2>&1; then AUTOHEADER=autoheader echo "$ac_t""found" 1>&6 else AUTOHEADER="$missing_dir/missing autoheader" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 echo "configure:768: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (makeinfo --version) < /dev/null > /dev/null 2>&1; then MAKEINFO=makeinfo echo "$ac_t""found" 1>&6 else MAKEINFO="$missing_dir/missing makeinfo" echo "$ac_t""missing" 1>&6 fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:788: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:818: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:869: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:901: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 912 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:943: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:948: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:976: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo $ac_n "checking for working const""... $ac_c" 1>&6 echo "configure:1008: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } ; return 0; } EOF if { (eval echo configure:1062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF #define const EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 echo "configure:1083: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* done fi echo "$ac_t""$ac_cv_c_inline" 1>&6 case "$ac_cv_c_inline" in inline | yes) ;; no) cat >> confdefs.h <<\EOF #define inline EOF ;; *) cat >> confdefs.h <&6 echo "configure:1133: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1154: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1171: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1188: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 # If we find X, set shell vars x_includes and x_libraries to the # paths, otherwise set no_x=yes. # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 echo "configure:1217: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" : fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=NO ac_x_libraries=NO rm -fr conftestdir if mkdir conftestdir; then cd conftestdir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat > Imakefile <<'EOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' EOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case "$ac_im_incroot" in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; esac case "$ac_im_usrlibdir" in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; esac fi cd .. rm -fr conftestdir fi if test "$ac_x_includes" = NO; then # Guess where to find include files, by looking for this one X11 .h file. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* # We can compile using X headers with no special include directory. ac_x_includes= else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Look for the header file in a standard set of common directories. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/$x_direct_test_include"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest* fi # $ac_x_includes = NO if test "$ac_x_libraries" = NO; then # Check for the libraries. test -z "$x_direct_test_library" && x_direct_test_library=Xt test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. ac_x_libraries= else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest* fi # $ac_x_libraries = NO if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$ac_t""$have_x" 1>&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >> confdefs.h <<\EOF #define X_DISPLAY_MISSING 1 EOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 echo "configure:1466: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_R_nospace=no fi rm -f conftest* if test $ac_R_nospace = yes; then echo "$ac_t""no" 1>&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_R_space=no fi rm -f conftest* if test $ac_R_space = yes; then echo "$ac_t""yes" 1>&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$ac_t""neither works" 1>&6 fi fi LIBS="$ac_xsave_LIBS" esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 echo "configure:1531: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" else echo "$ac_t""no" 1>&6 fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 echo "configure:1572: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" else echo "$ac_t""no" 1>&6 fi fi # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 echo "configure:1620: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else gethostbyname(); #endif ; return 0; } EOF if { (eval echo configure:1648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_gethostbyname=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 echo "configure:1669: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" else echo "$ac_t""no" 1>&6 fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says simon@lia.di.epfl.ch: it contains # gethostby* variants that don't use the nameserver (or something). # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 echo "configure:1718: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else connect(); #endif ; return 0; } EOF if { (eval echo configure:1746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_connect=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 echo "configure:1767: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" else echo "$ac_t""no" 1>&6 fi fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 echo "configure:1810: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else remove(); #endif ; return 0; } EOF if { (eval echo configure:1838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_remove=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 echo "configure:1859: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" else echo "$ac_t""no" 1>&6 fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 echo "configure:1902: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else shmat(); #endif ; return 0; } EOF if { (eval echo configure:1930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_shmat=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 echo "configure:1951: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" else echo "$ac_t""no" 1>&6 fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS="$LDFLAGS" test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 echo "configure:2003: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" else echo "$ac_t""no" 1>&6 fi LDFLAGS="$ac_save_LDFLAGS" fi save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/Xinerama.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/Xinerama.h""... $ac_c" 1>&6 echo "configure:2052: checking for X11/extensions/Xinerama.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:2062: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_xinerama_header=y else echo "$ac_t""no" 1>&6 ac_xinerama_header=n fi if test "${ac_xinerama_header}" = y; then echo $ac_n "checking for XineramaQueryScreens in -lXinerama""... $ac_c" 1>&6 echo "configure:2086: checking for XineramaQueryScreens in -lXinerama" >&5 ac_lib_var=`echo Xinerama'_'XineramaQueryScreens | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lXinerama ${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_xinerama_lib=y else echo "$ac_t""no" 1>&6 ac_xinerama_lib= fi if test "${ac_xinerama_lib}" = y; then X_EXT_LIBS="-lXext -lXinerama" cat >> confdefs.h <<\EOF #define HAVE_XINERAMA 1 EOF fi fi CPPFLAGS="$save_cppflags" for ac_func in strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2141: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:2169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" fi done echo $ac_n "checking for gettimeofday prototype""... $ac_c" 1>&6 echo "configure:2198: checking for gettimeofday prototype" >&5 if eval "test \"`echo '$''{'ac_cv_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include int main() { gettimeofday((void *)0, (void *)0); ; return 0; } EOF if { (eval echo configure:2211: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat > conftest.$ac_ext < #include int main() { gettimeofday((void *)0); ; return 0; } EOF if { (eval echo configure:2222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_gettimeofday=0 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_gettimeofday=2 fi rm -f conftest* else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_gettimeofday=1 fi rm -f conftest* fi echo "$ac_t""$ac_cv_gettimeofday" 1>&6 cat >> confdefs.h <&6 echo "configure:2252: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:2262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done echo $ac_n "checking for integer typedefs""... $ac_c" 1>&6 echo "configure:2290: checking for integer typedefs" >&5 if eval "test \"`echo '$''{'ac_cv_int_types'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "uint32_t" >/dev/null 2>&1; then rm -rf conftest* ac_cv_int_types=yes else rm -rf conftest* cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "u_int32_t" >/dev/null 2>&1; then rm -rf conftest* ac_cv_int_types=close else rm -rf conftest* ac_cv_int_types=no fi rm -f conftest* fi rm -f conftest* fi echo "$ac_t""$ac_cv_int_types" 1>&6 if test "$ac_cv_int_types" = no ; then # Define our own versions echo $ac_n "checking for a 16-bit value""... $ac_c" 1>&6 echo "configure:2331: checking for a 16-bit value" >&5 if eval "test \"`echo '$''{'ac_cv_int16'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_int16=short else cat > conftest.$ac_ext < #include int main(int argc, char **argv) { FILE *f = fopen("conftestval", "w"); if (!f) exit(1); if (sizeof(short) == 2) fprintf(f, "short\n"); else exit(1); fclose(f); exit(0); } EOF if { (eval echo configure:2352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_int16=`cat conftestval` else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* { echo "configure: error: no 16-bit value found" 1>&2; exit 1; } fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_int16" 1>&6 echo $ac_n "checking for a 32-bit value""... $ac_c" 1>&6 echo "configure:2369: checking for a 32-bit value" >&5 if eval "test \"`echo '$''{'ac_cv_int32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_int32=int else cat > conftest.$ac_ext < #include int main(int argc, char **argv) { FILE *f = fopen("conftestval", "w"); if (!f) exit(1); if (sizeof(int) == 4) fprintf(f, "int\n"); else if (sizeof(long) == 4) fprintf(f, "long\n"); else exit(1); fclose(f); exit(0); } EOF if { (eval echo configure:2391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_int32=`cat conftestval` else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* { echo "configure: error: no 32-bit value found" 1>&2; exit 1; } fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_int32" 1>&6 fi if test "$ac_cv_header_inttypes_h" = yes; then : elif test "$ac_cv_int_types" = no; then cat >> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <<\EOF #define NEED_SYS_TYPES_H 1 EOF cat >> confdefs.h <<\EOF #define uint16_t u_int16_t EOF cat >> confdefs.h <<\EOF #define uint32_t u_int32_t EOF else cat >> confdefs.h <<\EOF #define NEED_SYS_TYPES_H 1 EOF fi trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@PACKAGE@%$PACKAGE%g s%@VERSION@%$VERSION%g s%@ACLOCAL@%$ACLOCAL%g s%@AUTOCONF@%$AUTOCONF%g s%@AUTOMAKE@%$AUTOMAKE%g s%@AUTOHEADER@%$AUTOHEADER%g s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g s%@CPP@%$CPP%g s%@X_CFLAGS@%$X_CFLAGS%g s%@X_PRE_LIBS@%$X_PRE_LIBS%g s%@X_LIBS@%$X_LIBS%g s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g s%@X_EXT_LIBS@%$X_EXT_LIBS%g s%@LIBOBJS@%$LIBOBJS%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 xwrits-2.21/configure.in 644 41346 41346 5517 7465621472 10527 dnl Process this file with autoconf to produce a configure script. AC_INIT(xwrits.h) AM_INIT_AUTOMAKE(xwrits, 2.21) AM_CONFIG_HEADER(config.h) AC_PROG_CC AC_C_CONST AC_C_INLINE AC_ARG_ENABLE(warnings, [ --enable-warnings compile with -Wall], if test "$enableval" = yes ; then CC="$CC -Wall" fi) AC_PATH_XTRA dnl dnl Xinerama extension? dnl save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" AC_CHECK_HEADER(X11/extensions/Xinerama.h, ac_xinerama_header=y, ac_xinerama_header=n) if test "${ac_xinerama_header}" = y; then AC_CHECK_LIB(Xinerama, XineramaQueryScreens, ac_xinerama_lib=y, ac_xinerama_lib=, ${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext) if test "${ac_xinerama_lib}" = y; then X_EXT_LIBS="-lXext -lXinerama" AC_SUBST(X_EXT_LIBS) AC_DEFINE(HAVE_XINERAMA) fi fi CPPFLAGS="$save_cppflags" dnl dnl strerror()? dnl AC_REPLACE_FUNCS(strerror) dnl dnl gettimeofday() dnl AC_CACHE_CHECK(for gettimeofday prototype, ac_cv_gettimeofday, [AC_TRY_COMPILE([#include #include ], [gettimeofday((void *)0, (void *)0);], [AC_TRY_COMPILE([#include #include ], [gettimeofday((void *)0);], ac_cv_gettimeofday=0, ac_cv_gettimeofday=2)], ac_cv_gettimeofday=1)]) AC_DEFINE_UNQUOTED(GETTIMEOFDAY_PROTO, $ac_cv_gettimeofday) dnl dnl Integer typedefs dnl AC_CHECK_HEADERS(inttypes.h) AC_CACHE_CHECK(for integer typedefs, ac_cv_int_types, [AC_EGREP_HEADER(uint32_t, sys/types.h, ac_cv_int_types=yes, AC_EGREP_HEADER(u_int32_t, sys/types.h, ac_cv_int_types=close, ac_cv_int_types=no))]) if test "$ac_cv_int_types" = no ; then # Define our own versions AC_CACHE_CHECK(for a 16-bit value, ac_cv_int16, [AC_TRY_RUN([#include #include int main(int argc, char **argv) { FILE *f = fopen("conftestval", "w"); if (!f) exit(1); if (sizeof(short) == 2) fprintf(f, "short\n"); else exit(1); fclose(f); exit(0); }], ac_cv_int16=`cat conftestval`, AC_MSG_ERROR(no 16-bit value found), ac_cv_int16=short)]) AC_CACHE_CHECK(for a 32-bit value, ac_cv_int32, [AC_TRY_RUN([#include #include int main(int argc, char **argv) { FILE *f = fopen("conftestval", "w"); if (!f) exit(1); if (sizeof(int) == 4) fprintf(f, "int\n"); else if (sizeof(long) == 4) fprintf(f, "long\n"); else exit(1); fclose(f); exit(0); }], ac_cv_int32=`cat conftestval`, AC_MSG_ERROR(no 32-bit value found), ac_cv_int32=int)]) fi if test "$ac_cv_header_inttypes_h" = yes; then : elif test "$ac_cv_int_types" = no; then AC_DEFINE_UNQUOTED(uint16_t, unsigned $ac_cv_int16) AC_DEFINE_UNQUOTED(uint32_t, unsigned $ac_cv_int32) AC_DEFINE_UNQUOTED(int32_t, $ac_cv_int32) elif test "$ac_cv_int_types" = close; then AC_DEFINE(NEED_SYS_TYPES_H) AC_DEFINE(uint16_t, u_int16_t) AC_DEFINE(uint32_t, u_int32_t) else AC_DEFINE(NEED_SYS_TYPES_H) fi dnl dnl Output dnl AC_OUTPUT(Makefile) xwrits-2.21/install-sh 555 0 0 12736 7237636510 7771 #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 xwrits-2.21/missing 555 0 0 14213 7237636510 7354 #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Franc,ois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing - GNU libit 0.0" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 xwrits-2.21/mkinstalldirs 555 0 0 1322 7237636510 10540 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here xwrits-2.21/strerror.c 644 41346 41346 716 6644170661 10215 /* Some operating systems don't have strerror. This file provides a definition which David Mazieres assures me works. */ #ifdef HAVE_CONFIG_H # include #endif #ifdef __cplusplus extern "C" { #endif char * strerror(int errno) { extern int sys_nerr; extern char *sys_errlist[]; if (errno < 0 || errno >= sys_nerr) return (char *)"bad error number"; else return sys_errlist[errno]; } #ifdef __cplusplus } #endif xwrits-2.21/fmalloc.c 644 41346 41346 1347 6646723535 7777 #ifdef HAVE_CONFIG_H # include #endif #include #include #ifdef __cplusplus extern "C" { #endif static void fail_die_malloc_die(size_t size, const char *file, int line) { fprintf(stderr, "Out of memory! (wanted %lu at %s:%d)\n", (unsigned long)size, file, line); exit(1); } void * fail_die_malloc(size_t size, const char *file, int line) { void *p = malloc(size); if (!p && size) fail_die_malloc_die(size, file, line); return p; } void * fail_die_realloc(void *p, size_t size, const char *file, int line) { if (!p) return fail_die_malloc(size, file, line); p = realloc(p, size); if (!p && size) fail_die_malloc_die(size, file, line); return p; } #ifdef __cplusplus } #endif xwrits-2.21/gif.h 644 41346 41346 17004 7346305050 7133 /* gif.h - Interface to the GIF library. Copyright (C) 1997-2001 Eddie Kohler, eddietwo@lcs.mit.edu This file is part of the GIF library. The GIF library is free software*. It is distributed under the GNU General Public License, version 2 or later; you can copy, distribute, or alter it at will, as long as this notice is kept intact and this source code is made available. There is no warranty, express or implied. *There is a patent on the LZW compression method used by GIFs, and included in gifwrite.c. Unisys, the patent holder, allows the compression algorithm to be used without a license in software distributed at no cost to the user. The decompression algorithm is not patented. */ #ifndef GIF_H /* -*- mode: c -*- */ #define GIF_H #include #include #ifdef __cplusplus extern "C" { #endif /* NOTE: You should define the types uint16_t and uint32_t before #including this file, probably by #including . */ #define GIF_MAJOR_VERSION 1 #define GIF_MINOR_VERSION 3 #define GIF_VERSION "1.3" #ifndef BYTE #define BYTE typedef unsigned char byte; #endif typedef struct Gif_Stream Gif_Stream; typedef struct Gif_Image Gif_Image; typedef struct Gif_Colormap Gif_Colormap; typedef struct Gif_Comment Gif_Comment; typedef struct Gif_Extension Gif_Extension; typedef struct Gif_Record Gif_Record; /** GIF_STREAM **/ struct Gif_Stream { Gif_Colormap *global; byte background; uint16_t screen_width; uint16_t screen_height; long loopcount; /* -1 means no loop count */ Gif_Comment *comment; Gif_Image **images; int nimages; int imagescap; Gif_Extension *extensions; unsigned errors; int userflags; int refcount; }; Gif_Stream * Gif_NewStream(void); void Gif_DeleteStream(Gif_Stream *); Gif_Stream * Gif_CopyStreamSkeleton(Gif_Stream *); Gif_Stream * Gif_CopyStreamImages(Gif_Stream *); #define Gif_ScreenWidth(gfs) ((gfs)->screen_width) #define Gif_ScreenHeight(gfs) ((gfs)->screen_height) #define Gif_ImageCount(gfs) ((gfs)->nimages) void Gif_CalculateScreenSize(Gif_Stream *, int force); int Gif_Unoptimize(Gif_Stream *); /** GIF_IMAGE **/ struct Gif_Image { char *identifier; Gif_Comment *comment; Gif_Colormap *local; short transparent; /* -1 means no transparent index */ uint16_t delay; byte disposal; uint16_t left; uint16_t top; uint16_t width; uint16_t height; byte interlace; byte **img; /* img[y][x] == image byte (x,y) */ byte *image_data; void (*free_image_data)(void *); uint32_t compressed_len; byte *compressed; void (*free_compressed)(void *); void *user_data; void (*free_user_data)(void *); int refcount; }; #define GIF_DISPOSAL_NONE 0 #define GIF_DISPOSAL_ASIS 1 #define GIF_DISPOSAL_BACKGROUND 2 #define GIF_DISPOSAL_PREVIOUS 3 Gif_Image * Gif_NewImage(void); void Gif_DeleteImage(Gif_Image *); int Gif_AddImage(Gif_Stream *, Gif_Image *); void Gif_RemoveImage(Gif_Stream *, int); Gif_Image * Gif_CopyImage(Gif_Image *); Gif_Image * Gif_GetImage(Gif_Stream *, int); Gif_Image * Gif_GetNamedImage(Gif_Stream *, const char *); int Gif_ImageNumber(Gif_Stream *, Gif_Image *); #define Gif_ImageWidth(gfi) ((gfi)->width) #define Gif_ImageHeight(gfi) ((gfi)->height) #define Gif_ImageDelay(gfi) ((gfi)->delay) #define Gif_ImageUserData(gfi) ((gfi)->userdata) #define Gif_SetImageUserData(gfi, v) ((gfi)->userdata = v) typedef void (*Gif_ReadErrorHandler)(const char *, int, void *); #define Gif_UncompressImage(gfi) Gif_FullUncompressImage((gfi),0,0) int Gif_FullUncompressImage(Gif_Image*,Gif_ReadErrorHandler,void*); int Gif_CompressImage(Gif_Stream *, Gif_Image *); int Gif_FullCompressImage(Gif_Stream *, Gif_Image *, int); void Gif_ReleaseUncompressedImage(Gif_Image *); void Gif_ReleaseCompressedImage(Gif_Image *); int Gif_SetUncompressedImage(Gif_Image *, byte *data, void (*free_data)(void *), int data_interlaced); int Gif_CreateUncompressedImage(Gif_Image *); int Gif_ClipImage(Gif_Image *, int l, int t, int w, int h); /** GIF_COLORMAP **/ typedef struct { byte haspixel; byte red; byte green; byte blue; uint32_t pixel; } Gif_Color; struct Gif_Colormap { int ncol; int capacity; uint32_t userflags; int refcount; Gif_Color *col; }; Gif_Colormap * Gif_NewColormap(void); Gif_Colormap * Gif_NewFullColormap(int count, int capacity); void Gif_DeleteColormap(Gif_Colormap *); Gif_Colormap * Gif_CopyColormap(Gif_Colormap *); int Gif_ColorEq(Gif_Color *, Gif_Color *); #define GIF_COLOREQ(c1, c2) \ ((c1)->red==(c2)->red && (c1)->green==(c2)->green && (c1)->blue==(c2)->blue) int Gif_FindColor(Gif_Colormap *, Gif_Color *); int Gif_AddColor(Gif_Colormap *, Gif_Color *, int look_from); /** GIF_COMMENT **/ struct Gif_Comment { char **str; int *len; int count; int cap; }; Gif_Comment * Gif_NewComment(void); void Gif_DeleteComment(Gif_Comment *); int Gif_AddCommentTake(Gif_Comment *, char *, int); int Gif_AddComment(Gif_Comment *, const char *, int); /** GIF_EXTENSION **/ struct Gif_Extension { int kind; /* negative kinds are reserved */ char *application; byte *data; uint32_t length; int position; Gif_Stream *stream; Gif_Extension *next; void (*free_data)(void *); }; Gif_Extension * Gif_NewExtension(int, const char *); void Gif_DeleteExtension(Gif_Extension *); int Gif_AddExtension(Gif_Stream *, Gif_Extension *, int); Gif_Extension * Gif_GetExtension(Gif_Stream *, int, Gif_Extension *); /** READING AND WRITING **/ struct Gif_Record { const unsigned char *data; uint32_t length; }; #define GIF_READ_COMPRESSED 1 #define GIF_READ_UNCOMPRESSED 2 #define GIF_READ_CONST_RECORD 4 #define GIF_WRITE_CAREFUL_MIN_CODE_SIZE 1 Gif_Stream * Gif_ReadFile(FILE *); Gif_Stream * Gif_FullReadFile(FILE *, int flags, Gif_ReadErrorHandler, void *); Gif_Stream * Gif_ReadRecord(const Gif_Record *); Gif_Stream * Gif_FullReadRecord(const Gif_Record *, int flags, Gif_ReadErrorHandler, void *); int Gif_WriteFile(Gif_Stream *, FILE *); int Gif_FullWriteFile(Gif_Stream *, int flags, FILE *); #define Gif_ReadFile(f) Gif_FullReadFile((f),GIF_READ_UNCOMPRESSED,0,0) #define Gif_ReadRecord(r) Gif_FullReadRecord((r),GIF_READ_UNCOMPRESSED,0,0) #define Gif_CompressImage(s, i) Gif_FullCompressImage((s),(i),0) #define Gif_WriteFile(s, f) Gif_FullWriteFile((s),0,(f)) /** HOOKS AND MISCELLANEOUS **/ int Gif_InterlaceLine(int y, int height); char * Gif_CopyString(const char *); #define GIF_T_STREAM (0) #define GIF_T_IMAGE (1) #define GIF_T_COLORMAP (2) typedef void (*Gif_DeletionHookFunc)(int, void *, void *); int Gif_AddDeletionHook(int, Gif_DeletionHookFunc, void *); void Gif_RemoveDeletionHook(int, Gif_DeletionHookFunc, void *); #ifdef GIF_DEBUGGING #define GIF_DEBUG(x) Gif_Debug x void Gif_Debug(char *x, ...); #else #define GIF_DEBUG(x) #endif typedef uint16_t Gif_Code; #define GIF_MAX_CODE_BITS 12 #define GIF_MAX_CODE 0x1000 #define GIF_MAX_BLOCK 255 #ifndef Gif_New # ifndef xmalloc # define xmalloc malloc # define xrealloc realloc # define xfree free # endif # define Gif_New(t) ((t *)xmalloc(sizeof(t))) # define Gif_NewArray(t, n) ((t *)xmalloc(sizeof(t) * (n))) # define Gif_ReArray(p, t, n) ((p)=((t*)xrealloc((void*)(p),sizeof(t)*(n)))) #endif #ifndef Gif_DeleteFunc # define Gif_DeleteFunc (&xfree) # define Gif_DeleteArrayFunc (&xfree) #endif #ifndef Gif_Delete # define Gif_Delete(p) (*Gif_DeleteFunc)((void *)(p)) # define Gif_DeleteArray(p) (*Gif_DeleteArrayFunc)((void *)(p)) #endif #ifdef __cplusplus } #endif #endif xwrits-2.21/giffunc.c 644 41346 41346 40321 7346305050 10000 /* giffunc.c - General functions for the GIF library. Copyright (C) 1997-9 Eddie Kohler, eddietwo@lcs.mit.edu This file is part of the GIF library. The GIF library is free software*. It is distributed under the GNU General Public License, version 2 or later; you can copy, distribute, or alter it at will, as long as this notice is kept intact and this source code is made available. There is no warranty, express or implied. *There is a patent on the LZW compression method used by GIFs, and included in gifwrite.c. Unisys, the patent holder, allows the compression algorithm to be used without a license in software distributed at no cost to the user. The decompression algorithm is not patented. */ #ifdef HAVE_CONFIG_H # include #endif #include "gif.h" #include #include #ifdef __cplusplus extern "C" { #endif Gif_Stream * Gif_NewStream(void) { Gif_Stream *gfs = Gif_New(Gif_Stream); if (!gfs) return 0; gfs->global = 0; gfs->background = 0; gfs->screen_width = gfs->screen_height = 0; gfs->loopcount = -1; gfs->comment = 0; gfs->images = 0; gfs->nimages = gfs->imagescap = 0; gfs->extensions = 0; gfs->errors = 0; gfs->userflags = 0; gfs->refcount = 0; return gfs; } Gif_Image * Gif_NewImage(void) { Gif_Image *gfi = Gif_New(Gif_Image); if (!gfi) return 0; gfi->identifier = 0; gfi->comment = 0; gfi->local = 0; gfi->transparent = -1; gfi->disposal = GIF_DISPOSAL_NONE; gfi->delay = 0; gfi->left = gfi->top = gfi->width = gfi->height = 0; gfi->interlace = 0; gfi->img = 0; gfi->image_data = 0; gfi->free_image_data = Gif_DeleteArrayFunc; gfi->compressed_len = 0; gfi->compressed = 0; gfi->free_compressed = 0; gfi->user_data = 0; gfi->free_user_data = 0; gfi->refcount = 0; return gfi; } Gif_Colormap * Gif_NewColormap(void) { Gif_Colormap *gfcm = Gif_New(Gif_Colormap); if (!gfcm) return 0; gfcm->ncol = 0; gfcm->capacity = 0; gfcm->col = 0; gfcm->refcount = 0; gfcm->userflags = 0; return gfcm; } Gif_Colormap * Gif_NewFullColormap(int count, int capacity) { Gif_Colormap *gfcm = Gif_New(Gif_Colormap); if (!gfcm || capacity <= 0 || count < 0) return 0; if (count > capacity) capacity = count; gfcm->ncol = count; gfcm->capacity = capacity; gfcm->col = Gif_NewArray(Gif_Color, capacity); gfcm->refcount = 0; gfcm->userflags = 0; if (!gfcm->col) { Gif_Delete(gfcm); return 0; } else return gfcm; } Gif_Comment * Gif_NewComment(void) { Gif_Comment *gfcom = Gif_New(Gif_Comment); if (!gfcom) return 0; gfcom->str = 0; gfcom->len = 0; gfcom->count = gfcom->cap = 0; return gfcom; } Gif_Extension * Gif_NewExtension(int kind, const char *app_name) { Gif_Extension *gfex = Gif_New(Gif_Extension); if (!gfex) return 0; gfex->kind = app_name ? 255 : kind; gfex->application = Gif_CopyString(app_name); gfex->data = 0; gfex->position = 0; gfex->stream = 0; gfex->next = 0; gfex->free_data = 0; if (!gfex->application && app_name) { Gif_DeleteExtension(gfex); return 0; } return gfex; } char * Gif_CopyString(const char *s) { int l; char *copy; if (!s) return 0; l = strlen(s); copy = Gif_NewArray(char, l + 1); if (!copy) return 0; memcpy(copy, s, l + 1); return copy; } int Gif_AddImage(Gif_Stream *gfs, Gif_Image *gfi) { if (gfs->nimages >= gfs->imagescap) { if (gfs->imagescap) gfs->imagescap *= 2; else gfs->imagescap = 2; Gif_ReArray(gfs->images, Gif_Image *, gfs->imagescap); if (!gfs->images) return 0; } gfs->images[gfs->nimages] = gfi; gfs->nimages++; gfi->refcount++; return 1; } void Gif_RemoveImage(Gif_Stream *gfs, int inum) { int j; if (inum < 0 || inum >= gfs->nimages) return; Gif_DeleteImage(gfs->images[inum]); for (j = inum; j < gfs->nimages - 1; j++) gfs->images[j] = gfs->images[j+1]; gfs->nimages--; } int Gif_AddCommentTake(Gif_Comment *gfcom, char *x, int xlen) { if (gfcom->count >= gfcom->cap) { if (gfcom->cap) gfcom->cap *= 2; else gfcom->cap = 2; Gif_ReArray(gfcom->str, char *, gfcom->cap); Gif_ReArray(gfcom->len, int, gfcom->cap); if (!gfcom->str || !gfcom->len) return 0; } if (xlen < 0) xlen = strlen(x); gfcom->str[ gfcom->count ] = x; gfcom->len[ gfcom->count ] = xlen; gfcom->count++; return 1; } int Gif_AddComment(Gif_Comment *gfcom, const char *x, int xlen) { char *new_x; if (xlen < 0) xlen = strlen(x); new_x = Gif_NewArray(char, xlen); if (!new_x) return 0; memcpy(new_x, x, xlen); if (Gif_AddCommentTake(gfcom, new_x, xlen) == 0) { Gif_DeleteArray(new_x); return 0; } else return 1; } int Gif_AddExtension(Gif_Stream *gfs, Gif_Extension *gfex, int pos) { Gif_Extension *prev, *trav; if (gfex->stream) return 0; for (prev = 0, trav = gfs->extensions; trav && trav->position <= pos; prev = trav, trav = trav->next) ; if (prev) prev->next = gfex; else gfs->extensions = gfex; gfex->next = trav; return 1; } int Gif_ImageNumber(Gif_Stream *gfs, Gif_Image *gfi) { int i; for (i = 0; i < gfs->nimages; i++) if (gfs->images[i] == gfi) return i; return -1; } void Gif_CalculateScreenSize(Gif_Stream *gfs, int force) { int i; int screen_width = 0; int screen_height = 0; for (i = 0; i < gfs->nimages; i++) { Gif_Image *gfi = gfs->images[i]; /* 17.Dec.1999 - I find this old behavior annoying. */ /* if (gfi->left != 0 || gfi->top != 0) continue; */ if (screen_width < gfi->left + gfi->width) screen_width = gfi->left + gfi->width; if (screen_height < gfi->top + gfi->height) screen_height = gfi->top + gfi->height; } /* Only use the default 640x480 screen size if we are being forced to create a new screen size or there's no screen size currently. */ if (screen_width == 0 && (force || gfs->screen_width == 0)) screen_width = 640; if (screen_height == 0 && (force || gfs->screen_height == 0)) screen_height = 480; if (gfs->screen_width < screen_width || force) gfs->screen_width = screen_width; if (gfs->screen_height < screen_height || force) gfs->screen_height = screen_height; } Gif_Stream * Gif_CopyStreamSkeleton(Gif_Stream *gfs) { Gif_Stream *ngfs = Gif_NewStream(); ngfs->global = Gif_CopyColormap(gfs->global); ngfs->background = gfs->background; ngfs->screen_width = gfs->screen_width; ngfs->screen_height = gfs->screen_height; ngfs->loopcount = gfs->loopcount; if (gfs->global && !ngfs->global) { Gif_DeleteStream(ngfs); return 0; } else return ngfs; } Gif_Stream * Gif_CopyStreamImages(Gif_Stream *gfs) { Gif_Stream *ngfs = Gif_CopyStreamSkeleton(gfs); int i; if (!ngfs) return 0; for (i = 0; i < gfs->nimages; i++) { Gif_Image *gfi = Gif_CopyImage(gfs->images[i]); if (!gfi || !Gif_AddImage(ngfs, gfi)) { Gif_DeleteStream(ngfs); return 0; } } return ngfs; } Gif_Colormap * Gif_CopyColormap(Gif_Colormap *src) { int i; Gif_Colormap *dest; if (!src) return 0; dest = Gif_NewFullColormap(src->ncol, src->capacity); if (!dest) return 0; for (i = 0; i < src->ncol; i++) { dest->col[i] = src->col[i]; dest->col[i].haspixel = 0; } return dest; } Gif_Image * Gif_CopyImage(Gif_Image *src) { Gif_Image *dest; byte *data; int i; if (!src) return 0; dest = Gif_NewImage(); if (!dest) return 0; dest->identifier = Gif_CopyString(src->identifier); if (!dest->identifier && src->identifier) goto failure; if (src->comment) { dest->comment = Gif_NewComment(); if (!dest->comment) goto failure; for (i = 0; i < src->comment->count; i++) if (!Gif_AddComment(dest->comment, src->comment->str[i], src->comment->len[i])) goto failure; } dest->local = Gif_CopyColormap(src->local); if (!dest->local && src->local) goto failure; dest->transparent = src->transparent; dest->delay = src->delay; dest->disposal = src->disposal; dest->left = src->left; dest->top = src->top; dest->width = src->width; dest->height = src->height; dest->interlace = src->interlace; if (src->img) { dest->img = Gif_NewArray(byte *, dest->height + 1); dest->image_data = Gif_NewArray(byte, dest->width * dest->height); dest->free_image_data = Gif_DeleteArrayFunc; if (!dest->img || !dest->image_data) goto failure; for (i = 0, data = dest->image_data; i < dest->height; i++) { memcpy(data, src->img[i], dest->width); dest->img[i] = data; data += dest->width; } dest->img[dest->height] = 0; } if (src->compressed) { if (src->free_compressed == 0) dest->compressed = src->compressed; else { dest->compressed = Gif_NewArray(byte, src->compressed_len); dest->free_compressed = Gif_DeleteArrayFunc; memcpy(dest->compressed, src->compressed, src->compressed_len); } dest->compressed_len = src->compressed_len; } return dest; failure: Gif_DeleteImage(dest); return 0; } /** DELETION **/ typedef struct Gif_DeletionHook { int kind; Gif_DeletionHookFunc func; void *callback_data; struct Gif_DeletionHook *next; } Gif_DeletionHook; static Gif_DeletionHook *all_hooks; void Gif_DeleteStream(Gif_Stream *gfs) { Gif_Extension *gfex; Gif_DeletionHook *hook; int i; if (!gfs) return; if (--gfs->refcount > 0) return; Gif_DeleteColormap(gfs->global); Gif_DeleteComment(gfs->comment); for (i = 0; i < gfs->nimages; i++) Gif_DeleteImage(gfs->images[i]); Gif_DeleteArray(gfs->images); gfex = gfs->extensions; while (gfex) { Gif_Extension *next = gfex->next; gfex->stream = 0; Gif_DeleteExtension(gfex); gfex = next; } for (hook = all_hooks; hook; hook = hook->next) if (hook->kind == GIF_T_STREAM) (*hook->func)(GIF_T_STREAM, gfs, hook->callback_data); Gif_Delete(gfs); } void Gif_DeleteImage(Gif_Image *gfi) { Gif_DeletionHook *hook; if (!gfi) return; if (--gfi->refcount > 0) return; for (hook = all_hooks; hook; hook = hook->next) if (hook->kind == GIF_T_IMAGE) (*hook->func)(GIF_T_IMAGE, gfi, hook->callback_data); Gif_DeleteArray(gfi->identifier); Gif_DeleteComment(gfi->comment); Gif_DeleteColormap(gfi->local); if (gfi->image_data && gfi->free_image_data) (*gfi->free_image_data)((void *)gfi->image_data); Gif_DeleteArray(gfi->img); if (gfi->compressed && gfi->free_compressed) (*gfi->free_compressed)((void *)gfi->compressed); if (gfi->user_data && gfi->free_user_data) (*gfi->free_user_data)(gfi->user_data); Gif_Delete(gfi); } void Gif_DeleteColormap(Gif_Colormap *gfcm) { Gif_DeletionHook *hook; if (!gfcm) return; if (--gfcm->refcount > 0) return; for (hook = all_hooks; hook; hook = hook->next) if (hook->kind == GIF_T_COLORMAP) (*hook->func)(GIF_T_COLORMAP, gfcm, hook->callback_data); Gif_DeleteArray(gfcm->col); Gif_Delete(gfcm); } void Gif_DeleteComment(Gif_Comment *gfcom) { int i; if (!gfcom) return; for (i = 0; i < gfcom->count; i++) Gif_DeleteArray(gfcom->str[i]); Gif_DeleteArray(gfcom->str); Gif_DeleteArray(gfcom->len); Gif_Delete(gfcom); } void Gif_DeleteExtension(Gif_Extension *gfex) { if (!gfex) return; if (gfex->data && gfex->free_data) (*gfex->free_data)(gfex->data); Gif_DeleteArray(gfex->application); if (gfex->stream) { Gif_Stream *gfs = gfex->stream; Gif_Extension *prev, *trav; for (prev = 0, trav = gfs->extensions; trav && trav != gfex; prev = trav, trav = trav->next) ; if (trav) { if (prev) prev->next = trav->next; else gfs->extensions = trav->next; } } Gif_Delete(gfex); } /** DELETION HOOKS **/ int Gif_AddDeletionHook(int kind, void (*func)(int, void *, void *), void *cb) { Gif_DeletionHook *hook = Gif_New(Gif_DeletionHook); if (!hook) return 0; Gif_RemoveDeletionHook(kind, func, cb); hook->kind = kind; hook->func = func; hook->callback_data = cb; hook->next = all_hooks; all_hooks = hook; return 1; } void Gif_RemoveDeletionHook(int kind, void (*func)(int, void *, void *), void *cb) { Gif_DeletionHook *hook = all_hooks, *prev = 0; while (hook) { if (hook->kind == kind && hook->func == func && hook->callback_data == cb) { if (prev) prev->next = hook->next; else all_hooks = hook->next; Gif_Delete(hook); return; } prev = hook; hook = hook->next; } } int Gif_ColorEq(Gif_Color *c1, Gif_Color *c2) { return GIF_COLOREQ(c1, c2); } int Gif_FindColor(Gif_Colormap *gfcm, Gif_Color *c) { int i; for (i = 0; i < gfcm->ncol; i++) if (GIF_COLOREQ(&gfcm->col[i], c)) return i; return -1; } int Gif_AddColor(Gif_Colormap *gfcm, Gif_Color *c, int look_from) { int i; if (look_from >= 0) for (i = look_from; i < gfcm->ncol; i++) if (GIF_COLOREQ(&gfcm->col[i], c)) return i; if (gfcm->ncol >= gfcm->capacity) { gfcm->capacity *= 2; Gif_ReArray(gfcm->col, Gif_Color, gfcm->capacity); if (gfcm->col == 0) return -1; } i = gfcm->ncol; gfcm->ncol++; gfcm->col[i] = *c; return i; } Gif_Image * Gif_GetImage(Gif_Stream *gfs, int imagenumber) { if (imagenumber >= 0 && imagenumber < gfs->nimages) return gfs->images[imagenumber]; else return 0; } Gif_Image * Gif_GetNamedImage(Gif_Stream *gfs, const char *name) { int i; if (!name) return gfs->nimages ? gfs->images[0] : 0; for (i = 0; i < gfs->nimages; i++) if (gfs->images[i]->identifier && strcmp(gfs->images[i]->identifier, name) == 0) return gfs->images[i]; return 0; } Gif_Extension * Gif_GetExtension(Gif_Stream *gfs, int id, Gif_Extension *search_from) { if (!search_from) search_from = gfs->extensions; while (search_from) { if (search_from->kind == id) return search_from; search_from = search_from->next; } return 0; } void Gif_ReleaseCompressedImage(Gif_Image *gfi) { if (gfi->compressed && gfi->free_compressed) (*gfi->free_compressed)(gfi->compressed); gfi->compressed = 0; gfi->compressed_len = 0; gfi->free_compressed = 0; } void Gif_ReleaseUncompressedImage(Gif_Image *gfi) { Gif_DeleteArray(gfi->img); if (gfi->image_data && gfi->free_image_data) (*gfi->free_image_data)(gfi->image_data); gfi->img = 0; gfi->image_data = 0; gfi->free_image_data = 0; } int Gif_ClipImage(Gif_Image *gfi, int left, int top, int width, int height) { int new_width = gfi->width, new_height = gfi->height; int y; if (!gfi->img) return 0; if (gfi->left < left) { int shift = left - gfi->left; for (y = 0; y < gfi->height; y++) gfi->img[y] += shift; gfi->left += shift; new_width -= shift; } if (gfi->top < top) { int shift = top - gfi->top; for (y = gfi->height - 1; y >= shift; y++) gfi->img[y - shift] = gfi->img[y]; gfi->top += shift; new_height -= shift; } if (gfi->left + new_width >= width) new_width = width - gfi->left; if (gfi->top + new_height >= height) new_height = height - gfi->top; if (new_width < 0) new_width = 0; if (new_height < 0) new_height = 0; gfi->width = new_width; gfi->height = new_height; return 1; } int Gif_InterlaceLine(int line, int height) { height--; if (line > height / 2) return line * 2 - ( height | 1); else if (line > height / 4) return line * 4 - ((height & ~1) | 2); else if (line > height / 8) return line * 8 - ((height & ~3) | 4); else return line * 8; } int Gif_SetUncompressedImage(Gif_Image *gfi, byte *image_data, void (*free_data)(void *), int data_interlaced) { int i; int width = gfi->width; int height = gfi->height; byte **img; Gif_ReleaseUncompressedImage(gfi); if (!image_data) return 0; img = Gif_NewArray(byte *, height + 1); if (!img) return 0; if (data_interlaced) for (i = 0; i < height; i++) img[ Gif_InterlaceLine(i, height) ] = image_data + width * i; else for (i = 0; i < height; i++) img[i] = image_data + width * i; img[height] = 0; gfi->img = img; gfi->image_data = image_data; gfi->free_image_data = free_data; return 1; } int Gif_CreateUncompressedImage(Gif_Image *gfi) { byte *data = Gif_NewArray(byte, gfi->width * gfi->height); return Gif_SetUncompressedImage(gfi, data, Gif_DeleteArrayFunc, gfi->interlace); } void Gif_Debug(char *x, ...) { va_list val; va_start(val, x); vfprintf(stderr, x, val); fputc(' ', stderr); va_end(val); } #ifdef __cplusplus } #endif xwrits-2.21/gifread.c 644 41346 41346 53341 7410024604 7761 /* gifread.c - Functions to read GIFs. Copyright (C) 1997-9 Eddie Kohler, eddietwo@lcs.mit.edu This file is part of the GIF library. The GIF library is free software*. It is distributed under the GNU General Public License, version 2 or later; you can copy, distribute, or alter it at will, as long as this notice is kept intact and this source code is made available. There is no warranty, express or implied. *There is a patent on the LZW compression method used by GIFs, and included in gifwrite.c. Unisys, the patent holder, allows the compression algorithm to be used without a license in software distributed at no cost to the user. The decompression algorithm is not patented. */ #ifdef HAVE_CONFIG_H # include #elif !defined(__cplusplus) /* Assume we don't have inline by default */ # define inline #endif #include "gif.h" #include #include #include #ifdef __cplusplus extern "C" { #endif typedef struct { Gif_Stream *stream; Gif_Code *prefix; byte *suffix; uint16_t *length; uint16_t width; uint16_t height; byte *image; byte *maximage; unsigned decodepos; Gif_ReadErrorHandler handler; void *handler_thunk; } Gif_Context; typedef struct Gif_Reader { FILE *f; const byte *v; uint32_t w; uint32_t length; int is_record; int is_eoi; byte (*byte_getter)(struct Gif_Reader *); void (*block_getter)(byte *, uint32_t, struct Gif_Reader *); uint32_t (*offseter)(struct Gif_Reader *); int (*eofer)(struct Gif_Reader *); } Gif_Reader; #define gifgetc(grr) ((char)(*grr->byte_getter)(grr)) #define gifgetbyte(grr) ((*grr->byte_getter)(grr)) #define gifgetblock(ptr, size, grr) ((*grr->block_getter)(ptr, size, grr)) #define gifgetoffset(grr) ((*grr->offseter)(grr)) #define gifeof(grr) ((*grr->eofer)(grr)) static inline uint16_t gifgetunsigned(Gif_Reader *grr) { byte one = gifgetbyte(grr); byte two = gifgetbyte(grr); return one | (two << 8); } static byte file_byte_getter(Gif_Reader *grr) { int i = getc(grr->f); return i == EOF ? 0 : (byte)i; } static void file_block_getter(byte *p, uint32_t s, Gif_Reader *grr) { fread(p, 1, s, grr->f); } static uint32_t file_offseter(Gif_Reader *grr) { return ftell(grr->f); } static int file_eofer(Gif_Reader *grr) { return feof(grr->f); } static byte record_byte_getter(Gif_Reader *grr) { return grr->w ? (grr->w--, *grr->v++) : 0; } static void record_block_getter(byte *p, uint32_t s, Gif_Reader *grr) { if (s > grr->w) s = grr->w; memcpy(p, grr->v, s); grr->w -= s, grr->v += s; } static uint32_t record_offseter(Gif_Reader *grr) { return grr->length - grr->w; } static int record_eofer(Gif_Reader *grr) { return grr->w == 0; } static void make_data_reader(Gif_Reader *grr, const byte *data, uint32_t length) { grr->v = data; grr->length = length; grr->w = length; grr->is_record = 1; grr->byte_getter = record_byte_getter; grr->block_getter = record_block_getter; grr->offseter = record_offseter; grr->eofer = record_eofer; } static void gif_read_error(Gif_Context *gfc, const char *error) { gfc->stream->errors++; if (gfc->handler) gfc->handler(error, gfc->stream->nimages, gfc->handler_thunk); } static byte one_code(Gif_Context *gfc, Gif_Code code) { byte *suffixes = gfc->suffix; Gif_Code *prefixes = gfc->prefix; byte *ptr; int lastsuffix; uint16_t codelength = gfc->length[code]; gfc->decodepos += codelength; ptr = gfc->image + gfc->decodepos; if (ptr > gfc->maximage || !codelength) { gif_read_error(gfc, (!codelength ? "bad code" : "too much image data")); /* 5/26/98 It's not good enough simply to count an error, because in the read_image_data function, if code == next_code, we will store a byte in gfc->image[gfc->decodepos-1]. Thus, fix decodepos so it's w/in the image. */ gfc->decodepos = gfc->maximage - gfc->image; return 0; } /* codelength will always be greater than 0. */ do { lastsuffix = suffixes[code]; *--ptr = lastsuffix; code = prefixes[code]; } while (--codelength > 0); /* return the first pixel in the code, which, since we walked backwards through the code, was the last suffix we processed. */ return lastsuffix; } static int read_image_block(Gif_Reader *grr, byte *buffer, int *bit_pos_store, int *bit_len_store, int bits_needed) { int bit_position = *bit_pos_store; int bit_length = *bit_len_store; byte block_len; while (bit_position + bits_needed > bit_length) { /* Read in the next data block. */ if (bit_position >= 8) { /* Need to shift down the upper, unused part of `buffer' */ int i = bit_position / 8; buffer[0] = buffer[i]; buffer[1] = buffer[i+1]; bit_position -= i * 8; bit_length -= i * 8; } block_len = gifgetbyte(grr); GIF_DEBUG(("\nimage_block(%d)", block_len)); if (block_len == 0) return 0; gifgetblock(buffer + bit_length / 8, block_len, grr); bit_length += block_len * 8; } *bit_pos_store = bit_position; *bit_len_store = bit_length; return 1; } static void read_image_data(Gif_Context *gfc, Gif_Reader *grr) { /* we need a bit more than GIF_MAX_BLOCK in case a single code is split across blocks */ byte buffer[GIF_MAX_BLOCK + 5]; int i; uint32_t accum; int bit_position; int bit_length; Gif_Code code; Gif_Code old_code; Gif_Code clear_code; Gif_Code eoi_code; Gif_Code next_code; #define CUR_BUMP_CODE (1 << bits_needed) #define CUR_CODE_MASK ((1 << bits_needed) - 1) int min_code_size; int bits_needed; gfc->decodepos = 0; min_code_size = gifgetbyte(grr); GIF_DEBUG(("\n\nmin_code_size(%d)", min_code_size)); if (min_code_size >= GIF_MAX_CODE_BITS) { gif_read_error(gfc, "min_code_size too big"); min_code_size = GIF_MAX_CODE_BITS - 1; } else if (min_code_size < 2) { gif_read_error(gfc, "min_code_size too small"); min_code_size = 2; } clear_code = 1 << min_code_size; for (code = 0; code < clear_code; code++) { gfc->prefix[code] = 49428; gfc->suffix[code] = (byte)code; gfc->length[code] = 1; } eoi_code = clear_code + 1; next_code = eoi_code; bits_needed = min_code_size + 1; code = clear_code; bit_length = bit_position = 0; /* Thus the `Read in the next data block.' code below will be invoked on the first time through: exactly right! */ while (1) { old_code = code; /* GET A CODE INTO THE `code' VARIABLE. * * 9.Dec.1998 - Rather than maintain a byte pointer and a bit offset into * the current byte (and the processing associated with that), we maintain * one number: the offset, in bits, from the beginning of `buffer'. This * much cleaner choice was inspired by Patrick J. Naughton * 's GIF-reading code, which does the same thing. * His code distributed as part of XV in xvgif.c. */ if (bit_position + bits_needed > bit_length) /* Read in the next data block. */ if (!read_image_block(grr, buffer, &bit_position, &bit_length, bits_needed)) goto zero_length_block; i = bit_position / 8; accum = buffer[i] + (buffer[i+1] << 8); if (bits_needed >= 8) accum |= (buffer[i+2]) << 16; code = (Gif_Code)((accum >> (bit_position % 8)) & CUR_CODE_MASK); bit_position += bits_needed; GIF_DEBUG(("%d", code)); /* CHECK FOR SPECIAL OR BAD CODES: clear_code, eoi_code, or a code that is * too large. */ if (code == clear_code) { bits_needed = min_code_size + 1; next_code = eoi_code; continue; } else if (code == eoi_code) break; else if (code > next_code && next_code) { /* code > next_code: a (hopefully recoverable) error. Bug fix, 5/27: Do this even if old_code == clear_code, and set code to 0 to prevent errors later. (If we didn't zero code, we'd later set old_code = code; then we had old_code >= next_code; so the prefixes array got all screwed up!) */ gif_read_error(gfc, "unexpected code"); code = 0; } /* PROCESS THE CURRENT CODE and define the next code. If no meaningful * next code should be defined, then we have set next_code to either * `eoi_code' or `clear_code' -- so we'll store useless prefix/suffix data * in a useless place. */ /* *First,* set up the prefix and length for the next code (in case code == next_code). */ gfc->prefix[next_code] = old_code; gfc->length[next_code] = gfc->length[old_code] + 1; /* Use one_code to process code. It's nice that it returns the first pixel in code: that's what we need. */ gfc->suffix[next_code] = one_code(gfc, code); /* Special processing if code == next_code: we didn't know code's final suffix when we called one_code, but we do now. */ if (code == next_code) gfc->image[gfc->decodepos - 1] = gfc->suffix[next_code]; /* Increment next_code except for the `clear_code' special case (that's when we're reading at the end of a GIF) */ if (next_code != clear_code) { next_code++; if (next_code == CUR_BUMP_CODE) { if (bits_needed < GIF_MAX_CODE_BITS) bits_needed++; else next_code = clear_code; } } } /* read blocks until zero-length reached. */ i = gifgetbyte(grr); GIF_DEBUG(("\nafter_image(%d)\n", i)); while (i > 0) { gifgetblock(buffer, i, grr); i = gifgetbyte(grr); GIF_DEBUG(("\nafter_image(%d)\n", i)); } /* zero-length block reached. */ zero_length_block: if (gfc->image + gfc->decodepos < gfc->maximage) gif_read_error(gfc, "not enough image data for image size"); else if (gfc->image + gfc->decodepos > gfc->maximage) gif_read_error(gfc, "too much image data for image size"); } static Gif_Colormap * read_color_table(int size, Gif_Reader *grr) { Gif_Colormap *gfcm = Gif_NewFullColormap(size, size); Gif_Color *c; if (!gfcm) return 0; GIF_DEBUG(("colormap(%d)", size)); for (c = gfcm->col; size; size--, c++) { c->red = gifgetbyte(grr); c->green = gifgetbyte(grr); c->blue = gifgetbyte(grr); c->haspixel = 0; } return gfcm; } static int read_logical_screen_descriptor(Gif_Stream *gfs, Gif_Reader *grr) /* returns 0 on memory error */ { byte packed; /* we don't care about logical screen width or height */ gfs->screen_width = gifgetunsigned(grr); gfs->screen_height = gifgetunsigned(grr); packed = gifgetbyte(grr); gfs->background = gifgetbyte(grr); /* don't care about pixel aspect ratio */ gifgetbyte(grr); if (packed & 0x80) { /* have a global color table */ int ncol = 1 << ((packed & 0x07) + 1); gfs->global = read_color_table(ncol, grr); if (!gfs->global) return 0; gfs->global->refcount = 1; } return 1; } static int read_compressed_image(Gif_Image *gfi, Gif_Reader *grr, int read_flags) { if (grr->is_record) { const byte *first = grr->v; uint32_t pos; /* scan over image */ pos = 1; /* skip min code size */ while (pos < grr->w) { int amt = grr->v[pos]; pos += amt + 1; if (amt == 0) break; } if (pos > grr->w) pos = grr->w; gfi->compressed_len = pos; if (read_flags & GIF_READ_CONST_RECORD) { gfi->compressed = (byte *)first; gfi->free_compressed = 0; } else { gfi->compressed = Gif_NewArray(byte, gfi->compressed_len); gfi->free_compressed = Gif_DeleteArrayFunc; if (!gfi->compressed) return 0; memcpy(gfi->compressed, first, gfi->compressed_len); } /* move reader over that image */ grr->v += pos; grr->w -= pos; } else { /* non-record; have to read it block by block. */ uint32_t comp_cap = 1024; uint32_t comp_len; byte *comp = Gif_NewArray(byte, comp_cap); int i; if (!comp) return 0; /* min code size */ i = gifgetbyte(grr); comp[0] = i; comp_len = 1; i = gifgetbyte(grr); while (i > 0) { /* add 2 before check so we don't have to check after loop when appending 0 block */ if (comp_len + i + 2 > comp_cap) { comp_cap *= 2; Gif_ReArray(comp, byte, comp_cap); if (!comp) return 0; } comp[comp_len] = i; gifgetblock(comp + comp_len + 1, i, grr); comp_len += i + 1; i = gifgetbyte(grr); } comp[comp_len++] = 0; gfi->compressed = comp; gfi->compressed_len = comp_len; gfi->free_compressed = Gif_DeleteArrayFunc; } return 1; } static int uncompress_image(Gif_Context *gfc, Gif_Image *gfi, Gif_Reader *grr) { if (!Gif_CreateUncompressedImage(gfi)) return 0; gfc->width = gfi->width; gfc->height = gfi->height; gfc->image = gfi->image_data; gfc->maximage = gfi->image_data + gfi->width * gfi->height; read_image_data(gfc, grr); return 1; } int Gif_FullUncompressImage(Gif_Image *gfi, Gif_ReadErrorHandler h, void *hthunk) { Gif_Context gfc; Gif_Stream fake_gfs; Gif_Reader grr; int ok = 0; /* return right away if image is already uncompressed. this might screw over people who expect re-uncompressing to restore the compressed version. */ if (gfi->img) return 1; if (gfi->image_data) /* we have uncompressed data, but not an `img' array; this shouldn't happen */ return 0; fake_gfs.errors = 0; gfc.stream = &fake_gfs; gfc.prefix = Gif_NewArray(Gif_Code, GIF_MAX_CODE); gfc.suffix = Gif_NewArray(byte, GIF_MAX_CODE); gfc.length = Gif_NewArray(uint16_t, GIF_MAX_CODE); gfc.handler = h; gfc.handler_thunk = hthunk; if (gfi && gfc.prefix && gfc.suffix && gfc.length && gfi->compressed) { make_data_reader(&grr, gfi->compressed, gfi->compressed_len); ok = uncompress_image(&gfc, gfi, &grr); } Gif_DeleteArray(gfc.prefix); Gif_DeleteArray(gfc.suffix); Gif_DeleteArray(gfc.length); return ok && !fake_gfs.errors; } static int read_image(Gif_Reader *grr, Gif_Context *gfc, Gif_Image *gfi, int read_flags) /* returns 0 on memory error */ { byte packed; gfi->left = gifgetunsigned(grr); gfi->top = gifgetunsigned(grr); gfi->width = gifgetunsigned(grr); gfi->height = gifgetunsigned(grr); packed = gifgetbyte(grr); GIF_DEBUG(("<%ux%u>", gfi->width, gfi->height)); if (packed & 0x80) { /* have a local color table */ int ncol = 1 << ((packed & 0x07) + 1); gfi->local = read_color_table(ncol, grr); if (!gfi->local) return 0; gfi->local->refcount = 1; } gfi->interlace = (packed & 0x40) != 0; /* Keep the compressed data if asked */ if (read_flags & GIF_READ_COMPRESSED) { if (!read_compressed_image(gfi, grr, read_flags)) return 0; if (read_flags & GIF_READ_UNCOMPRESSED) { Gif_Reader new_grr; make_data_reader(&new_grr, gfi->compressed, gfi->compressed_len); if (!uncompress_image(gfc, gfi, &new_grr)) return 0; } } else if (read_flags & GIF_READ_UNCOMPRESSED) { if (!uncompress_image(gfc, gfi, grr)) return 0; } else { /* skip over the image */ byte buffer[GIF_MAX_BLOCK]; int i = gifgetbyte(grr); while (i > 0) { gifgetblock(buffer, i, grr); i = gifgetbyte(grr); } } return 1; } static void read_graphic_control_extension(Gif_Context *gfc, Gif_Image *gfi, Gif_Reader *grr) { byte len; byte crap[GIF_MAX_BLOCK]; len = gifgetbyte(grr); if (len == 4) { byte packed = gifgetbyte(grr); gfi->disposal = (packed >> 2) & 0x07; gfi->delay = gifgetunsigned(grr); gfi->transparent = gifgetbyte(grr); if (!(packed & 0x01)) /* transparent color doesn't exist */ gfi->transparent = -1; len -= 4; } if (len > 0) { gif_read_error(gfc, "odd graphic extension format"); gifgetblock(crap, len, grr); } len = gifgetbyte(grr); while (len > 0) { gif_read_error(gfc, "odd graphic extension format"); gifgetblock(crap, len, grr); len = gifgetbyte(grr); } } static char *last_name; static char * suck_data(char *data, int *store_len, Gif_Reader *grr) { byte len = gifgetbyte(grr); int total_len = 0; while (len > 0) { Gif_ReArray(data, char, total_len + len + 1); if (!data) return 0; gifgetblock((byte *)data, len, grr); total_len += len; data[total_len] = 0; len = gifgetbyte(grr); } if (store_len) *store_len = total_len; return data; } static int read_unknown_extension(Gif_Stream *gfs, int kind, char *app_name, int position, Gif_Reader *grr) { byte block_len = gifgetbyte(grr); byte *data = 0; byte data_len = 0; Gif_Extension *gfex = 0; while (block_len > 0) { if (data) Gif_ReArray(data, byte, data_len + block_len + 1); else data = Gif_NewArray(byte, block_len + 1); if (!data) goto done; gifgetblock(data + data_len, block_len, grr); data_len += block_len; block_len = gifgetbyte(grr); } if (data) gfex = Gif_NewExtension(kind, app_name); if (gfex) { gfex->data = data; gfex->length = data_len; data[data_len] = 0; Gif_AddExtension(gfs, gfex, position); } done: if (!gfex) Gif_DeleteArray(data); while (block_len > 0) { byte buffer[GIF_MAX_BLOCK]; gifgetblock(buffer, block_len, grr); block_len = gifgetbyte(grr); } return gfex != 0; } static int read_application_extension(Gif_Context *gfc, int position, Gif_Reader *grr) { Gif_Stream *gfs = gfc->stream; byte buffer[GIF_MAX_BLOCK + 1]; byte len = gifgetbyte(grr); gifgetblock(buffer, len, grr); /* Read the Netscape loop extension. */ if (len == 11 && memcmp(buffer, "NETSCAPE2.0", 11) == 0) { len = gifgetbyte(grr); if (len == 3) { gifgetbyte(grr); /* throw away the 1 */ gfs->loopcount = gifgetunsigned(grr); len = gifgetbyte(grr); if (len) gif_read_error(gfc, "bad loop extension"); } else gif_read_error(gfc, "bad loop extension"); while (len > 0) { gifgetblock(buffer, len, grr); len = gifgetbyte(grr); } return 1; } else { buffer[len] = 0; return read_unknown_extension(gfs, 0xFF, (char *)buffer, position, grr); } } static int read_comment_extension(Gif_Image *gfi, Gif_Reader *grr) { int len; Gif_Comment *gfcom = gfi->comment; char *m = suck_data(0, &len, grr); if (m) { if (!gfcom) gfcom = gfi->comment = Gif_NewComment(); if (!gfcom || !Gif_AddCommentTake(gfcom, m, len)) return 0; } return 1; } static Gif_Stream * read_gif(Gif_Reader *grr, int read_flags, Gif_ReadErrorHandler handler, void *handler_thunk) { Gif_Stream *gfs; Gif_Image *gfi; Gif_Image *new_gfi; Gif_Context gfc; int extension_position = 0; int unknown_block_type = 0; if (gifgetc(grr) != 'G' || gifgetc(grr) != 'I' || gifgetc(grr) != 'F') return 0; (void)gifgetc(grr); (void)gifgetc(grr); (void)gifgetc(grr); gfs = Gif_NewStream(); gfi = Gif_NewImage(); gfc.stream = gfs; gfc.prefix = Gif_NewArray(Gif_Code, GIF_MAX_CODE); gfc.suffix = Gif_NewArray(byte, GIF_MAX_CODE); gfc.length = Gif_NewArray(uint16_t, GIF_MAX_CODE); gfc.handler = handler; gfc.handler_thunk = handler_thunk; if (!gfs || !gfi || !gfc.prefix || !gfc.suffix || !gfc.length) goto done; GIF_DEBUG(("\nGIF")); if (!read_logical_screen_descriptor(gfs, grr)) goto done; GIF_DEBUG(("logscrdesc")); while (!gifeof(grr)) { byte block = gifgetbyte(grr); switch (block) { case ',': /* image block */ GIF_DEBUG(("imageread %d", gfs->nimages)); gfi->identifier = last_name; last_name = 0; if (!read_image(grr, &gfc, gfi, read_flags) || !Gif_AddImage(gfs, gfi)) { Gif_DeleteImage(gfi); goto done; } new_gfi = Gif_NewImage(); if (!new_gfi) goto done; gfi = new_gfi; extension_position++; break; case ';': /* terminator */ GIF_DEBUG(("term\n")); goto done; case '!': /* extension */ block = gifgetbyte(grr); GIF_DEBUG(("ext(0x%02X)", block)); switch (block) { case 0xF9: read_graphic_control_extension(&gfc, gfi, grr); break; case 0xCE: last_name = suck_data(last_name, 0, grr); break; case 0xFE: if (!read_comment_extension(gfi, grr)) goto done; break; case 0xFF: read_application_extension(&gfc, extension_position, grr); break; default: read_unknown_extension(gfs, block, 0, extension_position, grr); break; } break; default: if (!unknown_block_type) { char buf[256]; sprintf(buf, "unknown block type %d at file offset %d", block, gifgetoffset(grr) - 1); gif_read_error(&gfc, buf); unknown_block_type = 1; } break; } } done: /* Move comments after last image into stream. */ gfs->comment = gfi->comment; gfi->comment = 0; Gif_DeleteImage(gfi); Gif_DeleteArray(last_name); Gif_DeleteArray(gfc.prefix); Gif_DeleteArray(gfc.suffix); Gif_DeleteArray(gfc.length); return gfs; } Gif_Stream * Gif_FullReadFile(FILE *f, int read_flags, Gif_ReadErrorHandler h, void *hthunk) { Gif_Reader grr; if (!f) return 0; grr.f = f; grr.is_record = 0; grr.byte_getter = file_byte_getter; grr.block_getter = file_block_getter; grr.offseter = file_offseter; grr.eofer = file_eofer; return read_gif(&grr, read_flags, h, hthunk); } Gif_Stream * Gif_FullReadRecord(const Gif_Record *gifrec, int read_flags, Gif_ReadErrorHandler h, void *hthunk) { Gif_Reader grr; if (!gifrec) return 0; make_data_reader(&grr, gifrec->data, gifrec->length); if (read_flags & GIF_READ_CONST_RECORD) read_flags |= GIF_READ_COMPRESSED; return read_gif(&grr, read_flags, h, hthunk); } #undef Gif_ReadFile #undef Gif_ReadRecord Gif_Stream * Gif_ReadFile(FILE *f) { return Gif_FullReadFile(f, GIF_READ_UNCOMPRESSED, 0, 0); } Gif_Stream * Gif_ReadRecord(const Gif_Record *gifrec) { return Gif_FullReadRecord(gifrec, GIF_READ_UNCOMPRESSED, 0, 0); } #ifdef __cplusplus } #endif xwrits-2.21/gifx.h 644 41346 41346 4576 7346305051 7316 #ifndef GIFX_H #define GIFX_H #ifdef __cplusplus extern "C" { #endif /* gifx.h - Functions to turn GIFs in memory into X Pixmaps. Copyright (C) 1997-9 Eddie Kohler, eddietwo@lcs.mit.edu This file is part of the GIF library. The GIF library is free software*. It is distributed under the GNU General Public License, version 2 or later; you can copy, distribute, or alter it at will, as long as this notice is kept intact and this source code is made available. There is no warranty, express or implied. *There is a patent on the LZW compression method used by GIFs, and included in gifwrite.c. Unisys, the patent holder, allows the compression algorithm to be used without a license in software distributed at no cost to the user. The decompression algorithm is not patented. */ #include "gif.h" #include #define GIFX_COLORMAP_EXTENSION -107 typedef struct Gif_XContext Gif_XContext; typedef struct Gif_XColormap Gif_XColormap; struct Gif_XContext { Display *display; int screen_number; Drawable drawable; Visual *visual; uint16_t depth; uint16_t ncolormap; Colormap colormap; uint16_t nclosest; Gif_Color *closest; int free_deleted_colormap_pixels; Gif_XColormap *xcolormap; GC image_gc; GC mask_gc; unsigned long transparent_pixel; unsigned long foreground_pixel; int refcount; }; Gif_XContext * Gif_NewXContext(Display *, Window); Gif_XContext * Gif_NewXContextFromVisual(Display *, int screen_number, Visual *, int depth, Colormap); void Gif_DeleteXContext(Gif_XContext *); Pixmap Gif_XImage(Gif_XContext *, Gif_Stream *, Gif_Image *); Pixmap Gif_XImageColormap(Gif_XContext *, Gif_Stream *, Gif_Colormap *, Gif_Image *); Pixmap Gif_XSubImage(Gif_XContext *, Gif_Stream *, Gif_Image *, int l, int t, int w, int h); Pixmap Gif_XSubImageColormap(Gif_XContext *, Gif_Image *, Gif_Colormap *, int l, int t, int w, int h); Pixmap Gif_XMask(Gif_XContext *, Gif_Stream *, Gif_Image *); Pixmap Gif_XSubMask(Gif_XContext *, Gif_Image *, int l, int t, int w, int h); Pixmap Gif_XNextImage(Gif_XContext *, Pixmap last_last, Pixmap last, Gif_Stream *, int n); int Gif_XAllocateColors(Gif_XContext *, Gif_Colormap *); void Gif_XDeallocateColors(Gif_XContext *, Gif_Colormap *); unsigned long * Gif_XClaimStreamColors(Gif_XContext *, Gif_Stream *, int *); #ifdef __cplusplus } #endif #endif xwrits-2.21/gifx.c 644 41346 41346 47110 7432256157 7330 /* gifx.c - Functions to turn GIFs in memory into X Pixmaps. Copyright (C) 1997-9 Eddie Kohler, eddietwo@lcs.mit.edu This file is part of the GIF library. The GIF library is free software*. It is distributed under the GNU General Public License, version 2 or later; you can copy, distribute, or alter it at will, as long as this notice is kept intact and this source code is made available. There is no warranty, express or implied. *There is a patent on the LZW compression method used by GIFs, and included in gifwrite.c. Unisys, the patent holder, allows the compression algorithm to be used without a license in software distributed at no cost to the user. The decompression algorithm is not patented. */ #ifdef HAVE_CONFIG_H # include #endif #include "gifx.h" #include #include #include #ifdef __cplusplus extern "C" { #endif #define SAFELS(a,b) ((b) < 0 ? (a) >> -(b) : (a) << (b)) struct Gif_XColormap { Gif_XContext *x_context; Gif_Colormap *colormap; int allocated; int claimed; uint16_t npixels; unsigned long *pixels; Gif_XColormap *next; }; static unsigned long crap_pixels[256]; static void load_closest(Gif_XContext *gfx) { XColor *color; uint16_t ncolor; uint16_t ncolormap; int i; if (gfx->closest) return; ncolormap = ncolor = gfx->ncolormap; if (ncolor > 256) ncolor = 256; color = Gif_NewArray(XColor, ncolor); if (ncolormap > 256) for (i = 0; i < ncolor; i++) color[i].pixel = (rand() >> 4) % ncolormap; else for (i = 0; i < ncolor; i++) color[i].pixel = i; XQueryColors(gfx->display, gfx->colormap, color, ncolor); gfx->closest = Gif_NewArray(Gif_Color, ncolor); for (i = 0; i < ncolor; i++) { Gif_Color *c = &gfx->closest[i]; c->haspixel = 1; c->red = color[i].red >> 8; c->green = color[i].green >> 8; c->blue = color[i].blue >> 8; c->pixel = color[i].pixel; } gfx->nclosest = ncolor; Gif_DeleteArray(color); } static unsigned long allocate_closest(Gif_XContext *gfx, Gif_Color *c) { Gif_Color *closer; Gif_Color *got = 0; uint32_t distance = 0x4000000; int i; load_closest(gfx); for (i = 0, closer = gfx->closest; i < gfx->nclosest; i++, closer++) { int redd = c->red - closer->red; int greend = c->green - closer->green; int blued = c->blue - closer->blue; uint32_t d = redd * redd + greend * greend + blued * blued; if (d < distance) { distance = d; got = closer; } } if (!got) return 0; if (!got->haspixel) { XColor xcol; xcol.red = got->red | (got->red << 8); xcol.green = got->green | (got->green << 8); xcol.blue = got->blue | (got->blue << 8); if (XAllocColor(gfx->display, gfx->colormap, &xcol) == 0) { /* Probably was a read/write color cell. Get rid of it!! */ *got = gfx->closest[gfx->nclosest - 1]; gfx->nclosest--; return allocate_closest(gfx, c); } got->pixel = xcol.pixel; got->haspixel = 1; } return got->pixel; } static void allocate_colors(Gif_XColormap *gfxc) { Gif_XContext *gfx = gfxc->x_context; uint16_t size = gfxc->colormap->ncol; Gif_Color *c = gfxc->colormap->col; unsigned long *pixels = gfxc->pixels; XColor xcol; int i; if (!gfxc->allocated) { if (size > gfxc->npixels) size = gfxc->npixels; for (i = 0; i < size; i++, c++) { xcol.red = c->red | (c->red << 8); xcol.green = c->green | (c->green << 8); xcol.blue = c->blue | (c->blue << 8); if (XAllocColor(gfx->display, gfx->colormap, &xcol)) pixels[i] = xcol.pixel; else pixels[i] = allocate_closest(gfx, c); } gfxc->allocated = 1; gfxc->claimed = 0; } } static void deallocate_colors(Gif_XColormap *gfxc) { Gif_XContext *gfx = gfxc->x_context; if (gfxc->allocated && !gfxc->claimed) { XFreeColors(gfx->display, gfx->colormap, gfxc->pixels, gfxc->npixels, 0); gfxc->allocated = 0; } } static Gif_XColormap * create_x_colormap_extension(Gif_XContext *gfx, Gif_Colormap *gfcm) { Gif_XColormap *gfxc; unsigned long *pixels; if (!gfcm) return 0; gfxc = Gif_New(Gif_XColormap); pixels = gfxc ? Gif_NewArray(unsigned long, 256) : 0; if (pixels) { gfxc->x_context = gfx; gfxc->colormap = gfcm; gfxc->allocated = 0; gfxc->npixels = gfcm->ncol; gfxc->pixels = pixels; gfxc->next = gfx->xcolormap; gfx->xcolormap = gfxc; return gfxc; } else { Gif_Delete(gfxc); Gif_DeleteArray(pixels); return 0; } } static Gif_XColormap * find_x_colormap_extension(Gif_XContext *gfx, Gif_Colormap *gfcm, int create) { Gif_XColormap *gfxc = gfx->xcolormap; if (!gfcm) return 0; while (gfxc) { if (gfxc->colormap == gfcm) return gfxc; gfxc = gfxc->next; } if (create) return create_x_colormap_extension(gfx, gfcm); else return 0; } int Gif_XAllocateColors(Gif_XContext *gfx, Gif_Colormap *gfcm) { Gif_XColormap *gfxc = find_x_colormap_extension(gfx, gfcm, 1); if (gfxc) { allocate_colors(gfxc); return 1; } else return 0; } void Gif_XDeallocateColors(Gif_XContext *gfx, Gif_Colormap *gfcm) { Gif_XColormap *gfxc = find_x_colormap_extension(gfx, gfcm, 0); if (gfxc) deallocate_colors(gfxc); } unsigned long * Gif_XClaimStreamColors(Gif_XContext *gfx, Gif_Stream *gfs, int *np_store) { int i; int npixels = 0; unsigned long *pixels; Gif_Colormap *global = gfs->global; *np_store = 0; for (i = 0; i < gfs->nimages; i++) { Gif_Image *gfi = gfs->images[i]; Gif_Colormap *gfcm = (gfi->local ? gfi->local : global); Gif_XColormap *gfxc = find_x_colormap_extension(gfx, gfcm, 0); if (gfxc && gfxc->allocated && gfxc->claimed == 0) { gfxc->claimed = 2; npixels += gfxc->npixels; if (gfcm == global) global = 0; } } if (!npixels) return 0; pixels = Gif_NewArray(unsigned long, npixels); if (!pixels) return 0; *np_store = npixels; npixels = 0; global = gfs->global; for (i = 0; i < gfs->nimages; i++) { Gif_Image *gfi = gfs->images[i]; Gif_Colormap *gfcm = (gfi->local ? gfi->local : global); Gif_XColormap *gfxc = find_x_colormap_extension(gfx, gfcm, 0); if (gfxc && gfxc->allocated && gfxc->claimed == 2) { memcpy(pixels + npixels, gfxc->pixels, gfxc->npixels); npixels += gfxc->npixels; gfxc->claimed = 1; if (gfcm == global) global = 0; } } return pixels; } /* Getting pixmaps */ #define BYTESIZE 8 static int put_sub_image_colormap(Gif_XContext *gfx, Gif_Image *gfi, Gif_Colormap *gfcm, int left, int top, int width, int height, Pixmap pixmap, int pixmap_x, int pixmap_y) { XImage *ximage; byte *xdata; int i, j, k; int bytes_per_line; unsigned long saved_transparent = 0; int release_uncompressed = 0; uint16_t nct; unsigned long *pixels; /* Find the correct image and colormap */ if (!gfi) return 0; if (!gfx->image_gc) gfx->image_gc = XCreateGC(gfx->display, pixmap, 0, 0); if (!gfx->image_gc) return 0; /* Make sure the image is uncompressed */ if (!gfi->img && !gfi->image_data && gfi->compressed) { Gif_UncompressImage(gfi); release_uncompressed = 1; } /* Check subimage dimensions */ if (width <= 0 || height <= 0 || left < 0 || top < 0 || left+width <= 0 || top+height <= 0 || left+width > gfi->width || top+height > gfi->height) return 0; /* Allocate colors from the colormap; make sure the transparent color * has the given pixel value */ if (gfcm) { Gif_XColormap *gfxc = find_x_colormap_extension(gfx, gfcm, 1); if (!gfxc) return 0; allocate_colors(gfxc); pixels = gfxc->pixels; nct = gfxc->npixels; } else { for (i = 0; i < 256; i++) crap_pixels[i] = gfx->foreground_pixel; pixels = crap_pixels; nct = 256; } if (gfi->transparent >= 0 && gfi->transparent < 256) { saved_transparent = pixels[ gfi->transparent ]; pixels[ gfi->transparent ] = gfx->transparent_pixel; } /* Set up the X image */ if (gfx->depth <= 8) i = 8; else if (gfx->depth <= 16) i = 16; else i = 32; ximage = XCreateImage(gfx->display, gfx->visual, gfx->depth, gfx->depth == 1 ? XYBitmap : ZPixmap, 0, NULL, width, height, i, 0); ximage->bitmap_bit_order = ximage->byte_order = LSBFirst; bytes_per_line = ximage->bytes_per_line; xdata = Gif_NewArray(byte, bytes_per_line * height); ximage->data = (char *)xdata; /* The main loop */ if (ximage->bits_per_pixel % 8 == 0) { /* Optimize for cases where a pixel is exactly one or more bytes */ int bytes_per_pixel = ximage->bits_per_pixel / 8; for (j = 0; j < height; j++) { byte *line = gfi->img[top + j] + left; byte *writer = xdata + bytes_per_line * j; for (i = 0; i < width; i++) { unsigned long pixel; if (line[i] < nct) pixel = pixels[line[i]]; else pixel = pixels[0]; for (k = 0; k < bytes_per_pixel; k++) { *writer++ = pixel; pixel >>= 8; } } } } else { /* Other bits-per-pixel */ int bits_per_pixel = ximage->bits_per_pixel; uint32_t bits_per_pixel_mask = (1UL << bits_per_pixel) - 1; for (j = 0; j < height; j++) { int imshift = 0; uint32_t impixel = 0; byte *line = gfi->img[top + j] + left; byte *writer = xdata + bytes_per_line * j; for (i = 0; i < width; i++) { unsigned long pixel; if (line[i] < nct) pixel = pixels[line[i]]; else pixel = pixels[0]; impixel |= SAFELS(pixel & bits_per_pixel_mask, imshift); while (imshift + bits_per_pixel >= BYTESIZE) { *writer++ = impixel; imshift -= BYTESIZE; impixel = SAFELS(pixel, imshift); } imshift += bits_per_pixel; } if (imshift) *writer++ = impixel; } } /* Restore saved transparent pixel value */ if (gfi->transparent >= 0 && gfi->transparent < 256) pixels[ gfi->transparent ] = saved_transparent; /* Put it onto the pixmap */ XPutImage(gfx->display, pixmap, gfx->image_gc, ximage, 0, 0, pixmap_x, pixmap_y, width, height); Gif_DeleteArray(xdata); ximage->data = 0; /* avoid freeing it again in XDestroyImage */ XDestroyImage(ximage); if (release_uncompressed) Gif_ReleaseUncompressedImage(gfi); return 1; } Pixmap Gif_XSubImageColormap(Gif_XContext *gfx, Gif_Image *gfi, Gif_Colormap *gfcm, int left, int top, int width, int height) { Pixmap pixmap = XCreatePixmap(gfx->display, gfx->drawable, width, height, gfx->depth); if (pixmap) { if (put_sub_image_colormap(gfx, gfi, gfcm, left, top, width, height, pixmap, 0, 0)) return pixmap; else XFreePixmap(gfx->display, pixmap); } return None; } Pixmap Gif_XImage(Gif_XContext *gfx, Gif_Stream *gfs, Gif_Image *gfi) { Gif_Colormap *gfcm; if (!gfi && gfs->nimages) gfi = gfs->images[0]; if (!gfi) return None; gfcm = gfi->local; if (!gfcm) gfcm = gfs->global; return Gif_XSubImageColormap(gfx, gfi, gfcm, 0, 0, gfi->width, gfi->height); } Pixmap Gif_XImageColormap(Gif_XContext *gfx, Gif_Stream *gfs, Gif_Colormap *gfcm, Gif_Image *gfi) { if (!gfi && gfs->nimages) gfi = gfs->images[0]; if (!gfi) return None; return Gif_XSubImageColormap(gfx, gfi, gfcm, 0, 0, gfi->width, gfi->height); } Pixmap Gif_XSubImage(Gif_XContext *gfx, Gif_Stream *gfs, Gif_Image *gfi, int left, int top, int width, int height) { Gif_Colormap *gfcm; if (!gfi && gfs->nimages) gfi = gfs->images[0]; if (!gfi) return None; gfcm = gfi->local; if (!gfcm) gfcm = gfs->global; return Gif_XSubImageColormap(gfx, gfi, gfcm, left, top, width, height); } Pixmap Gif_XSubMask(Gif_XContext *gfx, Gif_Image *gfi, int left, int top, int width, int height) { Pixmap pixmap = None; XImage *ximage; byte *xdata; int i, j; int transparent; int bytes_per_line; int release_uncompressed = 0; /* Find the correct image */ if (!gfi) return None; /* Check subimage dimensions */ if (width <= 0 || height <= 0 || left < 0 || top < 0 || left+width <= 0 || top+height <= 0 || left+width > gfi->width || top+height > gfi->height) return None; /* Make sure the image is uncompressed */ if (!gfi->img && !gfi->image_data && gfi->compressed) { Gif_UncompressImage(gfi); release_uncompressed = 1; } /* Create the X image */ ximage = XCreateImage(gfx->display, gfx->visual, 1, XYBitmap, 0, NULL, width, height, 8, 0); ximage->bitmap_bit_order = ximage->byte_order = LSBFirst; bytes_per_line = ximage->bytes_per_line; xdata = Gif_NewArray(byte, bytes_per_line * height); ximage->data = (char *)xdata; transparent = gfi->transparent; /* The main loop */ for (j = 0; j < height; j++) { int imshift = 0; uint32_t impixel = 0; byte *line = gfi->img[top + j] + left; byte *writer = xdata + bytes_per_line * j; for (i = 0; i < width; i++) { if (line[i] == transparent) impixel |= 1 << imshift; if (++imshift >= BYTESIZE) { *writer++ = impixel; imshift = 0; impixel = 0; } } if (imshift) *writer++ = impixel; } /* Create the pixmap */ pixmap = XCreatePixmap(gfx->display, gfx->drawable, width, height, 1); if (!gfx->mask_gc) gfx->mask_gc = XCreateGC(gfx->display, pixmap, 0, 0); if (pixmap && gfx->mask_gc) XPutImage(gfx->display, pixmap, gfx->mask_gc, ximage, 0, 0, 0, 0, width, height); Gif_DeleteArray(xdata); ximage->data = 0; /* avoid freeing it again in XDestroyImage */ XDestroyImage(ximage); if (release_uncompressed) Gif_ReleaseUncompressedImage(gfi); return pixmap; } Pixmap Gif_XMask(Gif_XContext *gfx, Gif_Stream *gfs, Gif_Image *gfi) { if (!gfi && gfs->nimages) gfi = gfs->images[0]; if (!gfi) return None; return Gif_XSubMask(gfx, gfi, 0, 0, gfi->width, gfi->height); } Pixmap Gif_XNextImage(Gif_XContext *gfx, Pixmap last_last, Pixmap last, Gif_Stream *gfs, int n) { Pixmap pixmap = None, image = None, mask = None; Gif_Image *gfi = gfs->images[n]; Gif_Image *last_gfi = (n > 0 ? gfs->images[n-1] : 0); Gif_Colormap *gfcm = (gfi->local ? gfi->local : gfs->global); unsigned long bg_pixel; unsigned long old_transparent = gfx->transparent_pixel; if (gfs->screen_width == 0 || gfs->screen_height == 0) return None; if (gfi->width == gfs->screen_width && gfi->height == gfs->screen_height && gfi->left == 0 && gfi->top == 0 && gfi->transparent < 0) return Gif_XImage(gfx, gfs, gfi); /* create the pixmap */ pixmap = XCreatePixmap(gfx->display, gfx->drawable, gfs->screen_width, gfs->screen_height, gfx->depth); if (!pixmap) goto error_exit; /* find background color if necessary */ if (last == None || (last_gfi && last_gfi->disposal == GIF_DISPOSAL_BACKGROUND)) { /* find bg_pixel */ if (gfs->global && gfs->background < gfs->global->ncol && gfs->images[0]->transparent < 0) { Gif_XColormap *gfxc = find_x_colormap_extension(gfx, gfcm, 1); if (!gfxc) return None; allocate_colors(gfxc); bg_pixel = gfxc->pixels[gfs->background]; } else bg_pixel = old_transparent; /* install it as the foreground color on gfx->image_gc */ if (!gfx->image_gc) gfx->image_gc = XCreateGC(gfx->display, pixmap, 0, 0); if (!gfx->image_gc) goto error_exit; XSetForeground(gfx->display, gfx->image_gc, bg_pixel); gfx->transparent_pixel = bg_pixel; } /* if there is no `last' then we need special handling */ if (last == None || (last_gfi && last_gfi->width == gfs->screen_width && last_gfi->height == gfs->screen_height && last_gfi->left == 0 && last_gfi->top == 0 && last_gfi->disposal == GIF_DISPOSAL_BACKGROUND)) { XFillRectangle(gfx->display, pixmap, gfx->image_gc, 0, 0, gfs->screen_width, gfs->screen_height); if (!put_sub_image_colormap(gfx, gfi, gfcm, 0, 0, gfi->width, gfi->height, pixmap, gfi->left, gfi->top)) goto error_exit; return pixmap; } /* use the disposal to create the intermediate image */ XCopyArea(gfx->display, last, pixmap, gfx->image_gc, 0, 0, gfs->screen_width, gfs->screen_height, 0, 0); if (last_last != None && last_gfi->disposal == GIF_DISPOSAL_PREVIOUS) XCopyArea(gfx->display, last_last, pixmap, gfx->image_gc, last_gfi->left, last_gfi->top, last_gfi->width, last_gfi->height, last_gfi->left, last_gfi->top); else if (last_gfi->disposal == GIF_DISPOSAL_BACKGROUND) XFillRectangle(gfx->display, pixmap, gfx->image_gc, last_gfi->left, last_gfi->top, last_gfi->width, last_gfi->height); /* apply image */ if (gfi->transparent < 0) { if (!put_sub_image_colormap(gfx, gfi, gfcm, 0, 0, gfi->width, gfi->height, pixmap, gfi->left, gfi->top)) goto error_exit; } else { image = Gif_XImage(gfx, gfs, gfi); mask = Gif_XMask(gfx, gfs, gfi); if (image == None || mask == None) goto error_exit; XSetClipMask(gfx->display, gfx->image_gc, mask); XSetClipOrigin(gfx->display, gfx->image_gc, gfi->left, gfi->top); XCopyArea(gfx->display, image, pixmap, gfx->image_gc, 0, 0, gfi->width, gfi->height, gfi->left, gfi->top); XSetClipMask(gfx->display, gfx->image_gc, None); XFreePixmap(gfx->display, image); XFreePixmap(gfx->display, mask); } gfx->transparent_pixel = old_transparent; return pixmap; error_exit: if (pixmap) XFreePixmap(gfx->display, pixmap); if (image) XFreePixmap(gfx->display, image); if (mask) XFreePixmap(gfx->display, mask); gfx->transparent_pixel = old_transparent; return None; } /** CREATING AND DESTROYING XCONTEXTS **/ static void delete_xcolormap(Gif_XColormap *gfxc) { Gif_XContext *gfx = gfxc->x_context; Gif_XColormap *prev = 0, *trav = gfx->xcolormap; while (trav != gfxc && trav) { prev = trav; trav = trav->next; } if (gfx->free_deleted_colormap_pixels) deallocate_colors(gfxc); if (prev) prev->next = gfxc->next; else gfx->xcolormap = gfxc->next; Gif_DeleteArray(gfxc->pixels); Gif_Delete(gfxc); } static void delete_colormap_hook(int dummy, void *colormap_x, void *callback_x) { Gif_Colormap *gfcm = (Gif_Colormap *)colormap_x; Gif_XContext *gfx = (Gif_XContext *)callback_x; Gif_XColormap *gfxc; (void) dummy; for (gfxc = gfx->xcolormap; gfxc; gfxc = gfxc->next) if (gfxc->colormap == gfcm) { delete_xcolormap(gfxc); return; } } Gif_XContext * Gif_NewXContextFromVisual(Display *display, int screen_number, Visual *visual, int depth, Colormap colormap) { Gif_XContext *gfx; gfx = Gif_New(Gif_XContext); gfx->display = display; gfx->screen_number = screen_number; gfx->drawable = RootWindow(display, screen_number); gfx->visual = visual; gfx->colormap = colormap; gfx->ncolormap = visual->map_entries; gfx->depth = depth; gfx->closest = 0; gfx->nclosest = 0; gfx->free_deleted_colormap_pixels = 0; gfx->xcolormap = 0; gfx->image_gc = None; gfx->mask_gc = None; gfx->transparent_pixel = 0UL; gfx->foreground_pixel = 1UL; gfx->refcount = 0; Gif_AddDeletionHook(GIF_T_COLORMAP, delete_colormap_hook, gfx); return gfx; } Gif_XContext * Gif_NewXContext(Display *display, Window window) { XWindowAttributes attr; XGetWindowAttributes(display, window, &attr); return Gif_NewXContextFromVisual(display, XScreenNumberOfScreen(attr.screen), attr.visual, attr.depth, attr.colormap); } void Gif_DeleteXContext(Gif_XContext *gfx) { if (!gfx) return; if (--gfx->refcount > 0) return; while (gfx->xcolormap) delete_xcolormap(gfx->xcolormap); if (gfx->image_gc) XFreeGC(gfx->display, gfx->image_gc); if (gfx->mask_gc) XFreeGC(gfx->display, gfx->mask_gc); Gif_DeleteArray(gfx->closest); Gif_Delete(gfx); Gif_RemoveDeletionHook(GIF_T_COLORMAP, delete_colormap_hook, gfx); } #ifdef __cplusplus } #endif xwrits-2.21/xwrits.h 644 41346 41346 27713 7465620227 7746 #ifndef XWRITS_H #define XWRITS_H #include #include #include #include #include #ifndef FD_SET #include #endif #include "gif.h" #include "gifx.h" typedef struct Port Port; typedef struct Options Options; typedef struct Hand Hand; typedef struct Picture Picture; typedef struct Alarm Alarm; #ifdef __cplusplus #define EXTERNFUNCTION extern "C" #else #define EXTERNFUNCTION extern #endif #define xwNEW(typ) (typ *)xmalloc(sizeof(typ)) #define xwNEWARR(typ,num) (typ *)xmalloc(sizeof(typ) * (num)) #define xwREARRAY(var,typ,num) var = (typ *)xrealloc(var, sizeof(typ) * (num)) /*****************************************************************************/ /* Global X stuff */ struct Port { int port_number; /* 0 <= port_number < nports */ const char *display_name; /* name of display */ Display *display; /* display pointer */ int display_unique; /* is this only master Port with display? */ int x_socket; /* socket of X connection */ int screen_number; /* screen number */ Window root_window; /* root window of screen */ int left; /* left edge of display (Xinerama) */ int top; /* top edge of display (Xinerama) */ int width; /* width of root window */ int height; /* height of root window */ struct Port *master; /* points to master Port, if this is a slave */ int nslaves; /* number of slave Ports */ Drawable drawable; /* drawable corresponding to visual */ Visual *visual; /* visual used for new windows */ int depth; /* depth of visual */ Colormap colormap; /* colormap on visual */ unsigned long black; /* black pixel value on colormap */ unsigned long white; /* white pixel value on colormap */ XFontStruct *font; /* font for lock messages */ GC white_gc; /* foreground white, font font */ GC clock_fore_gc; /* foreground black, thick rounded line */ GC clock_hand_gc; /* same as clock_fore_gc */ Gif_XContext *gfx; /* GIF X context */ Atom wm_delete_window_atom; /* atoms for window manager communication */ Atom wm_protocols_atom; Atom mwm_hints_atom; Atom xwrits_window_atom; /* atoms for communication with other xwrits */ Atom xwrits_notify_peer_atom; Atom xwrits_break_atom; Hand *hands; /* list of main hands */ Hand *icon_hands; /* list of icon hands */ Hand *permanent_hand; /* hand that will never be destroyed */ int icon_width; /* preferred icon width */ int icon_height; /* preferred icon height */ Window last_mouse_root; /* last root window the mouse was on */ int last_mouse_x; /* last X position of mouse */ int last_mouse_y; /* last Y position of mouse */ Pixmap bars_pixmap; /* bars background for lock screen */ Window *peers; /* list of peer windows */ int npeers; int peers_capacity; }; extern int nports; extern Port **ports; extern fd_set x_socket_set; extern int max_x_socket; Port *find_port(Display *, Window); void mark_xwrits_window(Port *, Window); Window check_xwrits_window(Port *, Window); /* fake X event types */ #define Xw_DeleteWindow (LASTEvent + 100) #define Xw_TakeBreak (LASTEvent + 101) int default_x_processing(XEvent *); int x_error_handler(Display *, XErrorEvent *); void add_peer(Port *, Window); void notify_peers_rest(void); /*****************************************************************************/ /* Options */ struct Options { struct timeval break_time; /* length of break */ struct timeval min_break_time; /* minimum length of break (+quota) */ struct timeval cancel_type_time; /* typing OK for TIME after cancel */ Gif_Stream *slideshow; /* warn window animation */ Gif_Stream *icon_slideshow; /* warn icon window animation */ const char *slideshow_text; const char *icon_slideshow_text; const char *window_title; double flash_rate_ratio; /* <1, flash fast; >1, flash slow */ struct timeval multiply_delay; /* time between window multiplies */ struct timeval lock_bounce_delay; /* time between lock bounces */ unsigned beep: 1; /* beep when bringing up a warn? */ unsigned clock: 1; /* show clock for time since warn? */ unsigned appear_iconified: 1; /* show warns as icons? */ unsigned never_iconify: 1; /* don't let warns be iconified? */ unsigned top: 1; /* keep warn windows on top? */ unsigned multiply: 1; /* multiply warn windows? */ unsigned lock: 1; /* lock screen? */ unsigned break_clock: 1; /* show clock time left in break? */ int max_hands; /* max number of hands (+multiply) */ struct timeval next_delay; /* delay till go to next options */ Options *next; /* next options */ Options *prev; /* previous options */ }; extern Options *ocurrent; extern struct timeval type_delay; #define MAX_PASSWORD_SIZE 256 extern struct timeval lock_message_delay; extern char *lock_password; /*****************************************************************************/ /* Clocks */ extern struct timeval clock_zero_time; extern struct timeval clock_tick; void init_clock(Port *); void draw_clock(Hand *, const struct timeval *); void draw_all_clocks(const struct timeval *); void erase_clock(Hand *); void erase_all_clocks(void); /*****************************************************************************/ /* Alarms */ #define A_FLASH 0x0001 #define A_AWAKE 0x0002 #define A_CLOCK 0x0004 #define A_MULTIPLY 0x0008 #define A_NEXT_OPTIONS 0x0010 #define A_LOCK_BOUNCE 0x0020 #define A_LOCK_MESS_ERASE 0x0040 #define A_IDLE_SELECT 0x0080 #define A_IDLE_CHECK 0x0100 #define A_MOUSE 0x0200 struct Alarm { Alarm *next; Alarm *prev; struct timeval timer; int action; void *data1; void *data2; unsigned scheduled: 1; }; typedef int (*Alarmloopfunc)(Alarm *, const struct timeval *); typedef int (*Xloopfunc)(XEvent *, const struct timeval *); #define new_alarm(i) new_alarm_data((i), 0, 0) Alarm *new_alarm_data(int, void *, void *); #define grab_alarm(i) grab_alarm_data((i), 0, 0) Alarm *grab_alarm_data(int, void *, void *); void destroy_alarm(Alarm *); void init_scheduler(void); void schedule(Alarm *); #define unschedule(i) unschedule_data((i), 0, 0) void unschedule_data(int, void *, void *); int loopmaster(Alarmloopfunc, Xloopfunc); /*****************************************************************************/ /* Hands */ #define MAX_HANDS 137 struct Hand { Hand *next; Hand *prev; Hand *icon; Port *port; Window w; int x; int y; int width; int height; Window root_child; Gif_Stream *slideshow; int slide; int loopcount; unsigned is_icon: 1; unsigned mapped: 1; unsigned configured: 1; unsigned obscured: 1; unsigned clock: 1; unsigned permanent: 1; unsigned toplevel: 1; }; int active_hands(void); #define NEW_HAND_CENTER 0x8000 #define NEW_HAND_RANDOM 0x7FFF #define NEW_HAND_RANDOM_PORT ((Port *)0) Hand *new_hand(Port *, int x, int y); Hand *new_hand_subwindow(Port *, Window parent, int x, int y); void destroy_hand(Hand *); Hand *find_one_hand(Port *, int mapped); Hand *window_to_hand(Port *, Window, int allow_icon); void draw_slide(Hand *); /*****************************************************************************/ /* Slideshow */ extern Gif_Stream *current_slideshow; extern Gif_Stream *resting_slideshow, *resting_icon_slideshow; extern Gif_Stream *ready_slideshow, *ready_icon_slideshow; extern Gif_Stream *locked_slideshow, *bars_slideshow; #define DEFAULT_FLASH_DELAY_SEC 2 Gif_Stream *get_built_in_image(const char *); Gif_Stream *parse_slideshow(const char *, double, int mono); void set_slideshow(Hand *, Gif_Stream *, const struct timeval *); void set_all_slideshows(Hand *, Gif_Stream *); /*****************************************************************************/ /* Pictures */ struct Picture { int clock_x_off; int clock_y_off; Gif_Image *canonical; Pixmap pix[1]; }; void default_pictures(void); void load_needed_pictures(Window, int, int force_mono); /*****************************************************************************/ /* Idle processing */ extern struct timeval register_keystrokes_delay; extern struct timeval register_keystrokes_gap; extern struct timeval last_key_time; /* time of last keystroke/equivalent */ extern int check_idle; /* check for idle periods? */ extern struct timeval idle_time; /* idle period of idle_time = break */ extern struct timeval warn_idle_time; /* " during warning */ extern int check_mouse; /* pay attention to mouse movement? */ extern struct timeval check_mouse_time; /* next time to check mouse pos */ extern int mouse_sensitivity; /* movement > sensitivity = keypress */ extern int check_quota; /* use quota system? */ extern struct timeval quota_time; /* if idle more than quota_time, count idle time towards break */ extern struct timeval quota_allotment; /* counted towards break */ extern int max_cheats; /* allow this many cheat events before cancelling break */ extern int verbose; /* be verbose */ void watch_keystrokes(Port *, Window, const struct timeval *); void register_keystrokes(Port *, Window); /*****************************************************************************/ /* The high-level procedures */ void error(const char *, ...); void warning(const char *, ...); void message(const char *, ...); #define TRAN_WARN 1 #define TRAN_CANCEL 2 #define TRAN_FAIL 3 #define TRAN_REST 4 #define TRAN_LOCK 5 #define TRAN_AWAKE 6 extern struct timeval first_warn_time; int wait_for_break(const struct timeval *type_time); int warn(int was_lock, Options *first_options); void calculate_break_time(struct timeval *break_over_time, const struct timeval *now); int rest(void); int lock(void); void ready(void); void unmap_all(void); /*****************************************************************************/ /* Time functions */ #define MICRO_PER_SEC 1000000 #define SEC_PER_MIN 60 #define MIN_PER_HOUR 60 #define HOUR_PER_CYCLE 12 #define xwSETTIME(timeval, sec, usec) do { \ (timeval).tv_sec = (sec); (timeval).tv_usec = (usec); \ } while (0) #define xwADDTIME(result, a, b) do { \ (result).tv_sec = (a).tv_sec + (b).tv_sec; \ if (((result).tv_usec = (a).tv_usec+(b).tv_usec) >= MICRO_PER_SEC) { \ (result).tv_sec++; \ (result).tv_usec -= MICRO_PER_SEC; \ } } while (0) #define xwSUBTIME(result, a, b) do { \ (result).tv_sec = (a).tv_sec - (b).tv_sec; \ if (((result).tv_usec = (a).tv_usec - (b).tv_usec) < 0) { \ (result).tv_sec--; \ (result).tv_usec += MICRO_PER_SEC; \ } } while (0) #define xwSETMINTIME(a, b) do { \ if ((b).tv_sec < (a).tv_sec || \ ((b).tv_sec == (a).tv_sec && (b).tv_usec < (a).tv_usec)) \ (a) = (b); \ } while (0) #define xwTIMEGEQ(a, b) ((a).tv_sec > (b).tv_sec || \ ((a).tv_sec == (b).tv_sec && (a).tv_usec >= (b).tv_usec)) #define xwTIMEGT(a, b) ((a).tv_sec > (b).tv_sec || \ ((a).tv_sec == (b).tv_sec && (a).tv_usec > (b).tv_usec)) #define xwTIMELEQ0(a) ((a).tv_sec < 0 || ((a).tv_sec == 0 && (a).tv_usec <= 0)) #define xwTIMELT0(a) ((a).tv_sec < 0 || ((a).tv_sec == 0 && (a).tv_usec < 0)) #ifdef X_GETTIMEOFDAY # define xwGETTIMEOFDAY(a) X_GETTIMEOFDAY(a) #elif GETTIMEOFDAY_PROTO == 0 EXTERNFUNCTION int gettimeofday(struct timeval *, struct timezone *); # define xwGETTIMEOFDAY(a) gettimeofday((a), 0) #elif GETTIMEOFDAY_PROTO == 1 # define xwGETTIMEOFDAY(a) gettimeofday((a)) #else # define xwGETTIMEOFDAY(a) gettimeofday((a), 0) #endif #define xwGETTIME(a) do { xwGETTIMEOFDAY(&(a)); xwSUBTIME((a), (a), genesis_time); } while (0) extern struct timeval genesis_time; #define xwADDDELAY(result, a, d) do { \ (result).tv_sec = (a).tv_sec + ((d)/100); \ if (((result).tv_usec = (a).tv_usec + ((d)%100)*10000) >= MICRO_PER_SEC) { \ (result).tv_sec++; \ (result).tv_usec -= MICRO_PER_SEC; \ } } while (0) #define xwSUBDELAY(result, a, d) do { \ (result).tv_sec = (a).tv_sec - ((d)/100); \ if (((result).tv_usec = (a).tv_usec - ((d)%100)*10000) < 0) { \ (result).tv_sec--; \ (result).tv_usec += MICRO_PER_SEC; \ } } while (0) #endif xwrits-2.21/clock.c 644 41346 41346 6647 7465605130 7453 #include #include "xwrits.h" #include #include #define ClockWidth 30 #define ClockHeight 30 #define ClockHour 7 #define ClockMin 11 #define ClockSec 12 #define HandWidth 1.5 #define HandOffset 1.5 struct timeval clock_zero_time; struct timeval clock_tick; static void draw_hand(Port *port, Drawable drawable, int xin, int yin, int hand_length, int value, int value_cycle, int thin) { double sinv = sin(value * 2 * M_PI / value_cycle); double cosv = cos(value * 2 * M_PI / value_cycle); GC gc = (thin ? port->clock_hand_gc : port->clock_fore_gc); XDrawLine(port->display, drawable, gc, xin, yin, (int)(xin + hand_length * sinv), (int)(yin - hand_length * cosv)); #if 0 double x = xin - HandOffset * sinv + 1; double y = yin + HandOffset * cosv + 1; XPoint points[4]; points[0].x = (int)(x + HandWidth * cosv); points[0].y = (int)(y + HandWidth * sinv); points[1].x = (int)(x + hand_length * sinv); points[1].y = (int)(y - hand_length * cosv); points[2].x = (int)(x - HandWidth * cosv); points[2].y = (int)(y - HandWidth * sinv); points[4] = points[0]; XDrawLines(port->display, drawable, port->clock_fore_gc, points, 3, CoordModeOrigin); #endif } static void draw_1_clock(Hand *hand, int seconds) { Port *port = hand->port; Picture *p; int x, y; int hour, min; if (!hand->slideshow) return; p = (Picture *)(hand->slideshow->images[hand->slide]->user_data); x = p->clock_x_off; y = p->clock_y_off; XFillArc(port->display, hand->w, port->white_gc, x, y, ClockWidth, ClockHeight, 0, 23040); XDrawArc(port->display, hand->w, port->clock_fore_gc, x, y, ClockWidth, ClockHeight, 0, 23040); x += ClockWidth / 2; y += ClockHeight / 2; min = (seconds + 5) / SEC_PER_MIN; hour = min / MIN_PER_HOUR; min %= MIN_PER_HOUR; seconds %= SEC_PER_MIN; if (hour) draw_hand(port, hand->w, x, y, ClockHour, hour, HOUR_PER_CYCLE, 0); draw_hand(port, hand->w, x, y, ClockMin, min, MIN_PER_HOUR, 0); /* draw_hand(port, hand->w, x, y, ClockSec, seconds, SEC_PER_MIN, 1); */ } static int now_to_clock_sec(const struct timeval *now_ptr) { struct timeval now; struct timeval diff; if (now_ptr) now = *now_ptr; else xwGETTIME(now); if (xwTIMEGEQ(now, clock_zero_time)) xwSUBTIME(diff, now, clock_zero_time); else xwSUBTIME(diff, clock_zero_time, now); return diff.tv_sec + (diff.tv_usec >= 500000 ? 1 : 0); } void draw_clock(Hand *h, const struct timeval *now) { draw_1_clock(h, now_to_clock_sec(now)); h->clock = 1; } void draw_all_clocks(const struct timeval *now) { Hand *h; int i, sec = now_to_clock_sec(now); for (i = 0; i < nports; i++) { for (h = ports[i]->hands; h; h = h->next) { if (h->mapped) draw_1_clock(h, sec); h->clock = 1; } XFlush(ports[i]->display); } } void erase_clock(Hand *hand) { Port *port = hand->port; Picture *p; if (!hand->slideshow) return; p = (Picture *)(hand->slideshow->images[hand->slide]->user_data); XCopyArea(port->display, p->pix[port->port_number], hand->w, port->clock_fore_gc, p->clock_x_off - 2, p->clock_y_off - 2, ClockWidth + 4, ClockHeight + 4, p->clock_x_off - 2, p->clock_y_off - 2); hand->clock = 0; } void erase_all_clocks(void) { Hand *h; int i; for (i = 0; i < nports; i++) for (h = ports[i]->hands; h; h = h->next) { if (h->mapped && h->clock) erase_clock(h); h->clock = 0; } } xwrits-2.21/hands.c 644 41346 41346 32632 7465620221 7464 #include #include "xwrits.h" #include #include #include #include #include #define NEW_HAND_TRIES 6 /* creating a new hand */ static void get_icon_size(Port *port) { XIconSize *ic; int nic; int w = ocurrent->icon_slideshow->screen_width; int h = ocurrent->icon_slideshow->screen_height; if (XGetIconSizes(port->display, port->root_window, &ic, &nic) != 0) { if (nic != 0) { if (w < ic->min_width) w = ic->min_width; if (h < ic->min_height) h = ic->min_height; if (w > ic->max_width) w = ic->max_width; if (h > ic->max_height) h = ic->max_height; } XFree(ic); } port->icon_width = w; port->icon_height = h; } #define xwMAX(i, j) ((i) > (j) ? (i) : (j)) #define xwMIN(i, j) ((i) < (j) ? (i) : (j)) /* get_best_position: gets the best (x, y) pair from the list of pairs stored in xlist and ylist (num pairs overall). Best means `covering smallest number of existing hands.' Returns it in *retx and *rety */ static void get_best_position(Port *port, int *xlist, int *ylist, int num, int width, int height, int *retx, int *rety) { unsigned int best_penalty = 0x8000U; unsigned int penalty; int i, overw, overh, best = 0; Hand *h; for (i = 0; i < num; i++) { int x1 = xlist[i], y1 = ylist[i]; int x2 = x1 + width, y2 = y1 + height; penalty = 0; for (h = port->hands; h; h = h->next) if (h->mapped) { overw = xwMIN(x2, h->x + h->width) - xwMAX(x1, h->x); overh = xwMIN(y2, h->y + h->height) - xwMAX(y1, h->y); if (overw > 0 && overh > 0) penalty += overw * overh; } if (penalty < best_penalty) { best_penalty = penalty; best = i; } } *retx = xlist[best]; *rety = ylist[best]; } Hand * new_hand(Port *slave_port, int x, int y) { static XClassHint classh; static XSizeHints *xsh; static XWMHints *xwmh; static XTextProperty window_name, icon_name; static uint32_t *mwm_hints; Hand *nh = xwNEW(Hand); Hand *nh_icon = xwNEW(Hand); int width = ocurrent->slideshow->screen_width; int height = ocurrent->slideshow->screen_height; Port *port; /* check for random port, patch by Peter Maydell */ if (slave_port == NEW_HAND_RANDOM_PORT) slave_port = ports[(rand() >> 4) % nports]; port = slave_port->master; /* is this the permanent hand? */ if (!port->permanent_hand) { nh->permanent = 1; port->permanent_hand = nh; } else nh->permanent = 0; /* set position and size */ if (x == NEW_HAND_CENTER) x = slave_port->left + (slave_port->width - width) / 2; if (y == NEW_HAND_CENTER) y = slave_port->top + (slave_port->height - height) / 2; if (x == NEW_HAND_RANDOM || y == NEW_HAND_RANDOM) { int xs[NEW_HAND_TRIES], ys[NEW_HAND_TRIES], i; int xdist = slave_port->width - width; int ydist = slave_port->height - height; int xrand = (x == NEW_HAND_RANDOM); int yrand = (y == NEW_HAND_RANDOM); for (i = 0; i < NEW_HAND_TRIES; i++) { xs[i] = (xrand ? slave_port->left + ((rand() >> 4) % xdist) : x); ys[i] = (yrand ? slave_port->top + ((rand() >> 4) % ydist) : y); } get_best_position(port, xs, ys, NEW_HAND_TRIES, width, height, &x, &y); } if (!port->icon_width) get_icon_size(port); if (!xwmh) { const char *stringlist[2]; stringlist[0] = ocurrent->window_title; stringlist[1] = NULL; XStringListToTextProperty((char **)stringlist, 1, &window_name); XStringListToTextProperty((char **)stringlist, 1, &icon_name); classh.res_name = "xwrits"; classh.res_class = "XWrits"; xsh = XAllocSizeHints(); xsh->flags = USPosition | PMinSize | PMaxSize; xsh->min_width = xsh->max_width = width; xsh->min_height = xsh->max_height = height; xwmh = XAllocWMHints(); xwmh->flags = InputHint | StateHint | IconWindowHint; xwmh->input = True; /* Silly hackery to get the MWM appearance *just right*: ie., no resize handles or maximize button, no Resize or Maximize entries in window menu. The constitution of the property itself was inferred from data in and output of xprop. */ mwm_hints = xwNEWARR(uint32_t, 4); mwm_hints[0] = (1L << 0) | (1L << 1); /* flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS */ mwm_hints[1] = (1L << 2) | (1L << 5); /* functions = MWM_FUNC_MOVE | MWM_FUNC_CLOSE */ mwm_hints[2] = (1L << 1) | (1L << 3) | (1L << 4); /* decorations = MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MENU */ mwm_hints[3] = ~(0L); /* Add MINIMIZE options only if the window might be iconifiable */ if (!ocurrent->never_iconify) { mwm_hints[1] |= (1L << 3); /* MWM_FUNC_MINIMIZE */ mwm_hints[2] |= (1L << 5); /* MWM_DECOR_MINIMIZE */ } } /* create windows */ { XSetWindowAttributes setattr; unsigned long setattr_mask; setattr.colormap = port->colormap; setattr.backing_store = NotUseful; setattr.save_under = False; setattr.border_pixel = 0; setattr.background_pixel = 0; setattr_mask = CWColormap | CWBorderPixel | CWBackPixel | CWBackingStore | CWSaveUnder; nh->w = XCreateWindow (port->display, port->root_window, x, y, width, height, 0, port->depth, InputOutput, port->visual, setattr_mask, &setattr); xwmh->icon_window = nh_icon->w = XCreateWindow (port->display, port->root_window, x, y, port->icon_width, port->icon_height, 0, port->depth, InputOutput, port->visual, setattr_mask, &setattr); } /* set XWRITS_WINDOW property early to minimize races */ mark_xwrits_window(port, nh->w); xsh->x = x; xsh->y = y; xwmh->initial_state = ocurrent->appear_iconified ? IconicState : NormalState; XSetWMProperties(port->display, nh->w, &window_name, &icon_name, NULL, 0, xsh, xwmh, &classh); XSetWMProtocols(port->display, nh->w, &port->wm_delete_window_atom, 1); XChangeProperty(port->display, nh->w, port->mwm_hints_atom, port->mwm_hints_atom, 32, PropModeReplace, (unsigned char *)mwm_hints, 4); XSelectInput(port->display, nh->w, ButtonPressMask | StructureNotifyMask | KeyPressMask | VisibilityChangeMask | ExposureMask); XSelectInput(port->display, nh_icon->w, StructureNotifyMask); nh->port = port; nh->icon = nh_icon; nh->x = x; /* will be set correctly */ nh->y = y; /* by next ConfigureNotify */ nh->width = width; nh->height = height; nh->root_child = nh->w; nh->is_icon = 0; nh->mapped = 0; nh->configured = 0; nh->slideshow = 0; nh->clock = 0; nh->toplevel = 1; if (port->hands) port->hands->prev = nh; nh->next = port->hands; nh->prev = 0; port->hands = nh; nh_icon->port = port; nh_icon->icon = nh; nh_icon->root_child = nh->w; nh_icon->is_icon = 1; nh_icon->mapped = 0; nh_icon->configured = 0; nh_icon->slideshow = 0; nh_icon->clock = 0; nh_icon->permanent = 0; nh_icon->toplevel = 1; if (port->icon_hands) port->icon_hands->prev = nh_icon; nh_icon->next = port->icon_hands; nh_icon->prev = 0; port->icon_hands = nh_icon; return nh; } Hand * new_hand_subwindow(Port *port, Window parent, int x, int y) { Hand *nh = xwNEW(Hand); int width = ocurrent->slideshow->screen_width; int height = ocurrent->slideshow->screen_height; unsigned parent_width, parent_height; port = port->master; if (x == NEW_HAND_CENTER || y == NEW_HAND_CENTER || x == NEW_HAND_RANDOM || y == NEW_HAND_RANDOM) { /* get dimensions of 'parent' */ Window root; int x, y; unsigned bw, depth; (void) XGetGeometry(port->display, parent, &root, &x, &y, &parent_width, &parent_height, &bw, &depth); } if (x == NEW_HAND_CENTER) x = (parent_width - width) / 2; if (y == NEW_HAND_CENTER) y = (parent_height - height) / 2; if (x == NEW_HAND_RANDOM) x = (rand() >> 4) % (parent_width - width); if (y == NEW_HAND_RANDOM) y = (rand() >> 4) % (parent_height - height); { XSetWindowAttributes setattr; unsigned long setattr_mask; setattr.colormap = port->colormap; setattr.backing_store = NotUseful; setattr.save_under = False; setattr.border_pixel = 0; setattr.background_pixel = 0; setattr_mask = CWColormap | CWBorderPixel | CWBackPixel | CWBackingStore | CWSaveUnder; nh->w = XCreateWindow (port->display, parent, x, y, width, height, 0, port->depth, InputOutput, port->visual, setattr_mask, &setattr); } mark_xwrits_window(port, nh->w); XSelectInput(port->display, nh->w, ButtonPressMask | StructureNotifyMask | KeyPressMask | VisibilityChangeMask | ExposureMask); nh->port = port; nh->icon = 0; nh->x = x; /* will be set correctly */ nh->y = y; /* by next ConfigureNotify */ nh->width = width; nh->height = height; nh->root_child = nh->w; nh->is_icon = 0; nh->mapped = 0; nh->configured = 0; nh->slideshow = 0; nh->clock = 0; nh->permanent = 0; nh->toplevel = 0; if (port->hands) port->hands->prev = nh; nh->next = port->hands; nh->prev = 0; port->hands = nh; return nh; } /* destroy a hand */ void destroy_hand(Hand *h) { Port *port = h->port; assert(!h->is_icon); unschedule_data(A_FLASH, h, 0); /* 29.Jan.2000 oops -- forgot to do this, it caused segfaults */ if (h->icon) unschedule_data(A_FLASH, h->icon, 0); if (h->permanent) { XEvent event; /* last remaining hand; don't destroy it, unmap it */ XUnmapWindow(port->display, h->w); /* Synthetic UnmapNotify required by ICCCM to withdraw the window */ event.type = UnmapNotify; event.xunmap.event = port->root_window; event.xunmap.window = h->w; event.xunmap.from_configure = False; XSendEvent(port->display, port->root_window, False, SubstructureRedirectMask | SubstructureNotifyMask, &event); /* mark hand as unmapped now */ h->mapped = h->icon->mapped = 0; } else { if (h->icon) { Hand *ih = h->icon; XDestroyWindow(port->display, ih->w); if (ih->prev) ih->prev->next = ih->next; else port->icon_hands = ih->next; if (ih->next) ih->next->prev = ih->prev; xfree(ih); } XDestroyWindow(port->display, h->w); if (h->prev) h->prev->next = h->next; else port->hands = h->next; if (h->next) h->next->prev = h->prev; xfree(h); } } /* count active hands (mapped or iconified) */ int active_hands(void) { Hand *h; int i, n = 0; for (i = 0; i < nports; i++) for (h = ports[i]->hands; h; h = h->next) if (h->mapped || h->icon->mapped) n++; return n; } /* translate a Window to a Hand */ Hand * window_to_hand(Port *port, Window w, int allow_icons) { Hand *h; for (h = port->hands; h; h = h->next) if (h->w == w) return h; if (allow_icons) for (h = port->icon_hands; h; h = h->next) if (h->w == w) return h; return 0; } /* draw a picture on a hand */ static void ensure_picture(Port *port, Gif_Stream *gfs, int n) { Gif_Image *gfi = gfs->images[n]; Picture *p, *last_p, *last_last_p; int i; int picn = port->port_number; for (i = 0; i < n; i++) { p = (Picture *)gfs->images[i]->user_data; if (!p->pix[picn]) /* no picture cached for earlier image */ ensure_picture(port, gfs, i); } p = (Picture *)gfi->user_data; last_p = (n > 0 ? (Picture *)gfs->images[n-1]->user_data : 0); last_last_p = (n > 1 ? (Picture *)gfs->images[n-2]->user_data : 0); /* reuse pixmaps from other streams */ if (p->canonical && gfi->transparent < 0 && gfi->left == 0 && gfi->top == 0 && gfi->width == gfs->screen_width && gfi->height == gfs->screen_height && ((Picture *)p->canonical->user_data)->pix[picn]) { p->pix[picn] = ((Picture *)p->canonical->user_data)->pix[picn]; return; } else if (p->canonical) p->canonical = 0; p->pix[picn] = Gif_XNextImage (port->gfx, (last_last_p ? last_last_p->pix[picn] : None), (last_p ? last_p->pix[picn] : None), gfs, n); } void draw_slide(Hand *h) { Gif_Stream *gfs; Gif_Image *gfi; Port *port; Picture *p; if (!h || !h->slideshow) return; gfs = h->slideshow; gfi = gfs->images[h->slide]; p = (Picture *)gfi->user_data; port = h->port; if (!p->pix[port->port_number]) ensure_picture(port, gfs, h->slide); XSetWindowBackgroundPixmap(port->display, h->w, p->pix[port->port_number]); XClearWindow(port->display, h->w); if (h->clock) draw_clock(h, 0); } /* unmap all windows */ void unmap_all(void) { int i; for (i = 0; i < nports; i++) { Hand *prev = 0, *trav = ports[i]->hands; while (trav) { if (trav->permanent) { prev = trav; trav->slideshow = 0; } destroy_hand(trav); trav = (prev == 0 ? ports[i]->hands : prev->next); } XFlush(ports[i]->display); } } /* search for some hand on a given port, which might be a slave, or have slaves */ Hand * find_one_hand(Port *port, int mapped) { Hand *h, *acceptable; if (port->master == port) { if (!mapped) return port->hands; else for (h = acceptable = port->hands; h; h = h->next) if (h->mapped) return h; } else { for (h = port->master->hands, acceptable = 0; h; h = h->next) if (h->x >= port->left && h->x < port->left + port->width && h->y >= port->top && h->y < port->top + port->height) { acceptable = h; if (mapped && h->mapped) return h; } if (!acceptable) acceptable = new_hand(port, NEW_HAND_CENTER, NEW_HAND_CENTER); } if (mapped && !acceptable->mapped) XMapRaised(port->display, acceptable->w); return acceptable; } xwrits-2.21/lock.c 644 41346 41346 21246 7465610724 7325 #include #include "xwrits.h" #include #include #include struct timeval lock_message_delay; char *lock_password; #define REDRAW_MESSAGE ((char *)1L) #define MAX_MESSAGE_SIZE (256 + MAX_PASSWORD_SIZE) static Window *covers; static Hand **lock_hands; static char password[MAX_PASSWORD_SIZE]; static int password_pos; static void lock_hand_position(Port *port, int *x, int *y) { /* 8.Feb.2002: Fix bug reported by Carlos O'Donell Jr. -- large lock pictures (full screen height or width) caused arithmetic problems */ if (port->width <= locked_slideshow->screen_width) *x = port->left; else if (bars_slideshow) { /* Align image with bars. */ /* nbars = max x s.t. x*BARS_WIDTH <= port_width - lock_width */ int nbars = (port->width - locked_slideshow->screen_width) / bars_slideshow->screen_width; *x = port->left + ((rand() >> 4) % (nbars + 1)) * bars_slideshow->screen_width; } else *x = port->left + (rand() >> 4) % (port->width - locked_slideshow->screen_width); if (port->height <= locked_slideshow->screen_height) *y = port->top; else if (bars_slideshow) /* Default monochromatic bars repeat every 4 pixels, and our monochromatic hands image is aligned on the 2nd pixel; thus "& ~0x3 | 0x2" */ *y = port->top + ((((rand() >> 4) % (port->height - locked_slideshow->screen_height)) & ~0x3) | 0x2); else *y = port->top + (rand() >> 4) % (port->height - locked_slideshow->screen_height); } static void move_locks(void) { int i, x, y; struct timeval now; xwGETTIME(now); for (i = 0; i < nports; i++) if (covers[i]) { lock_hand_position(ports[i], &x, &y); XClearWindow(ports[i]->display, lock_hands[i]->w); XMoveWindow(ports[i]->display, lock_hands[i]->w, x, y); if (ocurrent->break_clock) draw_clock(lock_hands[i], &now); XFlush(ports[i]->display); } } static void find_message_boundaries(Port *port, const char *message, int *x, int *y, int *w, int *h) { int length = strlen(message); *w = XTextWidth(port->font, message, length); *h = port->font->ascent + port->font->descent; *x = port->left + (port->width - *w) / 2; *y = port->top + (port->height - *h) / 2; } static void draw_message(const char *message) { static char cur_message[MAX_MESSAGE_SIZE]; int i, x, y, w, h; int redraw = (message == REDRAW_MESSAGE); int length; if (redraw) message = (cur_message[0] ? cur_message : 0); length = (message ? strlen(message) : 0); assert(length < MAX_MESSAGE_SIZE); for (i = 0; i < nports; i++) if (covers[i]) { if (cur_message[0] && !redraw) { find_message_boundaries(ports[i], cur_message, &x, &y, &w, &h); XClearArea(ports[i]->display, covers[i], x, y, w, h, False); XClearArea(ports[i]->display, lock_hands[i]->w, x - lock_hands[i]->x, y - lock_hands[i]->y, w, h, False); } if (message) { find_message_boundaries(ports[i], message, &x, &y, &w, &h); XDrawString(ports[i]->display, covers[i], ports[i]->white_gc, x, y + ports[i]->font->ascent, message, length); } } if (!redraw) { if (message) strcpy(cur_message, message); else cur_message[0] = 0; } } static int check_password(XKeyEvent *xkey) { KeySym keysym; XComposeStatus compose; char c; int nchars = XLookupString(xkey, &c, 1, &keysym, &compose); int incorrect_message = 0; if (keysym == XK_Return || (nchars == 1 && (c == '\n' || c == '\r'))) { password[password_pos] = 0; password_pos = 0; if (strcmp(lock_password, password) == 0) return 1; else incorrect_message = 1; } else if (keysym == XK_Delete || keysym == XK_BackSpace) { if (password_pos > 0) password_pos--; } else if (nchars == 1) { if (password_pos < MAX_PASSWORD_SIZE - 1) password[password_pos++] = c; } if (incorrect_message) draw_message("Incorrect password! Try again"); else { char message[MAX_MESSAGE_SIZE]; strcpy(message, "Enter password to unlock screen"); if (password_pos > 0) { int i, pos = strlen(message); message[pos++] = ':'; message[pos++] = ' '; for (i = 0; i < password_pos; i++) message[pos++] = '*'; message[pos++] = 0; } draw_message(message); } return 0; } static int lock_alarm_loop(Alarm *a, const struct timeval *now) { switch (a->action) { case A_LOCK_BOUNCE: move_locks(); draw_message(REDRAW_MESSAGE); xwADDTIME(a->timer, a->timer, ocurrent->lock_bounce_delay); schedule(a); break; case A_LOCK_MESS_ERASE: draw_message(0); password_pos = 0; break; } return 0; } static int lock_x_loop(XEvent *e, const struct timeval *now) { Alarm *a; Port *port; switch (e->type) { case KeyPress: if (check_password(&e->xkey)) return TRAN_FAIL; a = grab_alarm(A_LOCK_MESS_ERASE); if (!a) a = new_alarm(A_LOCK_MESS_ERASE); xwGETTIME(a->timer); xwADDTIME(a->timer, a->timer, lock_message_delay); schedule(a); break; case VisibilityNotify: if (e->xvisibility.state != VisibilityUnobscured) { port = find_port(e->xvisibility.display, e->xvisibility.window); XRaiseWindow(port->display, covers[port->port_number]); draw_message(REDRAW_MESSAGE); } break; } return 0; } int lock(void) { struct timeval now, break_over_time; Alarm *a; int i, successful_grabs; XEvent event; int tran = TRAN_FAIL; /* clear slideshows */ /* Do this first so later set_slideshows start from scratch. */ for (i = 0; i < nports; i++) { set_all_slideshows(ports[i]->hands, 0); set_all_slideshows(ports[i]->icon_hands, 0); } /* calculate break time */ xwGETTIME(now); calculate_break_time(&break_over_time, &now); /* if break already over, return */ if (xwTIMEGEQ(now, break_over_time)) return TRAN_AWAKE; /* create covers */ if (!covers) { covers = (Window *)xmalloc(sizeof(Window) * nports); lock_hands = (Hand **)xmalloc(sizeof(Hand *) * nports); } for (i = 0; i < nports; i++) { XSetWindowAttributes setattr; unsigned long cwmask = CWBackingStore | CWSaveUnder | CWOverrideRedirect | CWBorderPixel | CWColormap; if (!ports[i]->bars_pixmap) { setattr.background_pixel = ports[i]->black; cwmask |= CWBackPixel; } else { setattr.background_pixmap = ports[i]->bars_pixmap; cwmask |= CWBackPixmap; } setattr.backing_store = NotUseful; setattr.save_under = False; setattr.override_redirect = True; setattr.colormap = ports[i]->colormap; setattr.border_pixel = 0; covers[i] = XCreateWindow (ports[i]->display, ports[i]->root_window, ports[i]->left, ports[i]->top, ports[i]->width, ports[i]->height, 0, ports[i]->depth, InputOutput, ports[i]->visual, cwmask, &setattr); XSelectInput(ports[i]->display, covers[i], ButtonPressMask | ButtonReleaseMask | KeyPressMask | VisibilityChangeMask | ExposureMask); mark_xwrits_window(ports[i], covers[i]); XMapRaised(ports[i]->display, covers[i]); XSync(ports[i]->display, False); } /* grab keyboard */ successful_grabs = 0; for (i = 0; i < nports; i++) { XWindowEvent(ports[i]->display, covers[i], ExposureMask, &event); if (XGrabKeyboard(ports[i]->display, covers[i], True, GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess) { int x, y; lock_hand_position(ports[i], &x, &y); lock_hands[i] = new_hand_subwindow(ports[i], covers[i], x, y); set_slideshow(lock_hands[i], locked_slideshow, 0); XMapRaised(ports[i]->display, lock_hands[i]->w); successful_grabs++; } else { XDestroyWindow(ports[i]->display, covers[i]); covers[i] = None; lock_hands[i] = 0; } } if (!successful_grabs) goto no_keyboard_grab; /* set up clocks */ a = new_alarm(A_AWAKE); a->timer = break_over_time; schedule(a); a = new_alarm(A_LOCK_BOUNCE); xwADDTIME(a->timer, ocurrent->lock_bounce_delay, now); schedule(a); if (ocurrent->break_clock) { clock_zero_time = break_over_time; draw_all_clocks(&now); a = new_alarm(A_CLOCK); xwADDTIME(a->timer, now, clock_tick); schedule(a); } draw_message(0); password_pos = 0; tran = loopmaster(lock_alarm_loop, lock_x_loop); no_keyboard_grab: unschedule(A_FLASH | A_CLOCK | A_LOCK_BOUNCE | A_AWAKE | A_LOCK_MESS_ERASE); erase_all_clocks(); for (i = 0; i < nports; i++) if (covers[i]) { XUngrabKeyboard(ports[i]->display, CurrentTime); destroy_hand(lock_hands[i]); XDestroyWindow(ports[i]->display, covers[i]); XFlush(ports[i]->display); } assert(tran == TRAN_AWAKE || tran == TRAN_FAIL); return tran; } xwrits-2.21/main.c 644 41346 41346 110420 7465621366 7336 #include #include "xwrits.h" #include #include #include #include #include #include #ifdef HAVE_XINERAMA #include #endif static Options onormal; Options *ocurrent; struct timeval genesis_time; static struct timeval zero = {0, 0}; struct timeval first_warn_time; struct timeval last_key_time; static struct timeval normal_type_time; Gif_Stream *resting_slideshow, *resting_icon_slideshow; static const char *resting_slideshow_text = "&resting"; static const char *resting_icon_slideshow_text = "&restingicon"; Gif_Stream *ready_slideshow, *ready_icon_slideshow; static const char *ready_slideshow_text = "&ready"; static const char *ready_icon_slideshow_text = "&readyicon"; Gif_Stream *locked_slideshow; static const char *locked_slideshow_text = "&locked"; Gif_Stream *bars_slideshow; static const char *bars_slideshow_text = 0; int nports; Port **ports; fd_set x_socket_set; int max_x_socket; int check_idle; struct timeval idle_time; struct timeval warn_idle_time; int check_mouse; int mouse_sensitivity; struct timeval check_mouse_time; int check_quota; struct timeval quota_time; struct timeval quota_allotment; #define MAX_CHEATS_UNSET -97979797 int max_cheats; static int allow_cheats; int verbose; static int force_mono = 0; static int multiscreen = 0; static void short_usage(void) { fprintf(stderr, "Usage: xwrits [-display DISPLAY] [typetime=TIME] [breaktime=TIME] [OPTION]...\n\ Try `xwrits --help' for more information.\n"); exit(1); } static void usage(void) { printf("\ `Xwrits' reminds you to take wrist breaks, which should help you prevent or\n\ manage a repetitive stress injury. It runs on X.\n\ \n\ Usage: xwrits [-display DISPLAY] [typetime=TIME] [breaktime=TIME] [OPTION]...\n\ \n\ All options may be abbreviated to their unique prefixes. The three forms\n\ `OPTION', `--OPTION', and `+OPTION' are equivalent. Options listed as\n\ `+OPTION' can be on or off; they are normally off, and you can turn them off\n\ explicitly with `-OPTION'.\n\ \n\ General options:\n\ --display DISPLAY Monitor the X display DISPLAY. You can monitor more than\n\ one display by giving this option multiple times.\n\ --multiscreen Open every screen for each DISPLAY.\n\ --help Print this message and exit.\n\ --version Print version number and exit.\n\ \n"); printf("\ Break characteristics:\n\ typetime=TIME, t=TIME Allow typing for TIME (default 55 minutes).\n\ breaktime=TIME, b=TIME Breaks last for TIME (default 5 minutes).\n\ +lock Lock the keyboard during the break.\n\ password=TEXT Set the password for unlocking the keyboard.\n\ +mouse Monitor your mouse movements.\n\ +idle[=TIME] Leaving the keyboard idle for TIME is the same as taking\n\ a break. On by default. Default TIME is breaktime.\n\ +quota[=TIME] Leaving the keyboard idle for more than TIME reduces next\n\ break length by the idle time. Default TIME is 1 minute.\n\ minbreaktime=TIME Minimum break length is TIME (see +quota).\n\ +cheat[=NUM] Allow NUM keystrokes before cancelling a break.\n\ canceltime=TIME, ct=TIME Allow typing for TIME after a break is cancelled\n\ (default 10 minutes).\n\ \n"); printf("\ Appearance:\n\ after=TIME Change behavior if warning window is ignored for TIME.\n\ Options following `after' give new behavior.\n\ +beep Beep when the warning window appears.\n\ +breakclock Show how much time remains during the break.\n\ +clock Show how long you have ignored the warning window.\n\ +finger Be rude.\n\ +finger=CULTURE Be rude according to CULTURE. Choices: `american',\n\ `korean' (synonyms `japanese', `russian'), `german'.\n\ flashtime=RATE Flash the warning window at RATE (default 2 sec).\n\ +iconified Warning windows appear as icons.\n\ lock-picture=GIF-FILE, lp=GIF-FILE Show GIF animation on lock window.\n\ maxhands=NUM Maximum number of warning windows is NUM (default 25).\n\ +mono Use monochrome pictures.\n\ +multiply=PERIOD Make a new warning window every PERIOD.\n\ +noiconify Don't let anyone iconify the warning window.\n\ ready-picture=GIF-FILE, okp=GIF-FILE Show GIF animation on the `OK' window.\n\ rest-picture=GIF-FILE, rp=GIF-FILE Show GIF animation on resting window.\n\ title=TITLE Set xwrits window title to TITLE.\n\ +top Keep the warning windows on top of the window stack.\n\ warning-picture=GIF-FILE, wp=GIF-FILE Show GIF animation on the warning\n\ window.\n\ \n\ Report bugs and suggestions to .\n"); } void error(const char *format, ...) { va_list val; va_start(val, format); fprintf(stderr, "xwrits: "); vfprintf(stderr, format, val); fprintf(stderr, "\n"); va_end(val); exit(1); } void warning(const char *format, ...) { va_list val; va_start(val, format); fprintf(stderr, "xwrits: warning: "); vfprintf(stderr, format, val); fprintf(stderr, "\n"); va_end(val); } void message(const char *format, ...) { va_list val; va_start(val, format); fprintf(stderr, "xwrits: "); vfprintf(stderr, format, val); fprintf(stderr, "\n"); va_end(val); } /* ports and peers */ static Port * add_port(const char *display_name, Display *display, int screen_number, Port *master) { Port *p = (Port *)xmalloc(sizeof(Port)); ports = (Port **)xrealloc(ports, sizeof(Port *) * (nports + 1)); if (!ports || !p) error("out of memory!"); ports[nports] = p; memset(p, 0, sizeof(Port)); p->display_name = display_name; p->display = display; p->screen_number = screen_number; p->master = (master ? master : p); p->nslaves = 0; if (master) master->nslaves++; p->port_number = nports; nports++; return ports[nports - 1]; } Port * find_port(Display *display, Window window) { int screen_number, i; /* first, look using only 'display' */ for (i = 0; i < nports; i++) if (ports[i]->display == display && ports[i]->display_unique) return ports[i]->master; /* if display not unique (or not found), try 'screen_number' also */ screen_number = 0; if (window) { XWindowAttributes attr; if (XGetWindowAttributes(display, window, &attr) != 0) screen_number = XScreenNumberOfScreen(attr.screen); } for (i = 0; i < nports; i++) if (ports[i]->display == display && ports[i]->screen_number == screen_number) return ports[i]->master; /* nothing found */ return 0; } void add_peer(Port *port, Window peer) { XEvent e; int i; if (peer == port->permanent_hand->w) return; for (i = 0; i < port->npeers; i++) if (peer == port->peers[i]) return; if (port->npeers == port->peers_capacity) { port->peers_capacity *= 2; xwREARRAY(port->peers, Window, port->peers_capacity); } port->peers[port->npeers++] = peer; /* send peering message to the peer */ e.xclient.type = ClientMessage; e.xclient.window = peer; e.xclient.message_type = port->xwrits_notify_peer_atom; e.xclient.format = 32; e.xclient.data.l[0] = port->permanent_hand->w; XSendEvent(port->display, peer, True, 0, &e); } void notify_peers_rest(void) { int i, j; for (i = 0; i < nports; i++) for (j = 0; j < ports[i]->npeers; j++) if (check_xwrits_window(ports[i], ports[i]->peers[j])) { XEvent e; e.xclient.type = ClientMessage; e.xclient.window = ports[i]->peers[j]; e.xclient.message_type = ports[i]->xwrits_break_atom; e.xclient.format = 32; e.xclient.data.l[0] = 1; XSendEvent(ports[i]->display, ports[i]->peers[j], True, 0, &e); } else { /* remove peer */ ports[i]->peers[j] = ports[i]->peers[ ports[i]->npeers - 1 ]; ports[i]->npeers--; j--; } } void mark_xwrits_window(Port *port, Window w) { int scrap = port->permanent_hand->w; assert(scrap); XChangeProperty(port->display, w, port->xwrits_window_atom, XA_INTEGER, 32, PropModeReplace, (unsigned char *)&scrap, 1); } Window check_xwrits_window(Port *port, Window w) { Atom actual_type; int actual_format; unsigned long nitems, bytes_after; long *prop; if (XGetWindowProperty(port->display, w, port->xwrits_window_atom, 0, 1, False, XA_INTEGER, &actual_type, &actual_format, &nitems, &bytes_after, (unsigned char **)&prop) == Success) { Window xwrits_window = (actual_format ? *prop : None); XFree((unsigned char *)prop); return xwrits_window; } else return None; } /* default X processing */ static void find_root_child(Hand *h) { Display *display = h->port->display; Window w = h->w; Window root, parent, *children; unsigned nchildren; h->root_child = None; while (XQueryTree(display, w, &root, &parent, &children, &nchildren)) { if (children) XFree(children); if (parent == root) { h->root_child = w; /* set XWRITS_WINDOW property on child of root */ mark_xwrits_window(h->port, w); break; } else w = parent; } } int default_x_processing(XEvent *e) { Hand *h; Display *display = e->xany.display; Port *port; switch (e->type) { case ConfigureNotify: port = find_port(display, e->xconfigure.window); h = window_to_hand(port, e->xconfigure.window, 1); if (!h) break; h->configured = 1; h->x = e->xconfigure.x; h->y = e->xconfigure.y; h->width = e->xconfigure.width; h->height = e->xconfigure.height; find_root_child(h); break; case ReparentNotify: port = find_port(display, e->xreparent.window); if ((h = window_to_hand(port, e->xreparent.window, 1))) find_root_child(h); break; case MapNotify: port = find_port(display, e->xmap.window); if ((h = window_to_hand(port, e->xmap.window, 1))) { draw_slide(h); h->mapped = 1; } break; case UnmapNotify: port = find_port(display, e->xunmap.window); if ((h = window_to_hand(port, e->xunmap.window, 1))) h->mapped = 0; break; case VisibilityNotify: port = find_port(display, e->xvisibility.window); if ((h = window_to_hand(port, e->xvisibility.window, 0))) { if (e->xvisibility.state == VisibilityUnobscured) h->obscured = 0; else h->obscured = 1; } break; case Expose: port = find_port(display, e->xexpose.window); h = window_to_hand(port, e->xexpose.window, 0); if (e->xexpose.count == 0 && h && h->clock) draw_clock(h, 0); break; case ClientMessage: /* change e->type depending on the message */ port = find_port(display, e->xclient.window); h = window_to_hand(port, e->xclient.window, 0); if (h) { if (e->xclient.message_type == port->wm_protocols_atom && (Atom)(e->xclient.data.l[0]) == port->wm_delete_window_atom) { e->type = Xw_DeleteWindow; destroy_hand(h); } else if (e->xclient.message_type == port->xwrits_break_atom && e->xclient.data.l[0] != 0) e->type = Xw_TakeBreak; else if (e->xclient.message_type == port->xwrits_notify_peer_atom) { Window w = (Window)e->xclient.data.l[0]; add_peer(port, w); } } break; /* for idle processing */ case CreateNotify: { struct timeval now; xwGETTIME(now); port = find_port(display, e->xcreatewindow.window); watch_keystrokes(port, e->xcreatewindow.window, &now); break; } case DestroyNotify: /* We must unschedule any IdleSelect events for fear of selecting input on a destroyed window. There is a race condition here because X communication is asynchronous. */ port = find_port(display, e->xdestroywindow.window); unschedule_data(A_IDLE_SELECT, (void *)port, (void *)e->xdestroywindow.window); if (verbose) fprintf(stderr, "Window 0x%x: destroyed\n", (unsigned)e->xdestroywindow.window); break; case MappingNotify: /* Should listen to X mapping events! */ XRefreshKeyboardMapping(&e->xmapping); break; } return 0; } /* option parsing */ static int strtointerval(char *s, char **stores, struct timeval *iv) { double sec = 0; long integral_sec; int ok = 0; /* read minutes */ if (isdigit(*s)) { sec = strtol(s, &s, 10) * SEC_PER_MIN; ok = 1; } if (*s == '.') { sec += strtod(s, &s) * SEC_PER_MIN; ok = 1; } /* read seconds */ if (*s == ':' && (isdigit(s[1]) || s[1] == '.')) { sec += strtod(s+1, &s); ok = 1; } else if (*s == ':' && s[1] == 0) /* accept `MINUTES:' */ s++; /* return */ if (stores) *stores = s; if (!ok || *s != 0) return 0; integral_sec = (long)(floor(sec)); iv->tv_sec = integral_sec; iv->tv_usec = (int)(MICRO_PER_SEC * (sec - integral_sec)); return 1; } #define ARGSHIFT do { argc--; argv++; } while (0) static int argc; static char **argv; static int optparse_yesno; static int optparse(char *arg, char *option, int unique, char *format, ...) { va_list val; int separate = 0; char *opt = option; struct timeval *timeptr; char **charptr; int *intptr; va_start(val, format); /* Allow for long options. --[option] is equivalent to [option]. */ if (arg[0] == '-' && arg[1] == '-' && isalnum(arg[2])) arg += 2; if (*format == 't') { /* Toggle switch. -[option] means off; +[option] or [option] means on. Arguments must be given with = syntax. */ /* Allow --no-WHATEVER as well as +WHATEVER. */ optparse_yesno = 1; if (arg[0] == '-' && arg[1] == 'n' && arg[2] == 'o' && arg[3] == '-') arg++; while (arg[0]== 'n' && arg[1] == 'o' && arg[2] == '-' && isalnum(arg[3])) optparse_yesno = !optparse_yesno, arg += 3; if (arg[0] == '-') optparse_yesno = 0, arg++; else if (arg[0] == '+') optparse_yesno = 1, arg++; } else if (*format == 's') { /* Set option. -[option], +[option] and [option] are acceptable. Arguments may be given with = syntax or as separate entities. */ if (*arg == '-' || *arg == '+') arg++; separate = 1; } format++; while (*arg && *arg != '=' && *opt) { if (*arg++ != *opt++) return 0; unique--; } if (unique > 0) return 0; if (*arg == '=') { arg++; separate = 0; if (!*format) error("too many arguments to %s", option); } if (separate && *format) { ARGSHIFT; if (argc == 0) goto doneargs; arg = argv[0]; } else if (!*arg) goto doneargs; switch (*format++) { case 't': /* time */ case 'T': /* optional time */ timeptr = va_arg(val, struct timeval *); if (!strtointerval(arg, &arg, timeptr)) error("incorrect time format in %s argument", option); break; case 's': /* string */ case 'S': /* optional string */ charptr = va_arg(val, char **); *charptr = arg; break; case 'i': /* integer */ case 'I': /* optional integer */ intptr = va_arg(val, int *); *intptr = (int)strtol(arg, &arg, 10); if (*arg) error("argument to %s must be integer", option); break; } doneargs: ARGSHIFT; while (*format) switch (*format++) { case 't': case 's': case 'i': error("%s not given enough arguments", option); break; } va_end(val); return 1; } /* note: memory leak on slideshow texts */ static void slideshow_text_append_built_in(Options *o, char *built_in) { int lbi = strlen(built_in); int ls = (o->slideshow_text ? strlen(o->slideshow_text) : 0); int lis = (o->icon_slideshow_text ? strlen(o->icon_slideshow_text) : 0); char *s = xwNEWARR(char, ls + lbi + 3); char *is = xwNEWARR(char, lis + lbi + 7); sprintf(s, "%s%s&%s", (ls ? o->slideshow_text : ""), (ls ? ";" : ""), built_in); sprintf(is, "%s%s&%sicon", (lis ? o->icon_slideshow_text : ""), (lis ? ";" : ""), built_in); if (!o->prev || o->prev->slideshow_text != o->slideshow_text) xfree((char *)o->slideshow_text); if (!o->prev || o->prev->icon_slideshow_text != o->icon_slideshow_text) xfree((char *)o->icon_slideshow_text); o->slideshow_text = s; o->icon_slideshow_text = is; } static void parse_options(int pargc, char **pargv) { char *s; char *arg; Options *o = &onormal; Options *p; struct timeval flash_delay; int breaktime_warn_context = 0; argc = pargc; argv = pargv; while (argc > 0) { s = argv[0]; arg = 0; if (optparse(s, "after", 1, "sT", &o->next_delay)) { p = xwNEW(Options); *p = *o; o->next = p; p->prev = o; o = p; } else if (optparse(s, "bars-picture", 2, "ss", &bars_slideshow_text) || optparse(s, "bp", 2, "ss", &bars_slideshow_text)) ; else if (optparse(s, "breaktime", 1, "st", &o->break_time)) { if (o->prev && !breaktime_warn_context) { warning("meaning of `breaktime' following `after' has changed"); message("(You can specify `breaktime' multiple times, to lengthen a break"); message("if you ignore xwrits for a while. In previous versions, there was"); message("one global `breaktime'.)"); breaktime_warn_context = 1; } else breaktime_warn_context = 1; } else if (optparse(s, "beep", 2, "t")) o->beep = optparse_yesno; else if (optparse(s, "breakclock", 6, "t")) o->break_clock = optparse_yesno; else if (optparse(s, "bc", 2, "t")) o->break_clock = optparse_yesno; else if (optparse(s, "canceltime", 2, "sT", &o->cancel_type_time) || optparse(s, "ct", 2, "sT", &o->cancel_type_time)) ; else if (optparse(s, "cheat", 2, "tI", &max_cheats)) allow_cheats = optparse_yesno; else if (optparse(s, "clock", 1, "t")) o->clock = optparse_yesno; else if (optparse(s, "display", 1, "ss", &arg)) { if (nports == 1 && ports[0]->display_name == 0) ports[0]->display_name = arg; else add_port(arg, 0, 0, 0); } else if (optparse(s, "finger", 1, "tS", &arg) || optparse(s, "flipoff", 1, "tS", &arg)) { if (!optparse_yesno) { o->slideshow_text = o->icon_slideshow_text = 0; slideshow_text_append_built_in(o, "clench"); slideshow_text_append_built_in(o, "spread"); } else if (arg) slideshow_text_append_built_in(o, arg); else slideshow_text_append_built_in(o, "american"); } else if (optparse(s, "flashtime", 3, "st", &flash_delay)) { double f = flash_delay.tv_sec*MICRO_PER_SEC + flash_delay.tv_usec; o->flash_rate_ratio = f / (DEFAULT_FLASH_DELAY_SEC*MICRO_PER_SEC); } else if (optparse(s, "help", 1, "s")) { usage(); exit(0); } else if (optparse(s, "iconified", 2, "t")) o->appear_iconified = optparse_yesno; else if (optparse(s, "idle", 1, "tT", &idle_time)) check_idle = optparse_yesno; else if (optparse(s, "lock", 1, "tT", &o->lock_bounce_delay)) o->lock = optparse_yesno; else if (optparse(s, "lock-picture", 5, "ss", &locked_slideshow_text) || optparse(s, "lp", 2, "ss", &locked_slideshow_text)) ; else if (optparse(s, "minbreaktime", 2, "st", &o->min_break_time)) ; else if (optparse(s, "mono", 3, "t")) force_mono = optparse_yesno; else if (optparse(s, "mouse", 3, "tI", &mouse_sensitivity)) check_mouse = optparse_yesno; else if (optparse(s, "multiply", 1, "tT", &o->multiply_delay)) o->multiply = optparse_yesno; else if (optparse(s, "multiscreen", 6, "t")) multiscreen = optparse_yesno; else if (optparse(s, "maxhands", 2, "si", &o->max_hands)) ; else if (optparse(s, "noiconify", 3, "t")) o->never_iconify = optparse_yesno; else if (optparse(s, "nooffscreen", 3, "t")) /* No longer supported because it never really worked well, wasn't useful, and screwed over virtual desktop users. To resupport it, change the flash() and switchoptions() subroutines and add a clause on ConfigureNotify to warningxloop(). Use constraintoscreen(). */ error("the nooffscreen option is no longer supported"); else if (optparse(s, "okp", 1, "ss", &ready_slideshow_text)) ; else if (optparse(s, "password", 1, "ss", &lock_password)) ; else if (optparse(s, "quota", 1, "tT", "a_time)) check_quota = optparse_yesno; else if (optparse(s, "rest-picture", 3, "ss", &resting_slideshow_text) || optparse(s, "rp", 2, "ss", &resting_slideshow_text)) ; else if (optparse(s, "ready-picture", 3, "ss", &ready_slideshow_text)) ; else if (optparse(s, "title", 2, "ss", &o->window_title)) ; else if (optparse(s, "typetime", 1, "st", &normal_type_time)) ; else if (optparse(s, "top", 2, "t")) o->top = optparse_yesno; else if (optparse(s, "verbose", 4, "t") || optparse(s, "V", 1, "t")) verbose = optparse_yesno; else if (optparse(s, "version", 1, "s")) { printf("LCDF Xwrits %s\n", VERSION); printf("\ Copyright (C) 1994-2002 Eddie Kohler\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty, not even for merchantability or fitness for a\n\ particular purpose.\n"); exit(0); } else if (optparse(s, "warning-picture", 1, "ss", &o->slideshow_text)) ; else if (optparse(s, "wp", 2, "ss", &o->slideshow_text)) ; else short_usage(); } } /* option checking */ static void set_fraction_time(struct timeval *result, struct timeval in, double fraction) { double d = fraction * (in.tv_sec + (in.tv_usec / (double)MICRO_PER_SEC)); long integral_d = (long)(floor(d)); result->tv_sec = integral_d; result->tv_usec = (long)(MICRO_PER_SEC * (d - integral_d)); } static void check_options(Options *o) { Options *prev = o->prev; /* check multiply_delay */ if (xwTIMELEQ0(o->multiply_delay)) o->multiply_delay = zero; /* check max_hands */ if (o->max_hands < 1) o->max_hands = 1; else if (o->max_hands > MAX_HANDS) o->max_hands = MAX_HANDS; /* check min_break_time */ if (xwTIMELT0(o->min_break_time)) { set_fraction_time(&o->min_break_time, o->break_time, 0.5); if (xwTIMEGEQ(quota_time, o->min_break_time)) o->min_break_time = quota_time; } /* check cancel_type_time */ if (xwTIMELT0(o->cancel_type_time)) { xwSETTIME(o->cancel_type_time, 10 * SEC_PER_MIN, 0); if (xwTIMEGT(o->cancel_type_time, normal_type_time)) o->cancel_type_time = normal_type_time; } /* If the next set of options is supposed to appear before this one, replace this one with the next set. Iterate. */ while (xwTIMELEQ0(o->next_delay)) { Options *p = o->next; *o = *p; o->prev = prev; if (o->next) o->next->prev = o; xfree(p); } /* create the slideshows */ if (prev && strcmp(o->slideshow_text, prev->slideshow_text) == 0 && o->flash_rate_ratio == prev->flash_rate_ratio) { o->slideshow = prev->slideshow; o->slideshow->refcount++; } else o->slideshow = parse_slideshow(o->slideshow_text, o->flash_rate_ratio, force_mono); if (prev && strcmp(o->icon_slideshow_text, prev->icon_slideshow_text) == 0 && o->flash_rate_ratio == prev->flash_rate_ratio) { o->icon_slideshow = prev->icon_slideshow; o->icon_slideshow->refcount++; } else o->icon_slideshow = parse_slideshow(o->icon_slideshow_text, o->flash_rate_ratio, force_mono); } /* default option settings */ static void default_settings(void) { /* time settings */ xwSETTIME(normal_type_time, 55 * SEC_PER_MIN, 0); xwSETTIME(onormal.break_time, 5 * SEC_PER_MIN, 0); xwSETTIME(onormal.cancel_type_time, -1, 0); xwSETTIME(onormal.min_break_time, -1, 0); onormal.flash_rate_ratio = 1; /* multiply settings */ xwSETTIME(onormal.multiply_delay, 2, 300000); onormal.max_hands = 25; /* locking settings */ xwSETTIME(onormal.lock_bounce_delay, 4, 0); xwSETTIME(lock_message_delay, 10, 0); lock_password = "quit"; /* keystroke registration functions */ check_idle = 1; xwSETTIME(idle_time, 0, 0); xwSETTIME(register_keystrokes_delay, 1, 0); /* mouse tracking functions */ check_mouse = 0; xwSETTIME(check_mouse_time, 3, 0); mouse_sensitivity = 15; /* quota settings */ check_quota = 0; xwSETTIME(quota_time, 60, 0); /* cheating */ max_cheats = MAX_CHEATS_UNSET; allow_cheats = 0; /* slideshows */ onormal.slideshow_text = onormal.icon_slideshow_text = 0; slideshow_text_append_built_in(&onormal, "clench"); slideshow_text_append_built_in(&onormal, "spread"); /* window title */ onormal.window_title = "xwrits"; /* clock tick time functions */ /* 20 seconds seems like a reasonable clock tick time, even though it'll redraw the same hands 3 times. */ xwSETTIME(clock_tick, 1, 0); /* next option set */ xwSETTIME(onormal.next_delay, 15 * SEC_PER_MIN, 0); onormal.next = 0; onormal.prev = 0; } /* initialize port, for X stuff */ #if defined(__cplusplus) || defined(c_plusplus) #define VISUAL_CLASS c_class #else #define VISUAL_CLASS class #endif static void initialize_slave_port(Port *port) { Port *m = port->master; assert(m->port_number < port->port_number); port->x_socket = m->x_socket; port->root_window = m->root_window; port->display_unique = 0; port->visual = m->visual; port->depth = m->depth; port->colormap = m->colormap; port->black = m->black; port->white = m->white; port->font = m->font; port->gfx = m->gfx; port->wm_delete_window_atom = m->wm_delete_window_atom; port->wm_protocols_atom = m->wm_protocols_atom; port->mwm_hints_atom = m->mwm_hints_atom; port->xwrits_window_atom = m->xwrits_window_atom; port->xwrits_notify_peer_atom = m->xwrits_notify_peer_atom; port->xwrits_break_atom = m->xwrits_break_atom; port->hands = port->icon_hands = 0; port->permanent_hand = m->permanent_hand; port->drawable = m->drawable; port->clock_fore_gc = m->clock_fore_gc; port->clock_hand_gc = m->clock_hand_gc; port->white_gc = m->white_gc; port->peers = 0; port->npeers = 0; port->peers_capacity = 0; port->icon_width = port->icon_height = 0; port->last_mouse_root = None; port->bars_pixmap = None; } static void initialize_port(int portno) { XVisualInfo visi_template; int nv, i; XVisualInfo *v; XVisualInfo *best_v = 0; VisualID default_visualid; Port *port = ports[portno]; Display *display = port->display; int screen_number = port->screen_number; /* check that relevant fields have been initialized */ assert(display && screen_number >= 0 && screen_number < ScreenCount(display) && port->port_number == portno); /* initialize slaves specially */ if (port->master != port) { initialize_slave_port(port); return; } /* initialize Port fields */ port->x_socket = ConnectionNumber(display); port->root_window = RootWindow(display, screen_number); port->display_unique = 1; for (i = 0; i < nports && port->display_unique; i++) if (i != portno && ports[i]->display == display && ports[i]->master == ports[i]) port->display_unique = 0; /* set X socket */ FD_SET(port->x_socket, &x_socket_set); if (port->x_socket > max_x_socket) max_x_socket = port->x_socket; /* choose the Visual */ default_visualid = DefaultVisual(display, screen_number)->visualid; visi_template.screen = screen_number; v = XGetVisualInfo(display, VisualScreenMask, &visi_template, &nv); for (i = 0; i < nv && !best_v; i++) if (v[i].visualid == default_visualid) best_v = &v[i]; if (!best_v) { port->visual = DefaultVisual(display, screen_number); port->depth = DefaultDepth(display, screen_number); port->colormap = DefaultColormap(display, screen_number); } else { /* Which visual to choose? This isn't exactly a simple decision, since we want to avoid colormap flashing while choosing a nice visual. So here's the algorithm: Prefer the default visual, or take a TrueColor visual with strictly greater depth. */ for (i = 0; i < nv; i++) if (v[i].depth > best_v->depth && v[i].VISUAL_CLASS == TrueColor) best_v = &v[i]; port->visual = best_v->visual; port->depth = best_v->depth; if (best_v->visualid != default_visualid) port->colormap = XCreateColormap(display, port->root_window, port->visual, AllocNone); else port->colormap = DefaultColormap(display, screen_number); } if (v) XFree(v); /* set up black_pixel and white_pixel */ { XColor color; color.red = color.green = color.blue = 0; XAllocColor(display, port->colormap, &color); port->black = color.pixel; color.red = color.green = color.blue = 0xFFFF; XAllocColor(display, port->colormap, &color); port->white = color.pixel; } /* choose the font */ port->font = XLoadQueryFont(display, "-*-helvetica-bold-r-*-*-*-180-75-75-*-iso8859-1"); if (!port->font) port->font = XLoadQueryFont(display, "fixed"); /* set gfx */ port->gfx = Gif_NewXContextFromVisual (display, screen_number, port->visual, port->depth, port->colormap); /* set atoms */ port->wm_delete_window_atom = XInternAtom(display, "WM_DELETE_WINDOW", False); port->wm_protocols_atom = XInternAtom(display, "WM_PROTOCOLS", False); port->mwm_hints_atom = XInternAtom(display, "_MOTIF_WM_HINTS", False); port->xwrits_window_atom = XInternAtom(display, "XWRITS_WINDOW", False); port->xwrits_notify_peer_atom = XInternAtom(display, "XWRITS_NOTIFY_PEER", False); port->xwrits_break_atom = XInternAtom(display, "XWRITS_BREAK", False); /* create first hand for this port, set drawable */ port->hands = port->icon_hands = port->permanent_hand = 0; (void) new_hand(port, NEW_HAND_CENTER, NEW_HAND_CENTER); port->drawable = port->permanent_hand->w; /* initialize GCs */ { XGCValues gcv; gcv.foreground = port->black; gcv.line_width = 3; gcv.cap_style = CapRound; port->clock_fore_gc = XCreateGC (port->display, port->drawable, GCForeground | GCLineWidth | GCCapStyle, &gcv); gcv.line_width = 1; port->clock_hand_gc = XCreateGC (port->display, port->drawable, GCForeground | GCLineWidth | GCCapStyle, &gcv); gcv.foreground = port->white; gcv.font = port->font->fid; gcv.subwindow_mode = IncludeInferiors; port->white_gc = XCreateGC (port->display, port->drawable, GCForeground | GCFont | GCSubwindowMode, &gcv); } /* xwrits peers */ port->peers = xwNEWARR(Window, 4); port->npeers = 0; port->peers_capacity = 4; /* initialize other stuff */ port->icon_width = port->icon_height = 0; port->last_mouse_root = None; port->bars_pixmap = None; } /* main! */ typedef enum { ST_NORMAL_WAIT, ST_FIRST_WARN, ST_WARN, ST_CANCEL_WAIT, ST_REST, ST_LOCK, ST_AWAKE } XwritsState; void main_loop(void) { XwritsState s = ST_NORMAL_WAIT; int tran; int was_lock = 0; while (1) { switch (s) { case ST_NORMAL_WAIT: ocurrent = &onormal; tran = wait_for_break(&normal_type_time); assert(tran == TRAN_WARN || tran == TRAN_REST); if (tran == TRAN_WARN) s = ST_FIRST_WARN; break; case ST_FIRST_WARN: xwGETTIME(first_warn_time); was_lock = 0; s = ST_WARN; break; case ST_WARN: /* warn() will figure out current options by time */ tran = warn(was_lock, &onormal); assert(tran == TRAN_CANCEL || tran == TRAN_REST || tran == TRAN_LOCK); if (tran == TRAN_REST) s = ST_REST; else if (tran == TRAN_CANCEL) s = ST_CANCEL_WAIT; else if (tran == TRAN_LOCK) s = ST_LOCK; break; case ST_CANCEL_WAIT: tran = wait_for_break(&ocurrent->cancel_type_time); assert(tran == TRAN_WARN || tran == TRAN_REST); if (tran == TRAN_WARN) s = ST_WARN; else s = ST_NORMAL_WAIT; break; case ST_REST: was_lock = 0; tran = rest(); assert(tran == TRAN_AWAKE || tran == TRAN_CANCEL || tran == TRAN_FAIL); if (tran == TRAN_AWAKE) s = ST_AWAKE; else if (tran == TRAN_CANCEL) s = ST_CANCEL_WAIT; else if (tran == TRAN_FAIL) s = ST_WARN; break; case ST_LOCK: was_lock = 1; tran = lock(); assert(tran == TRAN_AWAKE || tran == TRAN_FAIL); if (tran == TRAN_AWAKE) s = ST_AWAKE; else if (tran == TRAN_FAIL) s = ST_WARN; break; case ST_AWAKE: ready(); unmap_all(); s = ST_NORMAL_WAIT; break; } } } int main(int argc, char *argv[]) { Options *o; int i, j, orig_nports; int lock_possible = 0; struct timeval now; xwGETTIMEOFDAY(&genesis_time); init_scheduler(); srand((getpid() + 1) * time(0)); add_port(0, 0, 0, 0); /* parse options. remove first argument = program name */ default_settings(); parse_options(argc - 1, argv + 1); /* At this point, all ports have 'display_name' valid and everything else invalid. Open displays, check multiscreen */ orig_nports = nports; for (i = 0; i < orig_nports; i++) { Display *display = XOpenDisplay(ports[i]->display_name); if (!display) error("can't open display `%s'", ports[i]->display_name); ports[i]->display = display; if (!multiscreen) ports[i]->screen_number = DefaultScreen(display); else if (ScreenCount(display) > 0) { ports[i]->screen_number = 0; for (j = 1; j < ScreenCount(display); j++) add_port(ports[i]->display_name, ports[i]->display, j, 0); } } /* Now check screen dimensions and Xinerama, if available. */ orig_nports = nports; for (i = 0; i < orig_nports; i++) { Port *p = ports[i]; #ifdef HAVE_XINERAMA int j, nxsi; XineramaScreenInfo *xsi = 0; if (XineramaQueryExtension(p->display, &j, &nxsi)) xsi = XineramaQueryScreens(p->display, &nxsi); if (xsi) { for (j = 0; j < nxsi; j++) { Port *q = (j == 0 ? p : add_port(p->display_name, p->display, p->screen_number, p)); q->left = xsi[j].x_org; q->top = xsi[j].y_org; q->width = xsi[j].width; q->height = xsi[j].height; } XFree(xsi); } else { #endif p->width = DisplayWidth(p->display, p->screen_number); p->height = DisplayHeight(p->display, p->screen_number); #ifdef HAVE_XINERAMA } #endif } /* check global options */ if (strlen(lock_password) >= MAX_PASSWORD_SIZE) error("password too long"); /* default for idle_time and warn_idle_time is based on break_delay; otherwise, warn_idle_time == idle_time */ if (check_idle && xwTIMELEQ0(idle_time)) { idle_time = onormal.break_time; set_fraction_time(&warn_idle_time, idle_time, 0.3); } else warn_idle_time = idle_time; /* check quota */ if (check_quota && check_idle && xwTIMEGEQ(quota_time, onormal.break_time)) { warning("quota time is longer than break length"); warning("(With +quota=TIME, unexpected breaks longer than TIME reduce"); warning("the length of the main break, so a TIME longer than the main"); warning("break is probably a mistake.)"); } /* fix cheats */ if (!allow_cheats) max_cheats = 0; else if (max_cheats == MAX_CHEATS_UNSET) max_cheats = 5; /* check local options */ for (o = &onormal; o; o = o->next) { check_options(o); if (o->lock) lock_possible = 1; } /* load resting and ready slideshows */ resting_slideshow = parse_slideshow(resting_slideshow_text, 1, force_mono); resting_icon_slideshow = parse_slideshow(resting_icon_slideshow_text, 1, force_mono); ready_slideshow = parse_slideshow(ready_slideshow_text, 1, force_mono); ready_icon_slideshow = parse_slideshow(ready_icon_slideshow_text, 1, force_mono); ocurrent = &onormal; /* create ports */ FD_ZERO(&x_socket_set); max_x_socket = 0; for (i = 0; i < nports; i++) initialize_port(i); /* initialize pictures using first hand */ if (lock_possible) { locked_slideshow = parse_slideshow(locked_slideshow_text, 1, force_mono); /* set bars_slideshow to default only if locked_slideshow is default */ if (!bars_slideshow_text) bars_slideshow_text = (strcmp(locked_slideshow_text, "&locked") == 0 ? "&bars" : 0); if (bars_slideshow_text) { bars_slideshow = parse_slideshow(bars_slideshow_text, 1, force_mono); for (i = 0; i < nports; i++) ports[i]->bars_pixmap = Gif_XImage(ports[i]->gfx, bars_slideshow, 0); } } /* watch keystrokes on all windows */ xwGETTIME(now); XSetErrorHandler(x_error_handler); for (i = 0; i < nports; i++) if (ports[i]->master == ports[i]) watch_keystrokes(ports[i], ports[i]->root_window, &now); /* start mouse checking */ if (check_mouse) { Alarm *a = new_alarm(A_MOUSE); xwGETTIME(a->timer); schedule(a); } /* main loop */ main_loop(); return 0; } xwrits-2.21/pictures.c 644 41346 41346 22624 7465614724 10240 #include #include "xwrits.h" #include #include #include #include #include #include "colorpic.c" #include "monopic.c" Gif_Stream *current_slideshow = 0; #define NPICTURES 14 struct named_record { const char *name; const Gif_Record *record; Gif_Stream *gfs; const char *synonym; }; struct named_record built_in_pictures[] = { /* normal pictures */ {"clench", &clenchl_gif, 0}, {"clenchicon", &clenchi_gif, 0}, {"spread", &spreadl_gif, 0}, {"spreadicon", &spreadi_gif, 0}, {"american", &fingerl_gif, 0}, {"americanicon", &fingeri_gif, 0}, {"resting", &restl_gif, 0}, {"restingicon", &resti_gif, 0}, {"ready", &okl_gif, 0}, {"readyicon", &oki_gif, 0}, {"locked", &lock_gif, 0}, {"bars", &bars_gif, 0}, /* monochrome pictures */ {"clenchmono", &clenchlm_gif, 0}, {"clenchiconmono", &clenchim_gif, 0}, {"spreadmono", &spreadlm_gif, 0}, {"spreadiconmono", &spreadim_gif, 0}, {"americanmono", &fingerlm_gif, 0}, {"americaniconmono", &fingerim_gif, 0}, {"restingmono", &restlm_gif, 0}, {"restingiconmono", &restim_gif, 0}, {"readymono", &oklm_gif, 0}, {"readyiconmono", &okim_gif, 0}, {"lockedmono", &lockm_gif, 0}, {"barsmono", &barsm_gif, 0}, /* other cultures' finger gestures */ {"korean", &koreanl_gif, 0}, {"koreanicon", &koreani_gif, 0}, {"german", &germanl_gif, 0}, {"germanicon", &germani_gif, 0}, {"japanese", 0, 0, "korean"}, {"japaneseicon", 0, 0, "koreanicon"}, {"russian", 0, 0, "korean"}, {"russianicon", 0, 0, "koreanicon"}, /* last */ {0, 0, 0} }; static void free_picture(void *v) { Picture *p = (Picture *)v; int i; if (p->canonical) Gif_DeleteImage(p->canonical); else for (i = 0; i < nports; i++) if (p->pix[i]) XFreePixmap(ports[i]->display, p->pix[i]); xfree(p); } static void add_picture(Gif_Image *gfi, int clock_x_off, int clock_y_off) { Picture *p = (Picture *) xmalloc(sizeof(Picture) + (nports-1)*sizeof(Pixmap)); int i; p->clock_x_off = clock_x_off; p->clock_y_off = clock_y_off; p->canonical = 0; for (i = 0; i < nports; i++) p->pix[i] = None; gfi->user_data = p; gfi->free_user_data = free_picture; } Gif_Stream * get_built_in_image(const char *name) { struct named_record *nr; Gif_Stream *gfs; int i, xoff; for (nr = built_in_pictures; nr->name; nr++) if (strcmp(nr->name, name) == 0) goto found; return 0; found: if (nr->gfs) return nr->gfs; if (!nr->record && nr->synonym) { nr->gfs = get_built_in_image(nr->synonym); return nr->gfs; } nr->gfs = gfs = Gif_FullReadRecord(nr->record, GIF_READ_COMPRESSED | GIF_READ_CONST_RECORD, 0, 0); if (!gfs) return 0; xoff = (strncmp(name, "locked", 6) == 0 ? 65 : 10); for (i = 0; i < gfs->nimages; i++) add_picture(gfs->images[i], xoff, 10); /* built-in images are all loop-forever. don't change the GIFs because it makes the executable bigger */ if (gfs->loopcount < 0) gfs->loopcount = 0; return gfs; } #define MIN_DELAY 4 static Gif_Image * clone_image_skeleton(Gif_Image *gfi) { Gif_Image *ngfi = Gif_NewImage(); Picture *p = (Picture *)gfi->user_data; assert(!gfi->image_data && gfi->compressed && p); ngfi->local = gfi->local; if (ngfi->local) ngfi->local->refcount++; ngfi->transparent = gfi->transparent; ngfi->left = gfi->left; ngfi->top = gfi->top; ngfi->width = gfi->width; ngfi->height = gfi->height; ngfi->compressed = gfi->compressed; ngfi->compressed_len = gfi->compressed_len; ngfi->free_compressed = 0; ngfi->delay = gfi->delay; add_picture(ngfi, p->clock_x_off, p->clock_y_off); ((Picture *)ngfi->user_data)->canonical = gfi; gfi->refcount++; return ngfi; } static void add_stream_to_slideshow(Gif_Stream *add, Gif_Stream *gfs, double flash_rate_ratio) { Gif_Image *gfi; int i; double d; /* adapt delays for 1-frame images */ if (add->nimages == 1) add->images[0]->delay = DEFAULT_FLASH_DELAY_SEC * 100; /* account for background and loopcount */ if (gfs->nimages == 0) { if (add->global) { gfs->global = add->global; add->global->refcount++; gfs->background = add->background; } gfs->loopcount = add->loopcount; } /* adapt screen size */ if (add->screen_width > gfs->screen_width) gfs->screen_width = add->screen_width; if (add->screen_height > gfs->screen_height) gfs->screen_height = add->screen_height; /* add images from add to gfs */ for (i = 0; i < add->nimages; i++) { gfi = add->images[i]; /* don't use an image directly if it is shared */ if (gfi->user_data) gfi = clone_image_skeleton(gfi); else add_picture(gfi, 10, 10); /* ensure local colormap */ if (!gfi->local && add->global) { gfi->local = add->global; add->global->refcount++; } /* adapt delay */ d = gfi->delay * flash_rate_ratio; if (d < 0 || d >= 0xFFFF) gfi->delay = 0xFFFF; else gfi->delay = (d < MIN_DELAY ? MIN_DELAY : (uint16_t)d); /* add image */ Gif_AddImage(gfs, gfi); } /* add multiple times if it has a loop count, up to a max of 20 loops */ if (add->nimages > 1 && add->loopcount >= 0) { int loop = (add->loopcount <= 20 ? add->loopcount : 20); int first = gfs->nimages - add->nimages; int j; if (loop == 0 && first > 0) { for (i = j = 0; i < add->nimages; i++) j += gfs->images[first + i]->delay; loop = (int)((DEFAULT_FLASH_DELAY_SEC * 100) * flash_rate_ratio / j); } for (i = 0; i < loop; i++) for (j = 0; j < add->nimages; j++) Gif_AddImage(gfs, gfs->images[first + j]); } } Gif_Stream * parse_slideshow(const char *slideshowtext, double flash_rate_ratio, int mono) { char buf[BUFSIZ]; char name[BUFSIZ + 4]; char *s; Gif_Stream *gfs, *add; Gif_Image *gfi; int i; if (strlen(slideshowtext) >= BUFSIZ) return 0; strcpy(buf, slideshowtext); s = buf; gfs = Gif_NewStream(); gfs->loopcount = 0; while (*s) { char *n, save; while (isspace(*s)) s++; n = s; while (!isspace(*s) && *s != ';' && *s) s++; save = *s; *s = 0; if (n[0] == '&') { /* built-in image */ strcpy(name, n + 1); if (mono) strcat(name, "mono"); i = strlen(name); add = get_built_in_image(name); /* some images don't have monochromatic versions; fall back on color */ if (!add && i > 4 && strcmp(name + i - 4, "mono") == 0) { name[i-4] = 0; add = get_built_in_image(name); if (add) warning("no monochrome version of built-in picture `%s'", name); name[i-4] = 'm'; } if (!add) error("unknown built-in picture `%s'", name); /* add images */ add_stream_to_slideshow(add, gfs, flash_rate_ratio); } else { /* load file from disk */ FILE *f = fopen(n, "rb"); add = Gif_FullReadFile(f, GIF_READ_COMPRESSED, 0, 0); if (!f) error("%s: %s", n, strerror(errno)); else if (!add || (add->nimages == 0 && add->errors > 0)) error("%s: not a GIF", n); else add_stream_to_slideshow(add, gfs, flash_rate_ratio); if (add) Gif_DeleteStream(add); if (f) fclose(f); } *s = save; if (*s) s++; } /* make sure screen_width and screen_height aren't 0 */ if (gfs->screen_width == 0 || gfs->screen_height == 0 || gfs->nimages == 1) { gfs->screen_width = gfs->screen_height = 0; for (i = 0; i < gfs->nimages; i++) { gfi = gfs->images[i]; if (gfi->width > gfs->screen_width) gfs->screen_width = gfi->width; if (gfi->height > gfs->screen_height) gfs->screen_height = gfi->height; } } return gfs; } void set_slideshow(Hand *h, Gif_Stream *gfs, const struct timeval *now_ptr) { int which_im = 0; Alarm *a; struct timeval t; Port *port = h->port; if (h->slideshow == gfs) return; else if (!gfs) { h->slideshow = 0; unschedule_data(A_FLASH, h, 0); return; } if (now_ptr) t = *now_ptr; else xwGETTIME(t); a = grab_alarm_data(A_FLASH, h, 0); if (h->slideshow) { Gif_Image *cur_im = h->slideshow->images[h->slide]; if (a) xwSUBDELAY(t, a->timer, cur_im->delay); /* Leave which_im with a picture that matches the old one, or 0 if no picture matches the old one. */ for (which_im = gfs->nimages - 1; which_im > 0; which_im--) if (gfs->images[which_im] == cur_im) break; } /* fprintf(stderr, "%p %p %d\n", h, gfs, which_im); */ if (gfs->nimages > 1) { if (!a) a = new_alarm_data(A_FLASH, h, 0); xwADDDELAY(a->timer, t, gfs->images[which_im]->delay); schedule(a); } else { if (a) destroy_alarm(a); } h->slideshow = gfs; if ((gfs->screen_width != h->width || gfs->screen_height != h->height) && !h->is_icon) { XWindowChanges wmch; XSizeHints *xsh = XAllocSizeHints(); xsh->flags = USPosition | PMinSize | PMaxSize; xsh->min_width = xsh->max_width = gfs->screen_width; xsh->min_height = xsh->max_height = gfs->screen_height; wmch.width = gfs->screen_width; wmch.height = gfs->screen_height; XSetWMNormalHints(port->display, h->w, xsh); XReconfigureWMWindow(port->display, h->w, port->screen_number, CWWidth | CWHeight, &wmch); XFree(xsh); } h->loopcount = 0; h->slide = which_im; draw_slide(h); } void set_all_slideshows(Hand *hands, Gif_Stream *gfs) { Hand *h; struct timeval now; xwGETTIME(now); for (h = hands; h; h = h->next) set_slideshow(h, gfs, &now); current_slideshow = gfs; } xwrits-2.21/rest.c 644 41346 41346 15264 7465620117 7352 #include #include "xwrits.h" #include #include /* wait for break */ static struct timeval wait_over_time; static int wait_x_loop(XEvent *e, const struct timeval *now) { struct timeval diff; if (e->type == KeyPress || e->type == MotionNotify || e->type == ButtonPress) { xwSUBTIME(diff, *now, last_key_time); last_key_time = *now; /* if check_idle is on, long idle periods are the same as breaks */ if (check_idle && xwTIMEGEQ(diff, idle_time)) return TRAN_REST; /* if check_quota is on, mini-breaks add up over time */ if (check_quota && xwTIMEGEQ(diff, quota_time)) { xwADDTIME(quota_allotment, quota_allotment, diff); if (check_idle && xwTIMEGEQ(quota_allotment, idle_time)) return TRAN_REST; } /* wake up if time to warn */ return (xwTIMEGEQ(*now, wait_over_time) ? TRAN_WARN : 0); } else return 0; } static int adjust_wait_time(struct timeval *wait_began_time, const struct timeval *type_time) /* Adjust the time to wake up to reflect the length of the break, if under check_quota. Want to be able to type for slightly longer if you've been taking mini-breaks. */ { struct timeval this_break_time; struct timeval break_end_time; assert(check_quota); /* Find the time when this break should end = beginning of wait + type delay + break delay */ xwADDTIME(break_end_time, *wait_began_time, *type_time); xwADDTIME(break_end_time, break_end_time, ocurrent->break_time); /* Find the length of this break */ xwSUBTIME(this_break_time, ocurrent->break_time, quota_allotment); if (xwTIMEGEQ(ocurrent->min_break_time, this_break_time)) this_break_time = ocurrent->min_break_time; /* Subtract to find when we should start warning */ xwSUBTIME(break_end_time, break_end_time, this_break_time); /* Check against wait_over_time; if <=, wait is over */ if (xwTIMEGEQ(wait_over_time, break_end_time)) return TRAN_WARN; /* Set wait_over_time and return 0 -- we still need to wait */ wait_over_time = break_end_time; return 0; } int wait_for_break(const struct timeval *type_time) { int val, i; struct timeval wait_began_time; /* Schedule wait_over_time */ xwGETTIME(wait_began_time); xwADDTIME(wait_over_time, wait_began_time, *type_time); if (check_quota) xwSETTIME(quota_allotment, 0, 0); /* Pretend there's been a keystroke */ last_key_time = wait_began_time; /* Clear slideshows */ /* Do this now so later set_slideshows start from scratch. */ for (i = 0; i < nports; i++) { set_all_slideshows(ports[i]->hands, 0); set_all_slideshows(ports[i]->icon_hands, 0); } val = 0; while (val != TRAN_WARN && val != TRAN_REST) { /* If !check_idle, we want to appear even if no keystroke happens, so schedule an alarm */ if (!check_idle) { Alarm *a = new_alarm(A_AWAKE); a->timer = wait_over_time; unschedule(A_AWAKE); schedule(a); } /* Wait */ val = loopmaster(0, wait_x_loop); if (val == TRAN_AWAKE) val = TRAN_WARN; /* patch A_AWAKE case */ /* Adjust the wait time if necessary */ assert(val == TRAN_WARN || val == TRAN_REST); if (val == TRAN_WARN && check_quota) val = adjust_wait_time(&wait_began_time, type_time); } unschedule(A_FLASH | A_AWAKE); assert(val == TRAN_WARN || val == TRAN_REST); return val; } /* rest */ static int current_cheats; static struct timeval break_over_time; static int rest_x_loop(XEvent *e, const struct timeval *now) { /* If the break is over, wake up. */ if (xwTIMEGEQ(*now, break_over_time)) return TRAN_AWAKE; if (e->type == Xw_DeleteWindow && active_hands() == 0) /* Window manager deleted last xwrits window. Consider break over. */ return TRAN_CANCEL; else if (e->type == KeyPress || e->type == MotionNotify || e->type == ButtonPress) { last_key_time = *now; current_cheats++; return (current_cheats > max_cheats ? TRAN_FAIL : 0); } else return 0; } void calculate_break_time(struct timeval *break_over_time, const struct timeval *now) { struct timeval this_break_time; /* determine length of this break. usually break_time; can be different if check_quota is on */ this_break_time = ocurrent->break_time; if (check_quota) { xwSUBTIME(this_break_time, this_break_time, quota_allotment); if (xwTIMEGEQ(ocurrent->min_break_time, this_break_time)) this_break_time = ocurrent->min_break_time; } /* determine when to end the break */ if (!check_idle) xwADDTIME(*break_over_time, *now, this_break_time); else xwADDTIME(*break_over_time, last_key_time, this_break_time); } int rest(void) { struct timeval now; Alarm *a; int tran, i; /* set up pictures */ /* Do this first so later set_slideshows start from scratch. */ for (i = 0; i < nports; i++) { set_all_slideshows(ports[i]->hands, resting_slideshow); set_all_slideshows(ports[i]->icon_hands, resting_icon_slideshow); find_one_hand(ports[i], 1); } current_cheats = 0; /* calculate time when break is over */ xwGETTIME(now); calculate_break_time(&break_over_time, &now); /* if break already over, return */ if (xwTIMEGEQ(now, break_over_time)) return TRAN_AWAKE; /* schedule wakeup */ a = new_alarm(A_AWAKE); a->timer = break_over_time; schedule(a); /* reschedule mouse position query timing: allow 5 seconds for people to jiggle the mouse before we save its position */ if (check_mouse) { a = grab_alarm_data(A_MOUSE, 0, 0); a->timer = now; a->timer.tv_sec += 5; schedule(a); for (i = 0; i < nports; i++) ports[i]->last_mouse_root = None; } if (ocurrent->break_clock) { clock_zero_time = break_over_time; draw_all_clocks(&now); a = new_alarm(A_CLOCK); xwADDTIME(a->timer, now, clock_tick); schedule(a); } for (i = 0; i < nports; i++) XFlush(ports[i]->display); tran = loopmaster(0, rest_x_loop); unschedule(A_FLASH | A_AWAKE | A_CLOCK); erase_all_clocks(); assert(tran == TRAN_CANCEL || tran == TRAN_AWAKE || tran == TRAN_FAIL); return tran; } /* ready */ static int ready_x_loop(XEvent *e, const struct timeval *now) { if (e->type == KeyPress || e->type == MotionNotify || e->type == ButtonPress) { /* if they typed, disappear automatically */ last_key_time = *now; return 1; } else return 0; } void ready(void) { int i; for (i = 0; i < nports; i++) { set_all_slideshows(ports[i]->hands, ready_slideshow); set_all_slideshows(ports[i]->icon_hands, ready_icon_slideshow); find_one_hand(ports[i], 1); if (ocurrent->beep) XBell(ports[i]->display, 0); XFlush(ports[i]->display); } loopmaster(0, ready_x_loop); } xwrits-2.21/schedule.c 644 41346 41346 22242 7465611061 10161 #include #include "xwrits.h" #include #include #include static Alarm alarm_sentinel; /*****************************************************************************/ /* Idle functions */ /* Idea and motivation from xautolock, by Stefan De Troch, detroch@imec.be, and Michel Eyckmans (MCE), eyckmans@imec.be. However, the algorithm presented here is a little different from theirs, and therefore probably doesn't work! */ /* Support for Xidle is *not* included. */ struct timeval register_keystrokes_delay; static unsigned long created_count; static unsigned long key_press_selected_count; int x_error_handler(Display *d, XErrorEvent *error) { if (error->error_code != BadWindow && error->error_code != BadDrawable) { char buffer[BUFSIZ]; XGetErrorText(d, error->error_code, buffer, BUFSIZ); fprintf(stderr, "X Error of failed request: %s\n", buffer); abort(); } /* Maybe someone created a window then destroyed it immediately! I don't think there's any way of working around this. */ if (error->error_code == BadWindow) { Window window = (Window)error->resourceid; unschedule_data(A_IDLE_SELECT, (void *)find_port(error->display, window), (void *)window); } return 0; } void watch_keystrokes(Port *port, Window w, const struct timeval *now) { Display *display = port->display; Window root, parent, *children; unsigned i, nchildren; Alarm *a; /* Don't pay attention to our own windows */ if (window_to_hand(port, w, 1)) return; if (XQueryTree(display, w, &root, &parent, &children, &nchildren) == 0) return; /* the window doesn't exist */ XSelectInput(display, w, SubstructureNotifyMask); created_count++; if (verbose) fprintf(stderr, "Window 0x%x: watching for subwindows\n", (unsigned)w); /* This code ensures that at least register_keystrokes_delay elapses before we listen for KeyPress events on the window. We want to wait so we can make sure the window selects them first. */ a = new_alarm_data(A_IDLE_SELECT, (void *)port, (void *)w); xwADDTIME(a->timer, *now, register_keystrokes_delay); schedule(a); for (i = 0; i < nchildren; i++) watch_keystrokes(port, children[i], now); if (children) XFree(children); } void register_keystrokes(Port *port, Window w) { /* Before I only selected KeyPress if someone else had selected KeyPress on the window (indicated by the `or' of all_event_masks and do_not_propagate_mask). That seems obviously wrong! What if they only selected KeyRelease? What if they selected KeyPress later? So I've removed it. Hopefully this won't cause any strange behavior. */ /* Even though I didn't test long enough to see if it causes strange behavior, I'm going back to the old method (we select KeyPress only if someone else could receive it); this is a good idea because there are so many window manager windows which otherwise we would select events on, and not selecting events on 'em would seem to help performance. */ XWindowAttributes attr; Window peer; if (XGetWindowAttributes(port->display, w, &attr) == 0) return; /* check if this is an xwrits window */ peer = check_xwrits_window(port, w); if (peer) add_peer(port, peer); if (attr.root == w || ((attr.all_event_masks | attr.do_not_propagate_mask) & (KeyPressMask | KeyReleaseMask))) { key_press_selected_count++; XSelectInput(port->display, w, SubstructureNotifyMask | KeyPressMask); if (verbose) fprintf(stderr, "Window 0x%x: listening for keystrokes\n", (unsigned)w); } else if (verbose) fprintf(stderr, "Window 0x%x: skipping keystrokes\n", (unsigned)w); } /*****************************************************************************/ /* Scheduling and alarm functions */ Alarm * new_alarm_data(int action, void *data1, void *data2) { Alarm *a = xwNEW(Alarm); a->action = action; a->data1 = data1; a->data2 = data2; a->scheduled = 0; return a; } Alarm * grab_alarm_data(int action, void *data1, void *data2) { Alarm *a; for (a = alarm_sentinel.next; a != &alarm_sentinel; a = a->next) if (a->action == action && a->data1 == data1 && a->data2 == data2) { a->prev->next = a->next; a->next->prev = a->prev; a->scheduled = 0; return a; } return 0; } void destroy_alarm(Alarm *a) { if (a->scheduled) { a->prev->next = a->next; a->next->prev = a->prev; } xfree(a); } void init_scheduler(void) { alarm_sentinel.next = alarm_sentinel.prev = &alarm_sentinel; } void schedule(Alarm *newalarm) { Alarm *a = alarm_sentinel.prev; assert(!newalarm->scheduled); while (a != &alarm_sentinel && xwTIMEGT(a->timer, newalarm->timer)) a = a->prev; newalarm->prev = a; newalarm->next = a->next; a->next->prev = newalarm; a->next = newalarm; newalarm->scheduled = 1; } void unschedule_data(int actions, void *data1, void *data2) { Alarm *a = alarm_sentinel.next; while (a != &alarm_sentinel) { Alarm *n = a->next; if ((a->action & actions) != 0 && (a->data1 == data1 || data1 == 0) && (a->data2 == data2 || data2 == 0)) { a->prev->next = n; n->prev = a->prev; xfree(a); } a = n; } } int loopmaster(Alarmloopfunc alarm_looper, Xloopfunc x_looper) { struct timeval timeout, now, *timeoutptr; fd_set xfds; int pending, i; int ret_val = 0; /* 26 May 1998: Changed logic to avoid race conditions. Now we always flush the output queue and check if there are any pending X events before entering select() to wait for data. I wouldn't have noticed this, since the effects were so transient, if it hadn't been for the --animate option to gifview, which exercised this code more strenuously. */ xwGETTIME(now); FD_ZERO(&xfds); while (1) { while (1) { Alarm *a = alarm_sentinel.next; Hand *h; Gif_Stream *gfs; if (a == &alarm_sentinel || xwTIMEGT(a->timer, now)) break; h = (Hand *)a->data1; alarm_sentinel.next = a->next; a->next->prev = &alarm_sentinel; a->scheduled = 0; switch (a->action) { case A_FLASH: gfs = h->slideshow; /* cycle through slides */ while (xwTIMEGEQ(now, a->timer)) { h->slide = (h->slide + 1) % gfs->nimages; xwADDDELAY(a->timer, a->timer, gfs->images[h->slide]->delay); /* handle loopcount */ if (h->slide == 0 && gfs->loopcount != 0 && ++h->loopcount > gfs->loopcount) { h->slide = gfs->nimages - 1; goto flash_draw; } } schedule(a); flash_draw: if (h->mapped) draw_slide(h); break; case A_CLOCK: draw_all_clocks(&now); xwADDTIME(a->timer, a->timer, clock_tick); schedule(a); break; case A_AWAKE: ret_val = TRAN_AWAKE; break; case A_IDLE_SELECT: register_keystrokes((Port *)a->data1, (Window)a->data2); break; case A_MOUSE: { Window root, child; int root_x, root_y, win_x, win_y; unsigned mask; int i; for (i = 0; i < nports; i++) { if (ports[i]->master != ports[i]) continue; XQueryPointer(ports[i]->display, ports[i]->root_window, &root, &child, &root_x, &root_y, &win_x, &win_y, &mask); if (root != ports[i]->last_mouse_root || root_x < ports[i]->last_mouse_x - mouse_sensitivity || root_x > ports[i]->last_mouse_x + mouse_sensitivity || root_y < ports[i]->last_mouse_y - mouse_sensitivity || root_y > ports[i]->last_mouse_y + mouse_sensitivity) { XEvent event; event.type = MotionNotify; /* skeletal MotionNotify event */ if (x_looper && ports[i]->last_mouse_root) ret_val = x_looper(&event, &now); ports[i]->last_mouse_root = root; ports[i]->last_mouse_x = root_x; ports[i]->last_mouse_y = root_y; } } xwADDTIME(a->timer, a->timer, check_mouse_time); schedule(a); break; } default: if (alarm_looper) ret_val = alarm_looper(a, &now); break; } if (!a->scheduled) xfree(a); if (ret_val != 0) return ret_val; } if (alarm_sentinel.next != &alarm_sentinel) { timeoutptr = &timeout; xwSUBTIME(timeout, alarm_sentinel.next->timer, now); } else timeoutptr = 0; for (i = pending = 0; !pending && i < nports; i++) pending = XPending(ports[i]->display); if (!pending) { int result; xfds = x_socket_set; result = select(max_x_socket + 1, &xfds, 0, 0, timeoutptr); } /* Behave robustly when the system clock is adjusted backwards. The idea: estimate the duration of the backwards jump and subtract that from genesis_time. This will compensate for the jump in any new times returned from xwGETTIME. */ { struct timeval new_now; xwGETTIME(new_now); if (xwTIMEGT(now, new_now)) { xwSUBTIME(new_now, now, new_now); xwSUBTIME(genesis_time, genesis_time, new_now); xwGETTIME(new_now); } now = new_now; } /* Handle X events. */ for (i = 0; i < nports; i++) while (XPending(ports[i]->display)) { XEvent event; XNextEvent(ports[i]->display, &event); default_x_processing(&event); if (x_looper) ret_val = x_looper(&event, &now); if (ret_val != 0) return ret_val; } } } xwrits-2.21/warning.c 644 41346 41346 14563 7465620647 10053 #include #include "xwrits.h" #include #include #include static int clock_displaying = 0; static void pop_up_hand(Hand *h) { assert(h && !h->is_icon); set_slideshow(h, ocurrent->slideshow, 0); set_slideshow(h->icon, ocurrent->icon_slideshow, 0); h->clock = ocurrent->clock; XMapRaised(h->port->display, h->w); XFlush(h->port->display); } static int switch_options(Options *opt, const struct timeval *option_switch_time, const struct timeval *now) { Hand *h; Alarm *a; int i; ocurrent = opt; for (i = 0; i < nports; i++) { set_all_slideshows(ports[i]->hands, opt->slideshow); set_all_slideshows(ports[i]->icon_hands, opt->icon_slideshow); } if (opt->multiply) { a = new_alarm(A_MULTIPLY); xwADDTIME(a->timer, *now, opt->multiply_delay); schedule(a); } else unschedule(A_MULTIPLY); if (opt->clock && !clock_displaying) { draw_all_clocks(now); a = new_alarm(A_CLOCK); xwADDTIME(a->timer, *now, clock_tick); schedule(a); clock_displaying = 1; } else if (!opt->clock && clock_displaying) { unschedule(A_CLOCK); erase_all_clocks(); clock_displaying = 0; } for (i = 0; i < nports; i++) { for (h = ports[i]->hands; h; h = h->next) if ((opt->never_iconify && !h->mapped) || (!opt->appear_iconified && h->icon->mapped)) XMapRaised(ports[i]->display, h->w); if (opt->beep && ports[i]->master == ports[i]) XBell(ports[i]->display, 0); XFlush(ports[i]->display); } if (opt->next) { a = new_alarm(A_NEXT_OPTIONS); xwADDTIME(a->timer, *option_switch_time, opt->next_delay); schedule(a); } if (opt->lock) return TRAN_LOCK; else return 0; } static int warn_alarm_loop(Alarm *a, const struct timeval *now) { switch (a->action) { case A_MULTIPLY: if (active_hands() < ocurrent->max_hands * nports) pop_up_hand(new_hand(NEW_HAND_RANDOM_PORT, NEW_HAND_RANDOM, NEW_HAND_RANDOM)); xwADDTIME(a->timer, a->timer, ocurrent->multiply_delay); schedule(a); break; case A_NEXT_OPTIONS: return switch_options(ocurrent->next, now, now); case A_IDLE_CHECK: return TRAN_REST; } return 0; } static int check_raise_window(Hand *h) { Port *port = h->port; Window root, parent, *children = 0; unsigned nchildren; unsigned i; int hx, hy, ox, oy; int hwidth, hheight, owidth, oheight; unsigned border, depth; Hand *trav; int bad_overlap; /* find our geometry */ XGetGeometry(port->display, h->root_child, &root, &hx, &hy, (unsigned *)&hwidth, (unsigned *)&hheight, &border, &depth); /* find our position in the stacking order */ if (!XQueryTree(port->display, port->root_window, &root, &parent, &children, &nchildren)) { if (children) XFree(children); return 0; } for (i = 0; i < nchildren; i++) if (children[i] == h->root_child) break; /* examine higher windows in the stacking order */ bad_overlap = 0; for (i++; i < nchildren && !bad_overlap; i++) { /* overlap by other hands is OK */ for (trav = port->hands; trav; trav = trav->next) if (children[i] == trav->root_child) goto overlap_ok; /* check to see that this window actually overlaps us */ XGetGeometry(port->display, children[i], &root, &ox, &oy, (unsigned *)&owidth, (unsigned *)&oheight, &border, &depth); if (ox > hx + hwidth || oy > hy + hheight || ox + owidth < hx || oy + oheight < hy) goto overlap_ok; /* check to see if it belongs to another xwrits process */ if (check_xwrits_window(port, children[i])) goto overlap_ok; /* if we get here, we found an illegal overlap */ bad_overlap = 1; overlap_ok: ; } if (children) XFree(children); return bad_overlap; } static int warn_x_loop(XEvent *e, const struct timeval *now) { Alarm *a; Hand *h; switch (e->type) { case MapNotify: { Port *port = find_port(e->xunmap.display, e->xunmap.window); h = window_to_hand(port, e->xunmap.window, 1); if (h && h->is_icon && ocurrent->never_iconify) XMapRaised(port->display, h->icon->w); break; } case Xw_DeleteWindow: /* Check for window manager deleting last xwrits window */ if (active_hands() == 0) return TRAN_CANCEL; break; case ButtonPress: /* OK; we can rest now. */ /* 10.Aug.1999 - treat the mouse click as a keypress */ last_key_time = *now; /* 18.Apr.2001 - explicitly inform peers */ notify_peers_rest(); return TRAN_REST; case Xw_TakeBreak: /* informed that a peer is resting */ last_key_time = *now; return TRAN_REST; case KeyPress: case MotionNotify: last_key_time = *now; if ((a = grab_alarm(A_IDLE_CHECK))) { xwADDTIME(a->timer, last_key_time, warn_idle_time); schedule(a); } break; case VisibilityNotify: { Port *port = find_port(e->xvisibility.display, e->xvisibility.window); h = window_to_hand(port, e->xvisibility.window, 0); if (h && h->obscured && ocurrent->top) if (check_raise_window(h)) XRaiseWindow(port->display, h->w); break; } } return 0; } int warn(int was_lock, Options *onormal) { struct timeval now, option_switch_time; int i, val; clock_displaying = 0; clock_zero_time = first_warn_time; /* find correct options based on elapsed time since first_warn_time */ xwGETTIME(now); ocurrent = onormal; option_switch_time = first_warn_time; while (ocurrent->next) { struct timeval next; xwADDTIME(next, option_switch_time, ocurrent->next_delay); if (xwTIMEGT(next, now)) break; option_switch_time = next; ocurrent = ocurrent->next; } /* switch to those options */ /* This will always set_slideshows: good -- later set_slideshows will start from scratch. */ val = switch_options(ocurrent, &option_switch_time, &now); /* lock now if we should */ if (val == TRAN_LOCK && !was_lock) goto done; for (i = 0; i < nports; i++) pop_up_hand(find_one_hand(ports[i], 1)); if (check_idle) { Alarm *a = new_alarm(A_IDLE_CHECK); xwADDTIME(a->timer, last_key_time, warn_idle_time); schedule(a); } val = loopmaster(warn_alarm_loop, warn_x_loop); done: unschedule(A_FLASH | A_MULTIPLY | A_CLOCK | A_NEXT_OPTIONS | A_IDLE_CHECK); erase_all_clocks(); assert(val == TRAN_CANCEL || val == TRAN_REST || val == TRAN_LOCK); return val; } xwrits-2.21/giftoc.c 644 41346 41346 11036 6755607352 7650 #ifdef HAVE_CONFIG_H # include #endif #ifndef PATHNAME_SEPARATOR # define PATHNAME_SEPARATOR '/' #endif #include #include #include #include #include int is_static = 1; int is_const = 1; static void * fmalloc(int size) { void *p = malloc(size); if (!p) { fputs("giftoc: Out of memory!\n", stderr); exit(1); } return p; } void print_reckless(FILE *f, char *gifrecname) { unsigned long size = 0; int c; int lasthex = 0; printf("\n%sGifRecord %s = { (unsigned char *)\"", is_static ? "static " : "", gifrecname); size = 0; c = getc(f); while (c != EOF) { if (size % 60 == 0) printf("\"\n \""); switch (c) { case '\\': fputs("\\\\", stdout); lasthex = 0; break; case '\"': fputs("\\\"", stdout); lasthex = 0; break; case '\b': fputs("\\b", stdout); lasthex = 0; break; case '\r': fputs("\\r", stdout); lasthex = 0; break; case '\n': fputs("\\n", stdout); lasthex = 0; break; case '\f': fputs("\\f", stdout); lasthex = 0; break; case '\t': fputs("\\t", stdout); lasthex = 0; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': if (lasthex) printf("\\%o", c); else putchar(c); break; default: if (isprint(c)) { putchar(c); lasthex = 0; } else { printf("\\%o", c); lasthex = 1; } break; } size++; c = getc(f); } printf("\",\n %lu\n};\n", size); } void print_unreckless(FILE *f, char *gifrecname) { unsigned long size = 0; int c; printf("\nstatic %sunsigned char %s_data[] = {", (is_const ? "const " : ""), gifrecname); size = 0; c = getc(f); while (c != EOF) { if (size % 20 == 0) printf("\n"); printf("%d,", c); size++; c = getc(f); } printf("};\n%s%sGif_Record %s = { %s_data, %lu };\n", (is_static ? "static " : ""), (is_const ? "const " : ""), gifrecname, gifrecname, size); } int main(int argc, char **argv) { int reckless = 0; int make_name = 0; const char *directory = ""; argc--, argv++; while (argv[0] && argv[0][0] == '-') { if (!strcmp(argv[0], "-reckless")) reckless = 1, argc--, argv++; else if (!strcmp(argv[0], "-static")) is_static = 1, argc--, argv++; else if (!strcmp(argv[0], "-extern")) is_static = 0, argc--, argv++; else if (!strcmp(argv[0], "-makename")) make_name = 1, argc--, argv++; else if (!strcmp(argv[0], "-nonconst")) is_const = 0, argc--, argv++; else if (!strcmp(argv[0], "-const")) is_const = 1, argc--, argv++; else if (!strcmp(argv[0], "-dir") && argc > 1) { directory = argv[1], argc -= 2, argv += 2; /* make sure directory is slash-terminated */ if (directory[ strlen(directory) - 1 ] != PATHNAME_SEPARATOR && directory[0]) { char *ndirectory = (char *)fmalloc(strlen(directory) + 2); sprintf(ndirectory, "%s%c", directory, PATHNAME_SEPARATOR); directory = ndirectory; } } else break; } if ((!make_name && argc % 2 != 0) || argc < 1 || (argv[0] && argv[0][0] == '-')) { fprintf(stderr, "\ usage: giftoc [OPTIONS] FILE NAME [FILE NAME...]\n\ or: giftoc -makename [OPTIONS] FILE [FILE...]\n\ OPTIONS are -reckless, -extern, -nonconst, -dir DIR\n"); exit(1); } if (!is_static) printf("#include \"config.h\"\n#include \"gif.h\"\n\n"); for (; argc > 0; argc--, argv++) { FILE *f; char *rec_name = 0; char *file_name = (char *)fmalloc(strlen(argv[0]) + strlen(directory) + 1); strcpy(file_name, directory); strcat(file_name, argv[0]); f = fopen(file_name, "rb"); if (!f) { fprintf(stderr, "%s: %s\n", file_name, strerror(errno)); goto done; } if (make_name) { char *sin, *sout; sin = strrchr(file_name, PATHNAME_SEPARATOR) + 1; if (!sin) sin = file_name; sout = rec_name = (char *)fmalloc(strlen(sin) + 2); if (isdigit(*sin)) *sout++ = 'N'; for (; *sin; sin++, sout++) if (isalnum(*sin)) *sout = *sin; else *sout = '_'; *sout = 0; } else { argv++, argc--; rec_name = argv[0]; } if (reckless) print_reckless(f, rec_name); else print_unreckless(f, rec_name); done: if (make_name) free(rec_name); free(file_name); fclose(f); } exit(0); } xwrits-2.21/GESTURES 644 41346 41346 30213 7457331635 7411 Here is a list of the non-middle-finger obscene hand gestures that people have told me about. I haven't drawn them all yet. Do you know any obscene hand gestures not described in this file? Please email them to me at ! Please say if you don't want your email address included in this file. -------- ENCOURAGEMENT Good hunting in your quest. I have heard of instances where even Presidents have given thumbs up or #1 hand signals on foreign visits only to be mistaken as a flip off by the local population. A web based clearing house of obscene hand signs of the world may prevent a future war. Andy Miller -------- "ARAB CULTURE" If the finger goes forward instead of up it is equally offensive in Arab culture. I hpe it adds to your collection of cultural offensive behavior - - - - Well...there's the one that's particularly offensive to Arabs, Turks, and Greeks. Instead of the middle finger, the index finger is held up along with the phrase, "Yuppa, Yuppa". Dave Blain -------- BRAZIL In Brazil the "OK" sign is the equivalent of the middle finger. Daniel Harris -------- CENTRAL AMERICA [see SOUTH/CENTRAL AMERICA] -------- ENGLAND make a victory sign (v) with palms facing yourself and back of hand toward victim. It means the same as the bird in England. - - - - I was told by a friend in England (alot of English don't even know this!) of the origins of the peace-sign, with the back of the hand facing the person being flipped-off. She told me that in the earlier part of the millenium, when England and France were frequently at battle, the French would cut-off the fingers (necessary for shooting an arrow) from the archers, they had taken as prisoner. After this became known to the english archers, they would flash this gesture to the French in the battle-field, thus telling them that they still had their fingers and could still cause some damage in battle. At the moment, I'm trying to find documentation on this, but I saw your page and thought I might as well share the story. - - - - I just noticed that you're looking for rude gestures from other cultures. Appropriate to your current surroundings, I believe that a "peace" symbol (I think with the back of the hand facing forward) is rude in England. Last time I flew over, a guy asked for two drinks, and made that sign. The stewardess warned him about possible misunderstanding. John Jannotti - - - - If you make the "V for victory" sign, such that the curled fingers are facing towards you, (the backs of the two fingers are facing the person) this gesture is offensive in England. There was an article in a magazine about such gestures, but I don't know where it is any more. I think the "OK" symbol is offensive in some parts of the world, actually. Tim Park - - - - ... Oh, I've just remembered another one. The cuckold sign. With you right hand, make the "two-fingers" sign, putting your thumb against the back of your head. This looks a little like a pair of rabbit's ears (OK, with a good dose of imagination). Alternatively, close both hands, and extend the index finger of each. Apply these to the temples. (Like the geeky on in Waynesworld when singing "Foxy Lady"). Both these two gestures are meant to represent horns. When done towards a man, it means "Your wife (or girlfriend) is cheating on you". This sign is widespread in England and in France (don't know about elsewhere). On the subject of the English "two fingers" sign, I've heard two versions of its origin. 1. It is derived from the "Arab Nose Jerk" (though I have not tried to establish the real existence of this gesture in Arab cultures). You close you hand, extend first and middle fingers. Put a finger either side of your nose, with the back of your hand towards the other person. Now gently jerk your hand up and down, so the end of your nose twitches. Note the resemblance with the Italian gesture. 2. My preferred story. During the Hundred Years War, between the English and the French, the French boasted that they would win at Agincourt, and cut off the first two fingers of the renowned English bowmen that they were going to take prisoner. Well, the English won, and the French prisoners were made to shuffle pas the English bowmen who taunted them by waving their two fingers that had effectively won the battle. Keith Rhodes - - - - Subject: "Victory" V There seems to be some misunderstanding about the meaning of different V signs over here in rainy ol' England. The V with the palm facing away is a sign for peace. The V with the palm facing towards the oneself is the rude one. This is also the one that comes from English bowmen. This seems to be much less common nowadays though, with the middle finger on it's own coming into greater use. Gerard L Thornley - - - - Another gesture would be the one for "Wanker", which involves (usually the right hand) with all the fingers curved like a very, very loosely clenched fist with the thumb and index finger tips touching. With the hand held at an angle of 45 degrees from the vertical and the palm facing inwards, you then oscillate the hand from the wrist in the appropriate manner. This may be UK specific and perhaps needed no further description apart from the title... :-) Ben Curry P.S.: > THanks for your gesture! Pleasure, just doing my bit for a multi-cultural society. -------- GERMANY just wanted to tell you that people on the streets of Germany will also recognize the gesture for what it is meant for in Russia. ... Was that the fist with the raised middle finger? Yes this means fuck you over here (a raised cock with balls). Same as the russian one with the thumb between index and middle finger (more the process of fucking - a cock in a vagina...). Usually you also move the thumb a little up and down in there ;-) Cheers! Anonymous -------- GREECE Here's another one for you. I got it from "How to Hold a Crocodile" (Diagram group). I'm quoting it from memory, and I've not read this entry for about three years, but I think I've got it down accurately... You should be able to find a copy in a library, in any case. In Greece, there is a sign called "moutza", that means "go to the devil" (although it's taken to be more offensive than this phrase in the UK). 1st degree (mildly offensive) Fist closed, except for index and middle finger extended. Back of hand towards self. 2nd degree Hand open, palm towards other person. 3rd degree Both hands open, arms extended towards other person, as if pushing him away. 4th degree Both hands open, arms extended towards other person (as 3rd degree). Also, one foot extended towards other person. 5th degree (extremely offensive) (must be sitting to do this) Both hands open, arms extended towards other person (as 3rd degree). Both feet extended towards other person. Keith Rhodes - - - - See also Dave Blain's message under ``ARAB CULTURE''. -------- ITALY In Italy, a reverse V sign, with knuckles facing the viewer, also means fuck you. A variation of this gesture is to insert your nose at the crotch of the V. The "variation" is perhaps the original gesture. I gather that the nose is supposed to be a penis and the V a woman's private parts. Or rather spread legs. Name withheld by request - - - - In italy we have the 'umbrella gesture', which usually means 'take this whole arm in your ass', used to enfatize happiness on someone else's troubles, like when winning a challenge or when something bad happens to the 'enemy'. It is not considered really offensive, as with time it has lost it's meaning and now it is just a 'i-am-so-happy-that-you-are-losing' gesture. One arm needs to be pointed out as a straight line, closed fist facing up (the position is the same one used to show veins in the arm before taking an injection). The palm of the other arm slaps the juncture of the straight arm, so that the straight arm bends till it reaches a 90' angle (or something less than that). This is easily explained (i hope) The palm is the back of the poor one that gets fisted, blocking the juncture not to let the arm enter more. This to show a complete penetration (how romantic). Since my explanation is really hard to understand i'll try to 'draw' the scene (as someone over the person would see): first: then: o | o | o / = | o---. | | | | There a very old video of an italian rebel, prisoner of war, forced to march with the german soldiers in front of Hitler and other generals of the nazi army, like in a parade (this was done to show to everyone the prisoners that germany could win). In this video the old man does the umbrella gesture to the generals, knowing that in germany this gesture has no meaning, but really meaningful for the other italian p.o.w. I hope that this piece of news was interesting and useful for your list! Tommaso Gagliardi -------- IRAN Some gestures I have found are the "thumbs-up" which is obscene in Iran. It literally means "go screw yourself". -------- ISRAEL a rude hand gesture in israel is to point down at your upturned palm with the forefinger of your other hand. This means "grass will grow on my hand" before the words of the speaker come true. -------- JAPAN In Japan, inserting the thumb between the first two fingers, in imitation of the clitoris, means something like fuck you. Name withheld by request -------- KOREA If you're in Korea (or around Koreans), NEVER play "got your nose" with little kids: If you make a fist and put your thumb between your index finger and middle finger, you're essentially saying "fuck you." I've also been told, but have not really verified that if you stick your thumb between your middle finger and ring finger you're essentially saying "fuck you in the ass." Rude enough? Ivon Katz -------- POLAND In Poland we use the same as Russia - but it's not too offensive. The correct & polish fuck-you-gesutre takes your whole arms to do ... Put your right forearm horizontally and close to your body. Flex your left arm. Put your right wrist on the inside of the elbow. Here you are. Michal Pasternak -------- RUSSIA in russian it is a clenched fist with the thumb going between the first and second fingers(i think kinda like an m in sign language altho i fergot m,n,t, its one of those....i think) ... > hi yan, > > would you normally show this to someone with the back of the hand facing > them, or the palm side? > > thanks! > ed its with a clenched fist with the thumb facing towards the person Yan Pritzker -------- SOUTH/CENTRAL AMERICA --Flicking someone off--the preferred way to do it in Ecuador, Colombia, Peru, Venezuela (most of south/central america) is with the pointer and ring fingers bent at the first knuckle, and the knuckles slightly ahead of the finger--thus symbolizing genatalia. --Whereas this gesture is perceived as a dismissive "nevermind" in the US, throwing your palm-down hand towards the ground (bending your wrist) is interpreted in latin cultures as implying that someone is homosexual--and a sure-fire way to start a fight. --Holding your hands, palms in and slightly down, at sternum level and shaking them (rotationally) is similar in meaning to shaking your head, but is also fairly dismissive and impolite. Phillip O. Knoll -------- TURKEY See also Dave Blain's message under ``ARAB CULTURE''. -------- UNKNOWN/UNSURE I'm not sure which country the following gesture comes from, but my guess is somewhere in Africa or middle-east, correct me if I'm wrong. I heard this from a "User Interfaces" course lecturer. Ok, the gesture: If you casually raise your hand meaning to say 'hi' with your open palm facing another person, it means 'I throw dirt on your face'. I hear this is a rather harsh insult. Comparable to 'fuck you' or even worse. I recall that some version of MSWindows has this gesture as a "stop" or "attention" sign. Wonder what they might think of it... :) Heikki Junnila xwrits-2.21/xwrits.1 644 41346 41346 27645 7465621543 7665 .\" -*- mode: nroff -*- .ds V 2.21 .ds E " \-\- .if t .ds E \(em ' .TH XWRITS 1 "8 Feb 2002" "Version \*V" .SH NAME xwrits \- reminds you to take wrist breaks .SH SYNOPSIS .B xwrits \%[\-display \fIdisplay\fP] \%[typetime=\fItime\fP] \%[breaktime=\fItime\fP] \%[other options] .SH DESCRIPTION \fBXwrits\fP reminds you to take wrist breaks for prevention or management of repetitive stress injuries. When you should take a break, it pops up an X window, the warning window. You click on the warning window, then take a break. The window changes appearance while you take the break. It changes again when your break is over. Then you just resume typing. Xwrits hides itself until you should take another break. .PP The \fBtypetime\fP option changes the amount of time between breaks, and the \fBbreaktime\fP option changes the length of a break. The defaults are 55 minutes and 5 minutes, respectively. .PP Xwrits's graphics are brightly colored pictures of a wrist and hand. The hand clenches and spreads ``as if in pain'' on the warning window, slumps relaxed during the break, and points forward valiantly when the break is over. It is trapped behind bars while the keyboard is locked. Other gestures are included (see the \fB+finger\fP option). You can also use your own pictures: see the \fBwarning-picture\fP, \fBrest-picture\fP, and \fBready-picture\fP options. .PP Normally, xwrits works through annoyance\*Eit flashes until you stop typing. However, an option makes it actively prevent you from typing by locking the screen. See \fB+lock\fP below. .PP Xwrits notices when you leave your workstation idle, and treats a long idle period as if you took a break. You can turn this off with the \fB-idle\fP option. With the \fB+mouse\fP option, it will also monitor your mouse movements\*Eyou won't be able to move the mouse during a break without aborting the break. .PP Each wrist break normally lasts the same amount of time. This is what doctors suggest, but, if you'd like, the \fB+quota\fP option will reward you for taking small breaks by reducing the length of the next official break. .PP Some doctors recommend taking a short ``microbreak'' every five minutes, as well as a longer break every hour. To use xwrits this way, just run two xwrits processes, one for the microbreaks and one for the longer breaks. ' .SH ESCALATION It is easy to put the warning window aside ``for 5 minutes'' and ignore it for fifty. The \fBafter\fP=\fIdelay\fP option causes xwrits to escalate its activity over time, making it harder to ignore. .PP Options following \fBafter\fP come into effect after you have ignored the warning window for \fIdelay\fP. In other words, xwrits's behavior escalates after \fIdelay\fP. For instance, with this command line, .nf xwrits flashtime=:2 after=10 flashtime=:.03 .fi the warning window will begin flashing very quickly if it is ignored for 10 minutes. .PP Any options preceding an \fBafter\fP option also apply following it, unless you explicitly cancel them. For example: .nf xwrits +finger after=10 -finger .fi .PP Multiple \fBafter\fP options create a series of escalations. \fIDelay\fP arguments are cumulative, so ``after=10 after=10'' means the same as ``after=20''. .PP One interesting use for \fBafter\fP is to make a break's length depend on how long you waited to take it. For example: .nf xwrits break=5 after=10 break=7 .fi Here, a wrist break normally takes 5 minutes. However, if you ignore the warning window for 10 minutes or more before taking a break, the wrist break will last 7 minutes. ' .SH OPTIONS All options may be abbreviated to their unique prefixes. Some may be abbreviated further, in which case the smallest legal abbreviation is shown in brackets. Options are processed from left to right. .PP Options listed as ``\fB+option\fP (\fB\-option\fP)'' are toggles, which can be on or off. A + turns the option on; \- turns it off. Off is the default for most toggle options, and only the on behavior is described. You can leave off the + sign if you like: ``xwrits +finger'' and ``xwrits finger'' are equivalent. Or you can say ``\-no\-finger'' instead of ``\-finger''. .PP Many options take arguments. You can give these after an equal sign, as in ``xwrits breaktime=2''. Non-optional arguments can also be given separately, as in ``xwrits breaktime 2''. .PP Time arguments are expressed in minutes. For example, ``2'' is 2 minutes, ``2.5'' is 2 minutes 30 seconds. Use a colon to specify seconds: ``2:05.4'' is 2 minutes 5.4 seconds, and ``:5'' is 5 seconds. .TP 5 \fB\-display\fP \fIdisplay\fP ' Specify the X display. Xwrits monitors this display for keystrokes and mouse movements, and displays windows on it. You can simultaneously monitor more than one display by giving this option multiple times; for example, ``xwrits display :0.0 display fun-orgy:0.0''. ' .TP 5 \fB+multiscreen\fP (\fB\-multiscreen\fP) ' When this option is on, xwrits will open every available screen on each specified .IR display . Useful for multihead displays. ' .TP 5 \fBtypetime\fP=\fItime\fP [\fBt\fP] Allow typing for \fItime\fP between breaks. Default is 55 minutes. ' .TP 5 \fBbreaktime\fP=\fItime\fP [\fBb\fP] The amount of time a break lasts. Default is 5 minutes. This option can be supplied multiple times; see .SB ESCALATION above. ' .TP 5 \fBafter\fP=\fIdelay-time\fP See .SB ESCALATION above. ' .TP 5 \fBbars-picture\fP=\fIfile\fP [\fBbp\fP=\fIfile\fP] Sets the background GIF image that appears while the screen is locked. By default, this is an image of bars designed to work with the usual \fBlock-picture\fP. If you specify your own \fBlock-picture\fP, however, \fBbars-picture\fP defaults to a black screen. (Say ``bars-picture="&bars"'' to keep the bars.) Animations are not acceptable. ' .TP 5 \fB+beep\fP (\fB\-beep\fP) Xwrits will beep when the break should begin and again when it is over. ' .TP 5 \fB+breakclock\fP (\fB\-breakclock\fP) [\fBbc\fP] A clock will appear in the resting window showing how many minutes remain in the wrist break. ' .TP 5 \fBcanceltime\fP=\fItime\fP [\fBct\fP] ' Allow typing for \fItime\fP after a break is cancelled. You cancel a break by deleting all xwrits windows with your window manager. This time should probably be less than the regular type time. Default is 10 minutes. ' .TP 5 \fB+cheat\fP[=\fInum\fP] (\fB\-cheat\fP) Allows you to cheat during a break. You can type \fInum\fP keystrokes before xwrits cancels the break. Default for \fInum\fP is 5. (If you're using \fB+mouse\fP, mouse movements also count as keystrokes.) ' .TP 5 \fB+clock\fP (\fB\-clock\fP) [\fBc\fP] A clock will appear in the warning window showing how many minutes you've put off the wrist break. ' .TP 5 \fB+finger\fP (\fB\-finger\fP) [\fBf\fP] The warning window will be rude to you. ' .TP 5 \fB+finger\fP=\fIculture\fP The warning window will be rude to you, according to \fIculture\fP's idea of rudeness. Possible values for \fIculture\fP are `american' (the default), `korean' (synonyms `japanese' and `russian'), and `german'. ' .TP 5 \fBflashtime\fP=\fItime\fP The amount of time between flashes of the warning window. Default is 2 seconds. ' .TP 5 \fB+flipoff\fP (\fB\-flipoff\fP) Synonym for \fB+finger\fP. ' .TP 5 \fB+iconified\fP (\fB\-iconified\fP) The warning window will initially appear as an icon. ' .TP 5 \fB+idle\fP[=\fIidletime\fP] (\fB\-idle\fP) [\fBi\fP] If you leave your workstation idle for \fIidletime\fP or longer, xwrits will behave as if you took a break. The default for \fIidletime\fP is the break length (see \fBbreaktime\fP above). \fBidle\fP is on by default. ' .TP 5 \fB+lock\fP[=\fIjump-time\fP] (\fB\-lock\fP) Xwrits will lock your screen until your break is over. You can prematurely disable the lock and get a normal warning window by typing your password (see \fBpassword\fP below). The \fIjump-time\fP argument specifies how fast the screensaver will move; default is 4 seconds. If the keyboard has been grabbed by another application when the lock is attempted, the lock fails and a normal warning window appears instead. ' .TP 5 \fBlock-picture\fP=\fIfile\fP [\fBlp\fP=\fIfile\fP] Sets the GIF image that appears while the screen is locked. Animations are acceptable. See also \fBbars-picture\fP. ' .TP 5 \fBmaxhands\fP=\fInum\fP No more than \fInum\fP warning windows will appear on your screen simultaneously. Normally, there will be only one warning window, but see \fB+multiply\fP below. \fINum\fP cannot be less than 1, or more than 137. Default is 25. ' .TP 5 \fBminbreaktime\fP=\fItime\fP Sets the minimum break length to \fItime\fP. This option is meaningful when \fB+quota\fP is on (see below); no matter how many short breaks you take, the break length will not be shortened below \fItime\fP. It defaults to half the break time or the quota time, whichever is larger. ' .TP 5 \fBmono\fP (\fB\-mono\fP) Xwrits will display its graphics in black and white. This may be useful if you live in a world with a limited colormap. ' .TP 5 \fB+mouse\fP[=\fIsensitivity\fP] (\fB\-mouse\fP) Xwrits will monitor your mouse movements. Every couple seconds, it checks whether the mouse has moved. Movements of more than \fIsensitivity\fP pixels in any direction are treated like key presses. Default for \fIsensitivity\fP is 15 pixels. ' .TP 5 \fB+multiply\fP[=\fIbreed-time\fP] (\fB\-multiply\fP) [\fBm\fP] A new warning window will be created every \fIbreed-time\fP. Default for \fIbreed-time\fP is 2.3 seconds. ' .TP 5 \fB+noiconify\fP (\fB\-noiconify\fP) The warning window will not allow itself to be iconified. ' .TP 5 \fBpassword\fP=\fIpassword\fP The password you type to unlock a locked screen (see \fB+lock\fP above). Xwrits does not protect this password from intruders. Therefore, do not use your login password or any other password you must keep secure. Default is ``quit''. ' .TP 5 \fB+quota\fP[=\fItime\fP] (\fB\-quota\fP) If you leave your workstation idle for more than \fItime\fP, the idle time is deducted from the length of your next break. This option turns the break length into a break quota\*Einstead of resting for \fIbreaktime\fP consecutive minutes every \fItypetime\fP, you must rest for a total of \fIbreaktime\fP minutes per \fItypetime\fP. Default for \fItime\fP is 1 minute. See also \fBminbreaktime\fP. ' .TP 5 \fBready-picture\fP=\fIfile\fP [\fBokp\fP=\fIfile\fP] Sets the image that appears when your break is over to an arbitrary GIF. Animations are acceptable. ' .TP 5 \fBrest-picture\fP=\fIfile\fP [\fBrp\fP=\fIfile\fP] Sets the image that appears during your break to an arbitrary GIF. Animations are acceptable. ' .TP 5 \fBtitle\fP=\fItext\fP Xwrits windows will have \fItext\fP for their title, instead of the default ``xwrits''. ' .TP 5 \fB+top\fP (\fB\-top\fP) The warning window will try to keep itself above all other windows on the desktop. (Note: it can be fooled into staying only partially visible.) ' .TP 5 \fB+verbose\fP (\fB\-verbose\fP) Xwrits will print a lot of information about the windows on which it is listening for keystrokes. This is mostly useful for debugging. ' .TP 5 \fBversion\fP Prints the version number and some quickie warranty information and exits. ' .TP 5 \fBwarning-picture\fP=\fIfile\fP [\fBwp\fP=\fIfile\fP] Sets the image that appears on the warning window to an arbitrary GIF. Animations are acceptable. ' .SH EXAMPLES Here is the way I run xwrits: .nf xwrits typetime=40 finger after 15 clock multiply=5:1.4 .fi This looks pretty spectacular: .nf xwrits t=0 b=:2 f fla=:.5 m=:.31 max=100 -i .fi Whee!! ' .SH AUTHOR Eddie Kohler, kohler@icir.org .br http://www.icir.org/kohler/ .PP http://www.lcdf.org/xwrits/ .br The \fBxwrits\fP home page (for distributions and so forth). .PP Idea for idle processing code from .BR xautolock (1) by Stefan De Troch and Michel Eyckmans ' .SH BUGS Xwrits does not use the X resource database at all. .PP More options might be nice. So might more careful screen locking and password protection. I would like to include rude finger gestures from other cultures (see the GESTURES file in the distribution for gestures I know about so far). .PP Please send any bugs, comments, or suggestions to me. .PP Yes the misspelling is intentional. .PP Yes it's my left wrist. xwrits-2.21/logo.gif 644 41346 41346 757 6575115474 7627 GIF89aDD!,DD@4`XPж F7z$m 0L P?d`j:0@CH .-7i^3E#K[ Mʾ;c:e҇PD8%HVxsXdzHT&iŶy9iiڸ:qwrKB{1b PJf:cL.a-`>A/`O [/G[ÉZxhCfr1sQH ʩ߽\Y倔8<'IT<{4 (LJʦRvDj#DQZ u齰ZJ6ڑ4۹t}fVB H8b[ x=Rz͜łtOΤK5jXҬ[g gٴsݗo;8u ?Nț]\靡/gN=dnNk{ kw>\l˿UoW֟} x8ݕ {%pE_EtUxba85X҉f"l%bi*(Vx6cȣV>h.Eu];MNANS^fYVHIUa%eX*g`dro¹'cbh\g}C-ѹaZ褌vgB)vj~ }z^\Ҩjdq*^j$&k*ZNV;_>Ғ+ Jkr+f厘6iv~ca7cujI1W[p%R˯{ 3q i气&js-|,@xs<,:}d3;MLR=^^ څ4W]E'3fS=qN[,n?g5 wB7bu\wi8u;6v檽n# XQ{^~xU%)3o:Zg){_~izy}^)9f~/8+Ƴ7r^{g]{ovY'o-66?Lj<۝jy@?v#`-/ kB@,X>E8(A9MpZoJhB*[hA1jEls!fC_gD!f@\0=!zj!e**)lV#Zp^lDF1Rx腪u84ʃX{G9~P_'BȐ${?Qw!%9yFONYλ$&Gg:2nL S $|)C`L\܂t8"P fIL陒ǜ/-GlrM&(ǥ1< I= %D.cyJʡ!**k= $POx@F}pl7J1B˷PnIK9;z ~TJnCnidq!ᓊ'3(MUғ.Ty99SvpcYV?̝J7+TtzLЕjkkt'KMI8B%P*7:uf^`TkR-)UöIvOƛ#iSqzl^S46˅Img<޸³2 .&N} 7u =GИ-^CbWg2xÎ-G[8}3mi>Ρft+iJKZN^LRC:б.]}+XЦS]Z[t-lY##gGټ>`٢mmI|wS,I;~Һ"wmj:6vAv% ?-_)*>ccظ;WG<9E*/[>.V/kns""9o=B ыκ#Xz"Rz2.a-`>A/`O [/G[ÉZxhCfr1sQH ʩ߽\Y%8<'IT<{4(LJʦRvDj#DQZ u齰ZJ6ڑ4۹t}fVB H8b[ x=Rz͜łtOΤK5jXҬ[g gٴsݗo;8u ?Nț]\靡/gN=dnNk{ kw>\l˿UoW֟} x8ݕ {%pE_EtUxba85X҉f"l%bi*(Vx6cȣV>h.Eu];MNANS^fYVHIUa%eX*g`dro¹'cbh\g}C-ѹaZ褌vgB)vj~ }z^\Ҩjdq*^j$&k*ZNV;_>Ғ+ Jkr+f厘6iv~ca7cujI1W[p%R˯{ 3q i气&js-|,@xs<,:}d3;MLR=^^ څ4W]E'3fS=qN[,n?g5 wB7bu\wi8u;6v檽n# XQ{^~xU%)3o:Zg){_~izy}^)9f~/8+Ƴ7r^{g]{ovY 'o-66?Lj<۝jy@?v#`-/ kB@,X>E8(A9MpZoJhB*[hA1jEls!fC_gD!f@\0=!zj!e**)lV#Zp^lDF1Rx腪u84ʃX{G9~P_'BȐ${?Qw!%9yFONYλ$&Gg:2nL S $|)C`L\܂t8"P fIL陒ǜ/-GlrM&(ǥ1< I= %D.cyJʡ!**k= $POx@F}pl7J1B˷PnIK9;z ~TJnCnidq!ᓊ'3(MUғ.Ty99SvpcYV?̝J7+TtzLЕjkkt'KMI8B%P*7:uf^`TkR-)UöIvOƛ#iSqzl^S46˅Img<޸³2 .&N} 7u =GИ-^CbWg2xÎ-G[8}3mi>Ρft+iJKZN^LRC:б.]}+XЦS]Z[t-lY##gGټ>`٢mmI|wS,I;~Һ"wmj:6vAv% ?-_)*>ccظ;WG<9E*/[>.V/kns""9o=B ыκ#Xz"Rz2t<҈E \6c~dPNѠ^t ڳ>}]$Dwphhg$yPy9uyUj3j)"b 8k{kR;xwrits-2.21/color/okl.gif 644 41346 41346 4320 6753576102 10575 GIF87a,,(G,,,ڋ޼H扦ʶ L ĢL*̦ J* j֮ ߲3NB-i,O7(xFx8ٸy$Igij#::*vڒZJ+Zq+k\5yHE8DyA2\FL:yb#A,i%2=Tg&Kt:МԢ2}j[%kP>snдjm˵,Hֵ*\hpvkXݢ8ީ=֒Og9;YLQcaMw\9eʣ=>۬Ksk{2dI}<PM5yű.gnvt$;j $kx%囝>FF7-%H O-~֖px 0t)Hk 7sYx!V!I| ]f%Lbh-^6#_c!}W0؝SE-Q<eHDvۆU؏[FT݉_ cRgOiη&u qvUdy'XizhH" |ha@i2Z)fqکv*ꪬūJ鬴^j뫸)!̸:,iZb쭚(nL, +l6)\2Lsr6X t=XјઋE|?s{x|>󧸿 c+^qoALt Yݗ j0o6BuN S$",ߘQVqUAu&:SJrz.)L[Йdh>;9tE1 ϥڴ{?S@UY55@V:-ԣ]WҠp!8+JkUnQvɲV} j\W*ħ^*X}(Tl-ᔪ )d ;2Yrb%hԲfK^iWdvoYϪtCqE[!v`m. ]lv Bu :IIvs t:>6 |I\ͼ,9hV^eLW=z4-򫿱2=pMt>(@5=W°mq@kUU88 Rf`ZY(`'y&ف`h1 :I8AV{a ^3y'%RНB%bp"1E dM9J#='c{7E)>qΓL6Fw JK^Zn\&X8sm&Oj&0&dW:g.{9Ƴ||/χm_/7x`}f/w}_uoHϟ3PmPG5=pz_(ÑO  x^a#XB[P[nX yfp,lwH'p<LD%T XE+X4 E/a$XƅmY4#E1q XG7i G?~QGH["ѧF\OlX`%9Hyl.@P.NsD^ J!2l)Y@<:L%JA`xZ W&iyH`*O1Н!`KU 1%IcFpi8= NhapڄzE$mYJۡ3g8NgJ\dYA/w{ J7O"h Bft 'ع?z/'?)j><9ʄh ʶrJ42KjQf~-M{42)OKr~tBBQGTH"UijYӢqթc-jY:MfϪ:::Zͫ!XkXM׀RKk<⸵ZLFWl(+NXeu&Mlk"[D֩oDl`źY{U|mIgjZY-8YkYU -amHƶ}e, XSךUGmOK/܊''RQ4,U5[K-t7\SSX-޵jhs_ <7Q*׼em_rcnyHx%&]^ EB'{ 4ෂM%#Ĥ\gE cu{缢Z͡&.=Z9`(Va_;u}Pީ5gzs 櫿^iݩo-ȮlZg95Nno, /{ڎόIxn;my>[J;lMr D G=ǝu3|,:>qFK;Z:|O}a\`jr+;\Yg{nzbX7pI+qo潯{/|߻krq2yK6, jc_w=`upFc<>+W3Ko_׼3G9Jy9O{>/IK?0'ӗ0q[|۽.Aw}0DXzRZAzX'xiXE*ǖ%x/8$\wڨM1q'Htr&zoW7boh㖍Axox:ܨ*,y}xWZW%Ʉ;xwrits-2.21/color/fingerl.gif 644 41346 41346 4533 6753576102 11444 GIF87a,,,,,ڋ/آ扦ʶ=ĢB {KFjed';v}Wh8'Ax(HYi)9g8):ZI` {*{Ky˛[K+ <|H\X,Ml<}Vm͍ m-8~m~(nS~ϲ@S>+:J3Ddذ1n#h K"(hpOFE aŃ2>B y⷟+BJU6-+Z\ t:›R}]p0 ăy W lW2s8fz2kыKy^eX  %6״0EMܛ,m%;;v6U_?u-~^Ƚ77ݿP~=.~6ן '6jPՂ :(aTb{fVJ`a}'bx [+N",m&S}Kݍl16i#xLF8Mid X[Vie&'yGaa΂fwWRY⩹&~mĦU $k5OmduyYeigJsy(v^֕"Q^ڣZv4j$[Yg֪ZnJ%竎,zj;렰ƺYʺN;-ZQfZ-"g[݊n/(v镸q.vZ {/>~K  0ZK*k1s< U 2d<.ڛ<3?Gp8v5rt&/4Pk?tOMt|\NSm6NhW<5{I֭;/J7ߵsn >xs1,:l܋])r=&Ík^͑c>9Ѿ-x1ޣ*롻Ψ~ڵ.2+;=[*d(y;m Hvw'\= L]p~ȃ/S2?96( I>ڸ ۓk"# %s/1PE hf?Qł  h$g 4^E}v[ E%L e8-bKTgh1? (}GDr͏5:EY8 ڮ# d AɩdDU {%&ioTFh$pRZȴш#MFŰъ$"M'r D&#Q:PyHdX8#,cYN[` W񖸜S)YKAЗ%9e^]T^R<3&6eim.كdz_b؀ r*ugI~pia2qBOxrQ@OGtUd`:>"$L4Ȋ?H'"TcKT}b ))6jO" %zjME™ӣMILæ1jS+URjVJXvNpxBkԺVͭo-]%Mpd+^O[ѯ_W6~z$bWCKJu2lf5XBT2hyEmtYО+Q5bY0lezȈַmKm{ۗv p!Z2NUnqI]*;tۘgn'74UwUjz\.7z޿ -ysi/ "o L` zN0ыh4t#>yT n]>O811>)bؿ*f8_Œcu\c?6Ɏ:7:QUqQlK&73_aKؑ,X!ȗ\f3oy2 ڙɜf5_3|ۛ%ϙy3Og1qh-ʼnV%[0ߤ[iK/!]ވυEiХuyZ;~ \农9[rD\)2z4,#AdsWDЃ<ozљtW=zԩq:;xwrits-2.21/color/spreadl.gif 644 41346 41346 3231 6753576103 11443 GIF87a,,p,,,ڋ޼H扦ʶ L ĢL*̦ JԪjܮ N ((Phh8(rX8iIAYx9J *ZYj9*kz ;;jؘ \;Wl̬|--\-==MFI}6^v z:Oh̞o_?s8_1rR0LC"EƓQ ƌC~QDYP$/Ɣ9fMZ7qFIQϙw9 P%RYӧP9`MBѺgWJ )׎a'RUշTKWJ\ri]d^lxQ=xΗ}~8`o=<^)ɔrx Ǒ=KʄPtΝZNQ[+c -PgmWmT6n_vwmPݤ⧏,}`a J<< 3ʛR͗zk] ݿ i_kGa1T}Q]ƠYJ㓂5ldygaà&>x'h8b2|cQ>iU&dHdd~J>)͆elb/Y)#:a#VV8BfBgʒ9$䦃pI%6dihDa'y&xo*:ff'JZ\Ze(i%J %z`n+'^ 2l+B;'0zl`>e^lsubmJFJn+f /)oB$LiPp" ́xpO\PN_Zqm|"#~̲J 7r3/\3s3;P@"?=#SMZ^ vbMvfvjvn wrMwvߍwzw~ xNx>+b鸸FlQSi`'pn#(<2b5!87ޢ[ز:_zm{.6CO<m.G,>m\{C+Q~>@OrqǃGId+Mn=y9',a4*B\5A!|,HHAX0 ̠HB`y3KeS5.P Y!#Qa@J%Zhag b.V2J!(A@vc Tc`XG;"|X/,&j"N.?e3$/E|rdH ?걄#?IMnbD(H3>4)YY!LPHW^U-!R-Xd b3u(gc*R7VI`DfHnz3|2ǩMpNlA9vS9N^n~/?O_?o0@. <`A x1"Ć*@ƍ:ØA$KvԷ d M|)q1$a_Ҽ3ϐ( }ѥ$"8))?'RZRjEFZ{b 66mZw1;Uܹtuc޽|]E7c #kŌ#Ʌi.QI9*` :tݟE>ZFS~z k&wFۼ{ϕGo!k`=:V/[z ܻo»x]?|D)лp=^Pe?H jW`nyNHQacaE؞" #Wy%^}b9g6b7!U9ndG JfGK>闏:BIeUMXe1I^_!cgky%osIw~ɥ{]}ByզrqRu#XNiquVXimEituBcWK}A5AM* ZMjCCLڪNװPL+糱),뭴j!&-^.X&뻜.Ι;fb 0Kֶ:4&|難QlezgUk\Dz@͵릪pht:<,"¦ĝlҺ\a_ -/Pn3,no>?^~ߝO/Z@gDvXBa 50WD[gUuUFUOu$THN#1tRJF+$PL>3{סf8Ag!M@s,(RrJkTQZjUP 6X]~KϦ}![nڕ;5jҼvVU8h]o:pZ{&V<bc_@V+q]1SWgA9zzFnƖ͑=۷#cԍwo kx6NUV掜?o]:ү'wv>>x|GW"9e @IRVDKLXߐIZ)d^~i~ 5%\uҦ xja]B&(&'Yb,b𨗑R folYD"hZ Ʀ'azêBɩBκ$*i꥞.F'lj*ʥ";cO*+Z,9Pmj Î}nUN[^R1ﶦB/\[ /EY w0aXEGl&bL%kpr۴ӆeʭ Z3?"OАq  ϜF "u>/ TѿB"U=61M-۲qc6}pUP} 4wq|#]`˒/q'gěsNؠK؉裓wͥb+pa'N;xg S>{3>~ {v`ț,{sn}ל ~O}hn1> v޺H?ᆳI_ʜ9M/O6 plKc{ g@hP[W aT=~#DaYb'l!^-g0%7"b<:ް;X)mW3 kx  ."O#"if"[D%\'53vQDt8UubQA$$ E:ё#%Ć;V.Hrς}e@-zQg?QSl)9ӤCǐ>, B5NS+T|mUe"0Gj1 2u@;bΠG w7ѾýHvz?yW^Շyx7|} }xzh~zzzx H;"x$|*p&}2<(6={ X{.x,8}@8:><|>{Jx}4XDFHo0wRxPXZ?Tv^xl`XzL{f{Nx~j~h8|nX|px|r|B8~t}d8{x~vXl8~|X~x~&xX(V ;xwrits-2.21/color/germani.gif 644 41346 41346 522 7033755351 11407 GIF89a22.! NETSCAPE2.0!!,22֜ڋ޼H& jw@׽[reeNhjO*qZ؈֪vWv S19;Fetx0/#G6ȧX8 GYcxgI$7ZH xII4Ft:B&(bq&=-a]\MaNYm"R!!, %HI&jU1uh50 %ߝ R;xwrits-2.21/mono/barsm.gif 644 41346 41346 106 6533415500 10712 GIF87a,%qllU޼HiN]jBLu;xwrits-2.21/mono/restim.gif 644 41346 41346 476 6533415511 11125 GIF87a22,22bh"+mƔ뾅))JjJLI X_0YJ]Ofc:1՜6{] Z[8 uM7T!s\[H(UWS6dב֧$yY5yeىI9)G4*wY**Kʈuk҉k9;Z&\9 L[ ? e>")t]m;{J=BPsjUnv>7(UShgHF%(IH65Hɉ)7YgtʪDhj sX F6V+(fbԨ"K 5(,& .>N^Q;xwrits-2.21/mono/clenchim.gif 644 41346 41346 350 6533415501 11372 GIF87a22,22DŽc |Hxr7zfHgj ;vLwz C1HLȥ eJSKjjM;WNNx ^|9"Xbx(HLjg77vg`gb9` X*U*SyFGŚF;X& ܢ,u4,DlM=}]ݽ-NR;xwrits-2.21/mono/oklm.gif 644 41346 41346 5541 6533415510 10601 GIF87a,,,,,c |Hxr7zfHgj Kǯ|5v yCqt4*IBM(jl [O=lhɽ'H(6gX؈H i9yYY) jJiYJwʚ*ZF +k; \;[;,-ml|+{9^>}Nn.^}>~^@_N߽|0/7 6‰ :H0#;{80$Xvhl$F+˙<ѢF3#3gE,kf+@g=lX0]tP9r4 5+A*x5*VS~]*GcnJYkɊlWsu Qq+O67nXƋ+@7aē- n12LYeJ ꯳<0mNiƋwbڲ֮P6@=w㿻'Ht/lt֝sKy{/j8|c9ݘH|v .Ȓu`x!!9iG y xSrh|H`6*Hڇ$ݍ,4ljȘ` ɤ@$d*cB6tK:Py[["isM8Yef=fhu)fdxgr9U&GVfj揄yɓS!nhYS Rjwjy‰JorN*]aje"j6+ Ox.h'[Z\ꫵ:ග=lQ).ՖKJmJ^;^JMv ξ&Ψ﷿4&7p#@ڛ0Sڭ;&,ru*[Dܺ(+`u кؗ6pi<2B݋\<R3 HC .-3V Z?LacwO_]lh]32-Oo݅&3(܀҃wߎ8&SwNʭXzn0[9{[>kw_ώCcێo\;κ zėx{<~#+u/}Fk08\=;~ǟg濏~o?a߻ } #@ 9$갻jO|;k I0ӟNd(HM~K^ a8*Ƃ  M@&Op2 KP;<])C"IT`4щ2`kH|Ix+ф$ؼE"bp0u/(7JvxAΌc8E@>OH#Ƚ0\YRr?$'m K)ahDe0l $cC*~4]-MHr ~ق:s,chAfJp9hB tJEEuH~)fԣ$}!H5 et[h-,Ry'%!b:ӜN/)u WB\#bP*y1FES?F3O*9UԪ\AA ddb:q͉͋emnUn !|t]Ǚʺ[kYjJ~j0U9w%l z2=_b5>ձ-,-5;̱}_ϊHϮƴn! %ZULje2FRJmUjG·gpIܠ.& {TVV,teJ[҉uuZ--wKGy71xyޕfUzlŧ_]/9O8%.ofs t&kM oB;%qs`óbqg3b}j1bMUT-/pOE1D<w6F.s|%FY~ՓIdfF`SnS0,Wf>}f vm$9ib9uF%,gҹϻtn?*h>zuh3E+a,fֵNt3=)sxk4SaZ:@β=.IOTqYc׽,-{i{FL,d٫ncǜ` ROʆvtj [ٱlt}g?{{L>`}3}{}?Bg5ޓ_=`sg}N`%9]3_)o{*@/C|p*XuqB?Oda gW?XR)|Wz%3C0鳁7& h8)8*B, 'W3-42.8xí0w8(VV)7m~u)d+-4zZvq3I {lD~ylZkg }>{v*}.nT;o|I"b?˷Iyß6@v~CP_ 4u  fn8 mO8pv,T A54tQX]|h.a iC.I'Ba5ьRto4 ҍb1~\HOR2TOI)J_DT4.)Lu9ϒr6)= jKyԡmFR 6͔QR!7Uj2VZS6Uu`-+H8V>u<' פpfkOګ5š]z׎m[ZUSc*>v(Eft(ź8^k ̊hOY,;:im]Svū=x ނ-.f*-q;Yzcg_V^wY|w|-!^?mo>W|-x_J{]տc{n1p$׾\/ ,E$`8{XZ>f-8;nv.!{w]/ JaS[82@?7]Җ :&2#N(AI|9񕨍d,Y[e!*/h1f3t<}\,)g1Ίdq$Jɻ]$gb{9lzFwa.'y.di^:rtPe5 } SZ*&[džCm_Ts mLc9,T3[0Fv!_hYN:jIF{yfaj+ۡy%ma{;ݎ}DIbEY]vGܝ6W}ӣkr O>8LG I> A9MÛT#B\goWmǭaR9kLsZ+wp x^vng>~{-{3'eޤ~Bǀ}W)w}E-f'mf2pmh_uc)2lIn,@I ?"Phkt7ٍ蒓T5I9B=􎍒Bp`u'*՗Zi/'6wI~=!r:'rCI!ֶ ɕ?Є}4!:)ɉ؛ikLyf8lIɌu+ hLDhLٚɝ̈W'YSi7 fdWygb492i_≅g晌 *|H!c]Aɟ,Z`_yHAw.h񙞖TR/AzB1Y:%gPZxSA'=UFٙϨ[Zi_ \X'>鏗Q@qxs*DڧYژ8vnP 1JOzNlʧ٥d i{BoZ^©yڜwZJZãYJ ;xwrits-2.21/mono/fingerlm.gif 644 41346 41346 4420 6533415505 11441 GIF87a,,,,,ڋsؼaF扦V#L@s DS,*fnC~ΪHٮ|me\v=9?{G7H$W()"8yi$bɗxJZPhZzh ;)[+j;7 \*j|۹ ]}im5L] N<\N3ȶ~0_FnIO\6 >6ʠܥ[Q '+ӓymaF8ºdD|(.jJ &C֌$1LhٔIȇ;irafLElRsI$Ӧ.U 'é\%d+pCYeѵNZFt'-߾~ۦՊcƚ oA oJ± 1g(*ztR<Եjd7zw̰ywUӂ2SFtnwn:Ї[w ޿3MF7RH˻O0njW}wO!}lMtdا)-W2^%Ԗ!=@؅y8i$&!:'cCa `(8a-_ c2'~h^IS RH$<@b H'dGd\RRbazv& ֡7`!ny}Hڛ8d|i(rqiW=R(֕%jb4i _ꡧ9s X*j(j3TKjy+&JQ*KuAzk#bڒ@.]Mչ*/C[bXl;e+Sdf `Z7.lr qŴli˜[!C;0rѮ e5W!y-a= ej|ӊIKUwЦm8_P}͵[Gv1ivm,5j ܎+'1a-'nˠw7/KE]x,v"v~dӒWh枑ޒ=~ w/L>뷏Jw?ݏNyI[OUo><ヌS}y랲}z4m{wUL|307g/!J*w%NږAj#;xwrits-2.21/mono/spreadlm.gif 644 41346 41346 3736 6533415515 11457 GIF87a,,,,,ڋ޼H扦ʶ L ĢL*̦ JԪjܮ N ((Phh8(rX8iIAhxx9Y *Z9j9JJ{ 9k[뻉+kJk,G{|\L,Gml͉}} >7[^.N~ FN~~;O~0'j<|X C3 p"!J8fUB> q$BROI^*YMHm'ϔ?eW̥3ZQZtdSSdڒSWԊEdTS>fVR2ݷYcƕfڽ_V VWfYIw= (a(n+]\`ow!+`F0լE%ѬKO8lEk5NՒjvA]gs5įm0Zw+Mfu&鼨WvoL{}x-Wps1lT~5g!Qvyya))A}%Y}W&]tXKuKߋ+ &jΏ9$J"tRk>äS:9Da^^O]>i$ݗe9fl5 㢙jI:;$s)'2"c}9h1 Ff|hb"6僲9 qn ]Vf%fc!>jʼnٍŠjޚ(+‚#H,NkWk#B+jGrarZ\ԒKe^a asV)۾қ2A+]+<_ /lπ,xSrRM GWX[͵hdvjv "d۽}t wr=P}߄[t(t/nxJx^DN~?Ac0ǁ޸x韫znzh>춓&~;Z^B>($D('Qe[2ZU0=i A/>Fjl;Lx]s1T-^azǹ%.ҭ͈G(BދGIiAe<¦DXɚI?HQPӴs 9 MqH\Px0I ֮PRX\:NecJͫ9'Y".=h(vSi:4 %fUuP>z'MefĻ͵r&Zӊtו+ o9+CW襔z+f5Cօotj׾R_ZoC6M%0'e/ kx? x$.Ox,n_ x4ox< yD.$+yLn (Ky');xwrits-2.21/mono/clenchlm.gif 644 41346 41346 4275 6533415502 11430 GIF87a,,,,,c |Hxr7zfHgj Kǯ|5v yCqt4*IBM(jl [O=lhɽ'H(6gX؈H i9yYY) jJiYJw* 'KZz{aˋ۫; <[kwLl,<)rSJ#W2鲥L81adyΚ; 羞6Ehң uqԧLUz5+CS Vk®bF,HT46Ciꄋ-|O**0ČnTqƒ+ L2Ț;{9ѡKsҩYhmZfشevMڮyem37q'|;ѫ/~9ٱ;kx}u>9>OUooj_v h ? )`7!`iRXFUKyK"Hb#nߘb. Hc,$6P[#z9w>&V^0bRNcd_hIe^*#ieY 6~fVVYjfrN|9'pZgGFy@& '~V㡊JYhhNJfENVir㉏joH) kRi\D:kA&;lF'.k$Nl`-np&l(ꮫ,Dnd4x΋ob 02cdL p}܍OePqơ.pkoBr۱.d/ 3-ӌKޜs˳B/^C-#tEtVzJWo=Zs 'vb? js 1k=Mk SwJ~p#%8@xˍ _N9njc.kpӟ޹\ݣ秳~N>>2g;j Kzj>q~;ӈҝ݃ߋnKv=:G7yO3r>Ec2$\5H|"ؼRk_& F<&1s" ;BdDI81xU)2"M)0;J{f̥|J"y&b2ܘ[O<u?V'&|7HXhx'ؤ(9IYhd *:ѹ(GJc {2Y[v{k \l|l;ܡ -8Pt} M^+NLj^noHoǯ8e YVq ђ;vuf )fN"":@&taD'a2X()g2j%iybxe"q9'u~:*+QbI>ʩ!J#rq\ ښil j0%J7쨱z꩷浬ӖXm~9 vh>KhWⲾ6n3yžKR5Zob/n/Ƌo"h!z6! vBpS@C"uǂHDj[4ȶ2Y x4RoLZF9yCYGiIpiTVF@23Ƚ v=]i('t$5؁P_09Hzd&y{a%*ZnpR5'ɧJmk|Q/[ I* c\[ Kx9C-1%a SR,/y΅3dcd7)ҎR>Sܦ;%ȯS\$+d X9˄ʱw(I@2~ #@-@~ը!1J=\/hGM}$ӕC%%%B9xU2QOuLS!u5Uy9{bՐ?-_R3D)N2"LZj&*Ψ:+[?VH+zb!8G&NԴLWP6v$l?A 0^ǟl6N)M:>6!EON֢$bOQr"2kz7`4>&r"lכֈrܷVO.nzk5Vt@<]WԷ%lj pf[ZEn`̣$  `jX.l_w ,q~A x,Nl{ U*7hv>.2QlyG^14v(x_!3Xr\)zyp4L4̵AL?pU 7y/̰@SмU.vⷶW83Xghii%xɩEZ)jJQyjjX {ZF:x !{;ZjQ**X9Vj "iKZ<-η< .>nO_;