Build system overhaul and spring cleaning.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 23 Mar 2008 15:22:31 +0000 (15:22 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 23 Mar 2008 16:06:30 +0000 (16:06 +0000)
We'll clear out a load of old cruft:

  * mgLib is going to die, so remove all of the GTK-based tools.  We'll
    rewrite them in Python soon.  Leave the manpages, though.

  * The xwait and xtell tools are going to be combined together into a
    single program with subcommands, so we may as well delete them and
    their manpages.

Fix the email addresses in manpages.

The Debian part of the build system is also refurbished, and based on
CDBS.

21 files changed:
Makefile.am
configure.ac [moved from configure.in with 62% similarity]
debian/control
debian/rules
debian/xtoys.install [new file with mode: 0644]
xatom.c [deleted file]
xatom.h [deleted file]
xcatch.1
xcatch.c [deleted file]
xgetline.1
xgetline.c [deleted file]
xmsg.1
xmsg.c [deleted file]
xscsize.1
xshutdown.1 [deleted file]
xshutdown.c [deleted file]
xtell.1 [deleted file]
xtell.c [deleted file]
xwait.1 [deleted file]
xwait.c [deleted file]
xwait.h [deleted file]

index b724114..01885b1 100644 (file)
@@ -1,62 +1,58 @@
-## -*-makefile-*-
-##
-## $Id$
-##
-## Makefile for X tools
-##
-## (c) 1998 Straylight/Edgeware
-##
-
-##----- Licensing notice ----------------------------------------------------
-##
-## This file is part of the Edgeware X tools collection.
-##
-## X tools 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 of the License, or
-## (at your option) any later version.
-## 
-## X tools 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 X tools; if not, write to the Free Software Foundation,
-## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-AUTOMAKE_OPTIONS = foreign
-
-GTK_PROGS = \
-       xshutdown$(EXEEXT) xgetline$(EXEEXT) xcatch$(EXEEXT) xmsg$(EXEEXT)
-bin_PROGRAMS = xwait xtell xscsize @GTK_PROGS@
-EXTRA_PROGRAMS = xshutdown xgetline xcatch xmsg
-man_MANS = xwait.1 xtell.1 xshutdown.1 xscsize.1 xgetline.1 xcatch.1 xmsg.1
-EXTRA_DIST = \
-       $(man_MANS) \
-       debian/rules debian/copyright debian/control debian/changelog
-
-CLEANFILES = $(GTK_PROGS)
-
-xshutdown_SOURCES = xshutdown.c xwait.h xatom.c xatom.h
-xshutdown_LDADD = @MGLIB_LIBS@ @GTK_LIBS@
-
-xcatch_SOURCES = xcatch.c
-xcatch_LDADD = @MGLIB_LIBS@ @GTK_LIBS@
-
-xgetline_SOURCES = xgetline.c
-xgetline_LDADD = @MGLIB_LIBS@ @GTK_LIBS@
-
-xwait_SOURCES = xwait.c xwait.h xatom.c xatom.h
-xwait_LDADD = @X_LIBS@ -lX11
-
-xtell_SOURCES = xtell.c xwait.h xatom.c xatom.h
-xtell_LDADD = @X_LIBS@ -lX11
-
-xmsg_SOURCES = xmsg.c
-xmsg_LDADD = @MGLIB_LIBS@ @GTK_LIBS@
-
-xscsize_SOURCES = xscsize.c
-xscsize_LDADD = @X_LIBS@ -lX11
-
-##----- That's all, folks ---------------------------------------------------
+### -*-makefile-*-
+###
+### Makefile for X tools
+###
+### (c) 1998 Straylight/Edgeware
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the Edgeware X tools collection.
+###
+### X tools 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 of the License, or
+### (at your option) any later version.
+### 
+### X tools 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 X tools; if not, write to the Free Software Foundation,
+### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+bin_PROGRAMS            =
+bin_SCRIPTS             =
+dist_man_MANS           =
+EXTRA_DIST              =
+CLEANFILES              =
+
+###--------------------------------------------------------------------------
+### Distribution arrangements.
+
+dist-hook::
+       echo $(VERSION) >$(distdir)/RELEASE
+
+###--------------------------------------------------------------------------
+### Simple tools in C.
+
+AM_CFLAGS               = $(X_CFLAGS)
+LDADD                   = -lX11 $(X_LIBS)
+
+## xscsize
+bin_PROGRAMS           += xscsize
+dist_man_MANS          += xscsize.1
+
+###--------------------------------------------------------------------------
+### Debian.
+
+EXTRA_DIST             += debian/rules
+EXTRA_DIST             += debian/control
+EXTRA_DIST             += debian/copyright
+EXTRA_DIST             += debian/changelog
+
+EXTRA_DIST             += debian/xtoys.install
+
+###----- That's all, folks --------------------------------------------------
similarity index 62%
rename from configure.in
rename to configure.ac
index b1a381e..8e580c9 100644 (file)
@@ -1,6 +1,4 @@
-dnl -*-m4-*-
-dnl
-dnl $Id: configure.in,v 1.16 2004/04/08 01:36:29 mdw Exp $
+dnl -*-autoconf-*-
 dnl
 dnl Configuration script for X tools
 dnl
@@ -25,25 +23,31 @@ dnl You should have received a copy of the GNU General Public License
 dnl along with X tools; if not, write to the Free Software Foundation,
 dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-AC_INIT(xwait.c)
-AM_INIT_AUTOMAKE(xtoys, 1.3.0)
-AC_PROG_CC
-mdw_GCC_FLAGS
+dnl--------------------------------------------------------------------------
+dnl Initialization.
 
-mdw_MLIB(1.6.0)
-mdw_MGLIB(1.1.0, mgLib=yes, mgLib=no)
+mdw_AUTO_VERSION
+AC_INIT([xtoys], AUTO_VERSION, [mdw@distorted.org.uk])
+AC_CONFIG_SRCDIR([xscsize.c])
+AC_CONFIG_AUX_DIR([config])
+AM_INIT_AUTOMAKE([foreign])
 
-if test $mgLib = yes; then
-  AM_PATH_GTK(1.0.0,
-    [CFLAGS="$CFLAGS $MGLIB_CFLAGS $GTK_CFLAGS"
-    GTK_PROGS='$(GTK_PROGS)'],
-    [AC_MSG_ERROR([GTK not found or too old.])])
-fi
+dnl--------------------------------------------------------------------------
+dnl C programming environment.
 
-AC_SUBST(GTK_PROGS)
+AC_PROG_CC
+AX_CFLAGS_WARN_ALL
 AC_PATH_XTRA
-CFLAGS="$CFLAGS $X_CFLAGS"
 
-AC_OUTPUT(Makefile)
+PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4])
+CFLAGS="$CFLAGS $mLib_CFLAGS"
+LIBS="$LIBS $mLib_LIBS"
+
+dnl--------------------------------------------------------------------------
+dnl Output.
+
+AC_CONFIG_FILES(
+  [Makefile])
+AC_OUTPUT
 
 dnl ----- That's all, folks -------------------------------------------------
index 646cfd0..5a1c73f 100644 (file)
@@ -1,8 +1,7 @@
 Source: xtoys
 Section: x11
 Priority: extra
-Build-Depends: mlib-dev (>= 2.0.0), mglib-dev (>= 1.1.0),
- debhelper (>= 4.0.2)
+Build-Depends: libx11-dev, mlib-dev (>= 2.0.4), debhelper (>= 5)
 Maintainer: Mark Wooding <mdw@distorted.org.uk>
 Standards-Version: 3.1.1
 
@@ -12,22 +11,3 @@ Depends: ${shlibs:Depends}
 Description: A collection of small X11 tools
  We have:
  xscsize -- reports the display size as shell variables
- xtell -- sets a root window property to a given string
- xwait -- waits until a root window property gets one of a set of strings,
-   which is useful in .xinitrc files if you use a flaky window manager
-
-Package: xtoys-gtk
-Architecture: any
-Depends: ${shlibs:Depends}
-Recommends: xtoys
-Description: A collection of small X11 tools
- We have:
- xcatch -- run a program, displaying its output in a scrolling window if
-   there is any
- xgetline -- pops up a dialogue, reads a line of text, and reports the 
-   entered line on stdout; can do passwords, history with optional size
-   limit, or simple selection from a list
- xmsg -- pop up a dialogue showing a message and a bunch of buttons, and
-   gets a response
- xshutdown -- pops up a dialogue, and if confirmed, sets a root window
-   property to a given string
index cde85dc..1ee41f9 100755 (executable)
@@ -1,52 +1,8 @@
 #! /usr/bin/make -f
 
-export DH_COMPAT = 4
+CDBS = /usr/share/cdbs/1
+include $(CDBS)/rules/debhelper.mk
+include $(CDBS)/class/autotools.mk
 
-build:
-       rm -rf deb-build build; mkdir deb-build
-       cd deb-build; ../configure --prefix=/usr --mandir=/usr/share/man
-       make -C deb-build
-       touch build
-
-clean:
-       dh_clean
-       rm -rf deb-build build
-
-install: build
-       dh_clean
-       for i in xscsize xwait xtell; do \
-               dh_install -p xtoys deb-build/$$i usr/bin; \
-               dh_installman -p xtoys $$i.1; \
-       done
-       for i in xcatch xgetline xmsg xshutdown; do \
-               dh_install -p xtoys-gtk deb-build/$$i usr/bin; \
-               dh_installman -p xtoys-gtk $$i.1; \
-       done
-       dh_strip -a
-
-binary-indep:
-
-binary-arch: install
-       dh_testdir -a
-       dh_testroot -a
-       dh_compress -a
-       dh_installdocs -a
-       dh_strip -a
-       dh_shlibdeps -a
-       dh_gencontrol -a
-       dh_fixperms -a
-       dh_installdeb -a
-       dh_md5sums -a
-       dh_builddeb -a
-
-binary: binary-indep binary-arch
-
-source:
-       rm -rf deb-build/*.tar.gz deb-build/=deb=
-       make -C deb-build dist
-       mkdir deb-build/=deb=
-       cd deb-build/=deb=; tar xvfz ../*.tar.gz
-       d=`pwd`; cd ..; dpkg-source -i -b $$d/deb-build/=deb=/*
-       rm -rf deb-build/=deb=
-
-.PHONY: binary binary-arch binary-indep clean install source 
+DEB_BUILDDIR = $(CURDIR)/build
+DEB_DESTDIR = $(CURDIR)/debian/tmp
diff --git a/debian/xtoys.install b/debian/xtoys.install
new file mode 100644 (file)
index 0000000..8c49cf3
--- /dev/null
@@ -0,0 +1,2 @@
+debian/tmp/usr/bin/xscsize
+debian/tmp/usr/share/man/man1/xscsize.1
diff --git a/xatom.c b/xatom.c
deleted file mode 100644 (file)
index b5cdaa9..0000000
--- a/xatom.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*-c-*-
- *
- * $Id: xatom.c,v 1.2 2004/04/08 01:36:29 mdw Exp $
- *
- * Set and fetch X atom properties
- *
- * (c) 1999 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of the Edgeware X tools collection.
- *
- * X tools 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 of the License, or
- * (at your option) any later version.
- * 
- * X tools 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 X tools; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/*----- Header files ------------------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-/*----- Main code ---------------------------------------------------------*/
-
-/* --- @xatom_set@ --- *
- *
- * Arguments:  @Display *d@ = pointer to display
- *             @Window w@ = window to set
- *             @Atom p@ = property to set
- *             @Atom a@ = atom property value
- *
- * Returns:    ---
- *
- * Use:                Sets an atom property on a particular window.
- */
-
-void xatom_set(Display *d, Window w, Atom p, Atom a)
-{
-  XChangeProperty(d, w, p, XA_ATOM, 32, PropModeReplace,
-                 (unsigned char *)&a, 1);
-}
-
-/* --- @xatom_get@ --- *
- *
- * Arguments:  @Display *d@ = pointer to display
- *             @Window w@ = window to set
- *             @Atom p@ = property to read
- *
- * Returns:    Atom which is the value of the property.
- *
- * Use:                Reads an atom property from a particular window.  The value
- *             @None@ is returned if there is no atom value.
- */
-
-Atom xatom_get(Display *d, Window w, Atom p)
-{
-  Atom type, v;
-  unsigned long n, left;
-  int fmt;
-  unsigned char *buf;
-
-  /* --- Fetch the property value --- */
-
-  if (XGetWindowProperty(d, w, p,      /* Display, window, property */
-                        0, 64,         /* Offset, length (both in words) */
-                        False,         /* Delete after return? */
-                        XA_ATOM,       /* Data format type */
-                        &type, &fmt,   /* Actual type and format */
-                        &n, &left,     /* Amount read, and bytes left */
-                        &buf)          /* Where to put the buffer */
-        != Success ||
-      type != XA_ATOM ||
-      n < 1 || fmt < 32)
-    return (None);
-
-  /* --- OK, get the atom and return --- *
-   *
-   * This assumes that atoms are 32-bit things.  This may not be the case.
-   * That's a right pain, actually.  It looks as if Xlib is trying to do the
-   * right thing, so I'll go with that rather than trying to do anything
-   * clever.  This is actually a bit of a poor interface.
-   */
-
-  v = *(Atom *)buf;
-  XFree(buf);
-  return (v);
-}
-
-/*----- That's all, folks -------------------------------------------------*/
diff --git a/xatom.h b/xatom.h
deleted file mode 100644 (file)
index daf631d..0000000
--- a/xatom.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*-c-*-
- *
- * $Id: xatom.h,v 1.2 2004/04/08 01:36:29 mdw Exp $
- *
- * Set and fetch X atom properties
- *
- * (c) 1999 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of the Edgeware X tools collection.
- *
- * X tools 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 of the License, or
- * (at your option) any later version.
- * 
- * X tools 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 X tools; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef XATOM_H
-#define XATOM_H
-
-#ifdef __cplusplus
-  extern "C" {
-#endif
-
-/*----- Header files ------------------------------------------------------*/
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-/*----- Functions provided ------------------------------------------------*/
-
-/* --- @xatom_set@ --- *
- *
- * Arguments:  @Display *d@ = pointer to display
- *             @Window w@ = window to set
- *             @Atom p@ = property to set
- *             @Atom a@ = atom property value
- *
- * Returns:    ---
- *
- * Use:                Sets an atom property on a particular window.
- */
-
-extern void xatom_set(Display */*d*/, Window /*w*/, Atom /*p*/, Atom /*a*/);
-
-/* --- @xatom_get@ --- *
- *
- * Arguments:  @Display *d@ = pointer to display
- *             @Window w@ = window to set
- *             @Atom p@ = property to read
- *
- * Returns:    Atom which is the value of the property.
- *
- * Use:                Reads an atom property from a particular window.  The value
- *             @None@ is returned if there is no atom value.
- */
-
-extern Atom xatom_get(Display */*d*/, Window /*w*/, Atom /*p*/);
-
-/*----- That's all, folks -------------------------------------------------*/
-
-#ifdef __cplusplus
-  }
-#endif
-
-#endif
index 119b71a..34bb62b 100644 (file)
--- a/xcatch.1
+++ b/xcatch.1
@@ -41,7 +41,7 @@ instead of standard output.
 Display output text in 
 .I font
 rather than GTK's default (Helvetica).
-.SH AUTHOR
-Mark Wooding (mdw@nsict.org).
 .SH BUGS
 None currently known.
+.SH AUTHOR
+Mark Wooding (mdw@distorted.org.uk).
diff --git a/xcatch.c b/xcatch.c
deleted file mode 100644 (file)
index 6ddb4ea..0000000
--- a/xcatch.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* -*-c-*-
- *
- * $Id: xcatch.c,v 1.10 2004/04/08 01:36:29 mdw Exp $
- *
- * Catch input and trap it in an X window
- *
- * (c) 1998 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of the Edgeware X tools collection.
- *
- * X tools 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 of the License, or
- * (at your option) any later version.
- * 
- * X tools 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 X tools; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/*----- Header files ------------------------------------------------------*/
-
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <gtk/gtk.h>
-
-#include <mLib/dstr.h>
-#include <mLib/mdwopt.h>
-#include <mLib/report.h>
-#include <mLib/quis.h>
-
-#include <mgLib/cancel.h>
-#include <mgLib/msg.h>
-
-/*----- Inportant state ---------------------------------------------------*/
-
-static unsigned int flags;
-
-#define f_closed 1u
-#define f_bogus 2u
-
-static GtkWidget *textbox = 0;
-static GdkFont *font;
-
-static pid_t kid = -1;
-static int status;
-
-/*----- Main code ---------------------------------------------------------*/
-
-/* --- The window's closed --- */
-
-static void killwin(GtkWidget *w, gpointer p)
-{
-  if (flags & f_closed)
-    gtk_main_quit();
-  else
-    textbox = 0;
-}
-
-/* --- Some input has arrived --- */
-
-static void ready(gpointer data, gint fd, GdkInputCondition c)
-{
-  char buf[1024];
-  int doscroll = 1;
-  GtkText *t = 0;
-  GtkAdjustment *va = 0;
-
-  /* --- If not ready to read then go away --- */
-
-  if (!(c & GDK_INPUT_READ))
-    return;
-
-  /* --- Decide whether to scroll the window --- */
-
-  if (textbox) {
-    t = GTK_TEXT(textbox);
-    va = t->vadj;
-    if (va->value + va->page_size < va->upper)
-      doscroll = 0;
-    gtk_text_freeze(t);
-  }
-
-  /* --- Read data into the buffer --- *
-   *
-   * This is a bit of a mess.
-   */
-
-  for (;;) {
-    int r = read(fd, buf, sizeof(buf));
-
-    /* --- The read failed --- *
-     *
-     * Maybe there's no more data to read.  In this case, we get
-     * @EWOULDBLOCK@, indicating it's time to stop and do something else.
-     * Otherwise something serious has happened.
-     */
-
-    if (r < 0) {
-      if (errno == EWOULDBLOCK)
-       break;
-      msg(QUIS, ":~OK", "error reading data: %s", strerror(errno));
-      exit(EXIT_FAILURE);
-    }
-
-    /* --- End of file --- *
-     *
-     * If the box is closed, then exit quiety; otherwise wait for it to
-     * go away.
-     */
-
-    if (r == 0) {
-      close(fd);
-      if (textbox)
-       flags |= f_closed;
-      else
-       gtk_main_quit();
-      break;
-    }
-
-    /* --- If there's no output window, create one --- */
-
-    if (!textbox) {
-      GtkWidget *win;
-      GtkWidget *tbl;
-      GtkWidget *w;
-
-      win = gtk_dialog_new();
-      gtk_window_set_policy(GTK_WINDOW(win), 1, 1, 0);
-      gtk_signal_connect(GTK_OBJECT(win), "destroy",
-                        GTK_SIGNAL_FUNC(killwin), 0);
-
-      tbl = gtk_table_new(2, 2, 0);
-      gtk_container_border_width(GTK_CONTAINER(tbl), 8);
-      gtk_box_pack_start(GTK_BOX(GTK_DIALOG(win)->vbox), tbl, 1, 1, 1);
-      gtk_widget_show(tbl);
-
-      textbox = gtk_text_new(0, 0);
-      t = GTK_TEXT(textbox);
-      va = t->vadj;
-      gtk_table_attach(GTK_TABLE(tbl), textbox, 0, 1, 0, 1,
-                      GTK_EXPAND | GTK_SHRINK | GTK_FILL,
-                      GTK_EXPAND | GTK_SHRINK | GTK_FILL,
-                      0, 0);
-      gtk_text_set_editable(t, 0);
-      gtk_widget_set_usize(textbox, 500, 300);
-      gtk_text_freeze(t);
-      gtk_widget_show(textbox);
-
-      w = gtk_vscrollbar_new(va);
-      gtk_table_attach(GTK_TABLE(tbl), w, 1, 2, 0, 1,
-                      0, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
-      gtk_widget_show(w);
-
-      w = gtk_hscrollbar_new(t->hadj);
-      gtk_table_attach(GTK_TABLE(tbl), w, 0, 1, 1, 2,
-                      GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0, 0);
-      gtk_widget_show(w);
-
-      gtk_box_set_homogeneous(GTK_BOX(GTK_DIALOG(win)->action_area), 0);
-      w = gtk_button_new_with_label("Dismiss");
-      gtk_signal_connect_object(GTK_OBJECT(w), "clicked",
-                               GTK_SIGNAL_FUNC(gtk_object_destroy),
-                               GTK_OBJECT(win));
-      gtk_box_pack_end(GTK_BOX(GTK_DIALOG(win)->action_area), w, 0, 0, 0);
-      GTK_WIDGET_SET_FLAGS(w, GTK_CAN_DEFAULT);
-      gtk_widget_grab_default(w);
-      cancel(GTK_WINDOW(win), w);
-      gtk_widget_show(w);
-
-      gtk_widget_show(win);
-    }
-
-    gtk_text_insert(t, font, 0, 0, buf, r);
-  }
-
-  if (textbox) {
-    gtk_text_thaw(t);
-    if (doscroll)
-      gtk_adjustment_set_value(va, va->upper - va->page_size);
-  }
-}
-
-/* --- Signal handler --- */
-
-static void reap(int sig)
-{
-  pid_t k;
-  int s;
-  int e = errno;
-
-  for (;;) {
-    k = waitpid(-1, &s, WNOHANG);
-    if (k <= 0)
-      break;
-    if (k == kid) {
-      if (WIFEXITED(s))
-       status = WEXITSTATUS(s);
-      else
-       status = 127;
-    }
-  }
-  errno = e;
-}
-
-/* --- Main program --- */
-
-static void version(FILE *fp)
-{
-  fprintf(fp, "%s (xtoys version " VERSION ")\n", QUIS);
-}
-
-static void usage(FILE *fp)
-{
-  fprintf(fp, "Usage: %s [-f file] [-F font] [command [args...]]\n", QUIS);
-}
-
-int main(int argc, char *argv[])
-{
-  int fd = -1;
-
-  ego(argv[0]);
-
-  gtk_init(&argc, &argv);
-
-  for (;;) {
-    static struct option opt[] = {
-      { "help",                0,              0,      'h' },
-      { "usage",       0,              0,      'u' },
-      { "version",     0,              0,      'v' },
-      { "file",                OPTF_ARGREQ,    0,      'f' },
-      { "font",                OPTF_ARGREQ,    0,      'F' },
-      { 0,             0,              0,      0 }
-    };
-    int i = mdwopt(argc, argv, "+huvf:F:", opt, 0, 0, 0);
-
-    if (i < 0)
-      break;
-
-    switch (i) {
-      case 'h':
-       version(stdout);
-       fputc('\n', stdout);
-       usage(stdout);
-       fputs(
-"\n"
-"Catches input from a pipe or other source, and captures it in a window.\n"
-"Nothing is displayed if there's no input.\n"
-"\n"
-"Options provided:\n"
-"\n"
-"-h, --help            Display this help text\n"
-"-u, --usage           Display a quick usage summary\n"
-"-v, --version         Display the version number\n"
-"-f, --file=FILE\t     Read input from the named file\n"
-"-F, --font=FONT\t     Display output in the named font\n",
-          stdout);
-       exit(0);
-       break;
-      case 'u':
-       usage(stdout);
-       exit(0);
-       break;
-      case 'v':
-       version(stdout);
-       exit(0);
-       break;
-      case 'f':
-       if ((fd = open(optarg, O_RDONLY)) < 0) {
-         die(1, "couldn't open file: %s", strerror(errno));
-         exit(1);
-       }
-       break;
-      case 'F':
-       font = gdk_font_load(optarg);
-       break;
-      default:
-       flags |= f_bogus;
-       break;
-    }
-  }
-
-  if (flags & f_bogus) {
-    usage(stderr);
-    exit(1);
-  }
-
-  if (fd == -1) {
-    if (optind == argc)
-      fd = STDIN_FILENO;
-    else {
-      int pfd[2];
-      struct sigaction sa;
-      sigset_t newmask, oldmask;
-
-      /* --- Set up a signal handler --- */
-
-      sa.sa_handler = reap;
-      sigemptyset(&sa.sa_mask);
-      sa.sa_flags = SA_NOCLDSTOP;
-#ifdef SA_RESTART
-      sa.sa_flags |= SA_RESTART;
-#endif
-      sigaction(SIGCHLD, &sa, 0);
-
-      /* --- Start a child program --- */
-
-      if (pipe(pfd))
-       die(1, "couldn't open pipe: %s", strerror(errno));
-
-      sigemptyset(&newmask);
-      sigaddset(&newmask, SIGCHLD);
-      sigprocmask(SIG_BLOCK, &newmask, &oldmask);
-
-      kid = fork();
-      if (kid < 0)
-       die(1, "couldn't fork: %s", strerror(errno));
-      if (kid == 0) {
-       dstr d = DSTR_INIT;
-
-       close(pfd[0]);
-       if (pfd[1] != STDOUT_FILENO)
-         dup2(pfd[1], STDOUT_FILENO);
-       if (pfd[1] != STDERR_FILENO)
-         dup2(pfd[1], STDERR_FILENO);
-       if (pfd[1] != STDOUT_FILENO && pfd[1] != STDERR_FILENO)
-         close(pfd[1]);
-       execvp(argv[optind], argv + optind);
-
-       dstr_putf(&d, "%s: couldn't run `%s': %s\n",
-                 QUIS, argv[optind], strerror(errno));
-       write(STDERR_FILENO, d.buf, d.len);
-       dstr_destroy(&d);
-       _exit(127);
-      }
-
-      sigprocmask(SIG_SETMASK, &oldmask, 0);
-      fd = pfd[0];
-      close(pfd[1]);
-    }
-  }
-
-  {
-    int f = fcntl(fd, F_GETFL);
-    fcntl(fd, F_SETFL, f | O_NONBLOCK);
-  }
-
-  gdk_input_add(fd, GDK_INPUT_READ, ready, 0);
-  gtk_main();
-  return (status);
-}
-
-/*----- That's all, folks -------------------------------------------------*/
index 74fa827..caec17c 100644 (file)
@@ -99,7 +99,7 @@ When writing an updated history file, do not write more than
 .I max
 lines.  The default is 20; a value of 0 disables a length limit on the
 history file.
-.SH AUTHOR
-Mark Wooding (mdw@nsict.org).
 .SH BUGS
 Hopefully none.
+.SH AUTHOR
+Mark Wooding (mdw@distorted.org.uk).
diff --git a/xgetline.c b/xgetline.c
deleted file mode 100644 (file)
index 9c02fa9..0000000
+++ /dev/null
@@ -1,438 +0,0 @@
-/* -*-c-*-
- *
- * $Id: xgetline.c,v 1.13 2004/04/08 01:36:29 mdw Exp $
- *
- * Fetch a line of text from the user
- *
- * (c) 1998 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of the Edgeware X tools collection.
- *
- * X tools 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 of the License, or
- * (at your option) any later version.
- * 
- * X tools 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 X tools; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/*----- Header files ------------------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-
-#include <mLib/alloc.h>
-#include <mLib/dstr.h>
-#include <mLib/mdwopt.h>
-#include <mLib/report.h>
-#include <mLib/quis.h>
-
-#include <mgLib/cancel.h>
-#include <mgLib/mdwfocus.h>
-
-/*----- Main code ---------------------------------------------------------*/
-
-/* --- @quit@ --- *
- *
- * Arguments:  @GtkWidget *w@ = widget raising the signal
- *             @gpointer *p@ = pointer to integer result code
- *
- * Returns:    ---
- *
- * Use:                Sets the result code to zero (failure) and ends the loop.
- */
-
-static void quit(GtkWidget *w, gpointer *p)
-{
-  int *ip = (int *)p;
-  *ip = 0;
-  gtk_main_quit();
-}
-
-/* --- @done@ --- *
- *
- * Arguments:  @GtkWidget *w@ = widget raising the signal
- *             @gpointer *p@ = pointer to integer result code
- *
- * Returns:    ---
- *
- * Use:                Sets the result code nonzero (success) and ends the loop.
- */
-
-static void done(GtkWidget *w, gpointer *p)
-{
-  int *ip = (int *)p;
-  *ip = 1;
-  gtk_main_quit();
-}
-
-/* --- @version@ --- *
- *
- * Arguments:  @FILE *fp@ = output stream to print the message on
- *
- * Returns:    ---
- *
- * Use:                Spits out a version message.
- */
-
-static void version(FILE *fp)
-{
-  fprintf(fp, "%s (xtoys version " VERSION ")\n", QUIS);
-}
-
-/* --- @usage@ --- *
- *
- * Arguments:  @FILE *fp@ = output stream to print the message on
- *
- * Returns:    ---
- *
- * Use:                Spits out a usage message.
- */
-
-static void usage(FILE *fp)
-{
-  fprintf(fp,
-         "Usage: %s [-in] [-t title] [-p prompt] [-d default]\n"
-         "\t[-l|-H file] [-m max]\n",
-         QUIS);
-}
-
-/* --- @main@ --- *
- *
- * Arguments:  @int argc@ = number of command line arguments
- *             @char *argv[]@ = addresses of arguments
- *
- * Returns:    Zero if OK, and we read a string; nonzero if the user
- *             cancelled.
- *
- * Use:                Reads a string from the user, and returns it on standard
- *             output.
- */
-
-int main(int argc, char *argv[])
-{
-  /* --- Configuration variables --- */
-
-  char *prompt = 0;
-  char *dfl = "";
-  char *title = "Input request";
-  int left;
-  unsigned f = 0;
-  int ok = 0;
-
-  const char *list = 0;
-  int histmax = 20;
-  GList *hist = 0;
-
-#define f_invis 1u
-#define f_duff 2u
-#define f_history 4u
-#define f_nochoice 8u
-
-  /* --- User interface bits --- */
-
-  GtkWidget *win;
-  GtkWidget *box;
-  GtkWidget *entry;
-  GtkWidget *btn;
-
-  /* --- Crank up the toolkit --- *
-   *
-   * Have to do this here: GTK snarfs some command line options which my
-   * parser would barf about.
-   */   
-
-  ego(argv[0]);
-  gtk_init(&argc, &argv);
-
-  /* --- Parse options from command line --- */
-
-  for (;;) {
-
-    /* --- Long options structure --- */
-
-    static struct option opt[] = {
-      { "help",                0,              0,      'h' },
-      { "usage",       0,              0,      'u' },
-      { "version",     0,              0,      'v' },
-      { "title",       OPTF_ARGREQ,    0,      't' },
-      { "prompt",      OPTF_ARGREQ,    0,      'p' },
-      { "default",     OPTF_ARGREQ,    0,      'd' },
-      { "password",    0,              0,      'i' },
-      { "invisible",   0,              0,      'i' },
-      { "history",     OPTF_ARGREQ,    0,      'H' },
-      { "list",                OPTF_ARGREQ,    0,      'l' },
-      { "histmax",     OPTF_ARGREQ,    0,      'm' },
-      { "no-choice",   0,              0,      'n' },
-      { 0,             0,              0,      0 }
-    };
-    int i;
-
-    /* --- Fetch an option --- */
-
-    i = getopt_long(argc, argv, "huv t:p:d:i H:l:m:n", opt, 0);
-    if (i < 0)
-      break;
-
-    /* --- Work out what to do with it --- */
-
-    switch (i) {
-      case 'h':
-       version(stdout);
-       fputs("\n", stdout);
-       usage(stdout);
-       fputs("\
-\n\
-Pops up a small window requesting input from a user, and echoes the\n\
-response to stdout, where it can be collected by a shell script.\n\
-\n\
-Options available are:\n\
-\n\
--h, --help             Display this help text\n\
--u, --usage            Display a short usage summary\n\
--v, --version          Display the program's version number\n\
-\n\
--i, --invisible                Don't show the user's string as it's typed\n\
--t, --title=TITLE      Set the window's title string\n\
--p, --prompt=PROMPT    Set the window's prompt string\n\
--d, --default=DEFAULT  Set the default string already in the window\n\
-\n\
--l, --list=FILE                Read FILE into a drop-down list\n\
--n, --no-choice                No free text input: must choose item from list\n\
--H, --history=FILE     As for `--list', but update with new string\n\
--m, --histmax=MAX      Maximum number of items written back to file\n",
-          stdout);
-       exit(0);
-       break;
-      case 'u':
-       usage(stdout);
-       exit(0);
-       break;
-      case 'v':
-       version(stdout);
-       exit(0);
-       break;
-
-      case 't':
-       title = optarg;
-       break;
-      case 'p':
-       prompt = optarg;
-       break;
-      case 'd':
-       dfl = optarg;
-       break;
-      case 'i':
-       f |= f_invis;
-       break;
-
-      case 'l':
-       list = optarg;
-       break;
-      case 'n':
-       f |= f_nochoice;
-       break;
-      case 'H':
-       f |= f_history;
-       list = optarg;
-       break;
-      case 'm':
-       histmax = atoi(optarg);
-       break;
-
-      default:
-       f |= f_duff;
-       break;
-    }
-  }
-
-  if (f & f_duff) {
-    usage(stderr);
-    exit(EXIT_FAILURE);
-  }
-
-  if ((f & f_invis) && list) {
-    die(EXIT_FAILURE,
-       "invisible entry is dumb if you provide a list of alternatives!");
-  }
-
-  if ((f & f_nochoice) && !list)
-    die(EXIT_FAILURE, "nothing to restrict choice to!");
-
-  /* --- Create the main window --- */
-
-  win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_title(GTK_WINDOW(win), title);
-  gtk_window_position(GTK_WINDOW(win), GTK_WIN_POS_MOUSE);
-  gtk_signal_connect(GTK_OBJECT(win), "destroy",
-                    GTK_SIGNAL_FUNC(quit), &ok);
-
-  /* --- Create the box for laying out the widgets inside --- */
-
-  left = (prompt ? 1 : 0);
-  box = gtk_table_new(left + 2, 1, 0);
-
-  /* --- Maybe create a prompt widget --- */
-
-  if (prompt) {
-    GtkWidget *w = gtk_label_new(prompt);
-    gtk_table_attach(GTK_TABLE(box), w,
-                    0, 1, 0, 1, 0, GTK_EXPAND, 4, 2);
-    gtk_widget_show(w);
-  }
-
-  /* --- Create the entry widget --- */
-
-  if (list) {
-    FILE *fp = fopen(list, "r");
-    GtkWidget *combo;
-
-    /* --- Read the items in from the file --- *
-     *
-     * Inability to open the file is not a disaster.
-     */
-
-    if (fp) {
-      dstr d = DSTR_INIT;
-
-      while (dstr_putline(&d, fp) != EOF) {
-       hist = g_list_append(hist, xstrdup(d.buf));
-       DRESET(&d);
-      }
-      dstr_destroy(&d);
-      fclose(fp);
-    }
-
-    /* --- Now create a combo box --- */
-
-    combo = gtk_combo_new();
-    entry = GTK_COMBO(combo)->entry;
-    if (hist)
-      gtk_combo_set_popdown_strings(GTK_COMBO(combo), hist);
-
-    /* --- Do other configuring --- */
-
-    if (f & f_nochoice) {
-      gtk_combo_set_value_in_list(GTK_COMBO(combo), 1, 0);
-      gtk_entry_set_editable(GTK_ENTRY(entry), 0);
-    }
-    gtk_combo_set_case_sensitive(GTK_COMBO(combo), 1);
-    gtk_combo_set_use_arrows_always(GTK_COMBO(combo), 1);
-    gtk_combo_disable_activate(GTK_COMBO(combo));
-    if (strcmp(dfl, "@") == 0)
-      gtk_entry_set_text(GTK_ENTRY(entry), hist ? (char *)hist->data : "");
-    else
-      gtk_entry_set_text(GTK_ENTRY(entry), dfl);
-
-    /* --- Set the widget in the right place and show it --- */
-
-    gtk_table_attach(GTK_TABLE(box), combo,
-                    left, left + 1, 0, 1,
-                    GTK_EXPAND | GTK_FILL, GTK_EXPAND, 4, 2);
-    gtk_widget_show(combo);
-  } else {
-    entry = gtk_entry_new();
-    gtk_entry_set_text(GTK_ENTRY(entry), dfl);
-    if (f & f_invis)
-      gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
-    gtk_table_attach(GTK_TABLE(box), entry,
-                    left, left + 1, 0, 1,
-                    GTK_EXPAND | GTK_FILL, GTK_EXPAND, 4, 2);
-    gtk_widget_show(entry);
-  }
-
-  /* --- Create the default action widget --- */
-
-  btn = gtk_button_new_with_label("OK");
-  gtk_table_attach(GTK_TABLE(box), btn,
-                  left + 1, left + 2, 0, 1, 0, GTK_EXPAND, 2, 2);
-  GTK_WIDGET_SET_FLAGS(btn, GTK_CAN_DEFAULT);
-  gtk_widget_show(btn);
-
-  /* --- Add the box into the main window --- */
-
-  gtk_container_add(GTK_CONTAINER(win), box);
-  gtk_widget_show(box);
-
-  /* --- Last minute configuration things --- */
-
-  gtk_widget_grab_default(btn);
-  gtk_signal_connect(GTK_OBJECT(btn), "clicked",
-                    GTK_SIGNAL_FUNC(done), &ok);
-  gtk_signal_connect_object(GTK_OBJECT(entry), "activate",
-                           GTK_SIGNAL_FUNC(gtk_widget_activate),
-                           GTK_OBJECT(btn));
-  cancel(GTK_WINDOW(win), 0);
-
-  /* --- Go go go --- */
-
-  gtk_widget_realize(win);
-  mdwfocus(win);
-  gtk_widget_grab_focus(entry);
-  gtk_widget_show(win);
-  gtk_main();
-
-  /* --- Output the result --- */
-
-  if (ok) {
-    char *p = gtk_entry_get_text(GTK_ENTRY(entry));
-
-    /* --- If history is enabled, output a new history file --- *
-     *
-     * If the first entry was accepted verbatim, or if the entry is a blank
-     * line, don't bother.
-     */
-
-    if (f & f_history && *p && !(hist && strcmp(p, hist->data) == 0)) {
-      int fd;
-      FILE *fp;
-      int i;
-      GList *g;
-
-      if ((fd = open(list, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0)
-       goto fail;
-      if ((fp = fdopen(fd, "w")) == 0) {
-       close(fd);
-       goto fail;
-      }
-
-      fputs(p, fp);
-      fputc('\n', fp);
-
-      for (i = 1, g = hist; (histmax < 1 || i < histmax) && g; g = g->next) {
-       if (*(char *)g->data && strcmp(g->data, p) != 0) {
-         fputs(g->data, fp);
-         fputc('\n', fp);
-         i++;
-       }
-      }
-      fclose(fp);
-    fail:;
-    }
-
-    /* --- Print the result and go away --- */
-      
-    puts(p);
-  }
-
-  return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
-}
-
-/*----- That's all, folks -------------------------------------------------*/
diff --git a/xmsg.1 b/xmsg.1
index 32bf249..9ca1386 100644 (file)
--- a/xmsg.1
+++ b/xmsg.1
@@ -88,7 +88,7 @@ as being the cancel button.
 Selects the given
 .I button
 as being the default button.
-.SH AUTHOR
-Mark Wooding (mdw@nsict.org).
 .SH BUGS
 None currently known.
+.SH AUTHOR
+Mark Wooding (mdw@distorted.org.uk).
diff --git a/xmsg.c b/xmsg.c
deleted file mode 100644 (file)
index edce12a..0000000
--- a/xmsg.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* -*-c-*-
- *
- * $Id$
- *
- * Display a message to the user
- *
- * (c) 2001 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of the Edgeware X tools collection.
- *
- * X tools 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 of the License, or
- * (at your option) any later version.
- * 
- * X tools 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 X tools; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/*----- Header files ------------------------------------------------------*/
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <mLib/darray.h>
-#include <mLib/dstr.h>
-#include <mLib/mdwopt.h>
-#include <mLib/quis.h>
-#include <mLib/report.h>
-
-#include <mgLib/msg.h>
-
-/*----- Data structures ---------------------------------------------------*/
-
-typedef struct button {
-  unsigned f;
-  const char *text;
-} button;
-
-#define f_cancel 1u
-#define f_default 2u
-
-DA_DECL(button_v, button);
-
-/*----- Main code ---------------------------------------------------------*/
-
-/* --- @version@ --- */
-
-static void version(FILE *fp)
-{
-  fprintf(fp, "%s (xtoys version " VERSION ")\n", QUIS);
-}
-
-/* --- @usage@ --- */
-
-static void usage(FILE *fp)
-{
-  fprintf(fp, "Usage: %s [-f] [-t TITLE] [-c|d BUTTON] MSG [BUTTON...]\n",
-         QUIS);
-}
-
-/* --- @findbutton@ --- */
-
-static button *findbutton(button_v *bv, const char *tag)
-{
-  size_t i, n = DA_LEN(bv);
-  button *b = DA(bv);
-  char *q;
-
-  if (!tag)
-    return (0);
-  for (i = 0; i < n; i++) {
-    if (strcmp(b[i].text, tag) == 0)
-      return (&b[i]);
-  }
-  while (*tag && isspace((unsigned char)*tag))
-    tag++;
-  i = strtoul(tag, &q, 0);
-  if (!*q && i < n)
-    return (&b[i]);
-  die(EXIT_FAILURE, "unknown button `%s'", tag);
-  return (0);
-}
-   
-
-/* --- @main@ --- *
- *
- * Main program.
- */
-
-int main(int argc, char *argv[])
-{
-  const char *title;
-  const char *message;
-  const char *b_cancel = 0, *b_default = 0;
-  button_v bv = DA_INIT;
-  button *b;
-  dstr d = DSTR_INIT;
-  dstr msgbuf = DSTR_INIT;
-  size_t n, i;
-  unsigned f = 0;
-
-#define f_focus 256u
-
-  ego(argv[0]);
-  gtk_init(&argc, &argv);
-
-  /* --- Parse options --- */
-
-  title = QUIS;
-  for (;;) {
-    static struct option opt[] = {
-      { "help",                0,              0,      'h' },
-      { "usage",       0,              0,      'u' },
-      { "version",     0,              0,      'v' },
-      { "focus",       0,              0,      'f' },
-      { "title",       OPTF_ARGREQ,    0,      't' },
-      { "cancel",      OPTF_ARGREQ,    0,      'c' },
-      { "default",     OPTF_ARGREQ,    0,      'd' },
-      { 0,             0,              0,      0 }
-    };
-    int i;
-
-    i = getopt_long(argc, argv, "huv t:c:d:q", opt, 0);
-
-    if (i < 0)
-      break;
-
-    switch (i) {
-      case 'h':
-       version(stdout);
-       fputs("\n", stdout);
-       usage(stdout);
-       fputs(
-"\n"
-"Pops up a message box containing a message and some buttons, reporting\n"
-"which button was selected.\n"
-"\n"
-"Options available are:\n"
-"\n"
-"-h, --help            Display this help text\n"
-"-u, --usage           Display a short usage summary\n"
-"-v, --version         Display the program's version number\n"
-"\n"
-"-f, --focus           Give the window the focus (obsolete mdw thing)\n"
-"-t, --title=TITLE     Select the title string in the message box\n"
-"-c, --cancel=BUTTON   Select which button is to have the Cancel action\n"
-"-d, --default=BUTTON  Select which button is the default\n",
-          stdout);
-       exit(0);
-       break;
-      case 'u':
-       usage(stdout);
-       exit(0);
-       break;
-      case 'v':
-       version(stdout);
-       exit(0);
-       break;
-
-      case 'f':
-       f |= f_focus;
-       break;
-      case 't':
-       title = optarg;
-       break;
-      case 'c':
-       b_cancel = optarg;
-       break;
-      case 'd':
-       b_default = optarg;
-       break;
-
-      default:
-       usage(stderr);
-       exit(EXIT_FAILURE);
-    }
-  }
-
-  if (optind >= argc) {
-    usage(stderr);
-    exit(EXIT_FAILURE);
-  }
-  message = argv[optind++];
-  if (*message == '%')
-    message++;
-  else if (strcmp(message, "-") == 0) {
-    for (;;) {
-      size_t n;
-      
-      dstr_ensure(&msgbuf, 4096);
-      n = fread(msgbuf.buf + msgbuf.len, 1,
-               msgbuf.sz - msgbuf.len, stdin);
-      if (!n)
-       break;
-      msgbuf.len += n;
-    }
-    if (msgbuf.len && msgbuf.buf[msgbuf.len - 1])
-      msgbuf.len--;
-    dstr_putz(&msgbuf);
-    message = msgbuf.buf;
-  }
-
-  if (optind >= argc) {
-    DA_ENSURE(&bv, 1);
-    b = &DA(&bv)[0];
-    b->f = 0;
-    b->text = "OK";
-    DA_UNSAFE_EXTEND(&bv, 1);
-  } else for (; optind < argc; optind++) {
-    DA_ENSURE(&bv, 1);
-    b = &DA(&bv)[DA_LEN(&bv)];
-    b->f = 0;
-    b->text = argv[optind];
-    DA_UNSAFE_EXTEND(&bv, 1);    
-  }
-
-  if ((b = findbutton(&bv, b_cancel)) != 0)
-    b->f |= f_cancel;
-  else
-    DA(&bv)[DA_LEN(&bv) - 1].f |= f_cancel;
-
-  if ((b = findbutton(&bv, b_default)) != 0)
-    b->f |= f_default;
-  else
-    DA(&bv)[0].f |= f_default;
-
-  b = DA(&bv);
-  n = DA_LEN(&bv);
-  if (f & f_focus)
-    DPUTC(&d, '!');
-  for (i = 0; i < n; i++) {
-    if (b[i].f & f_default)
-      DPUTC(&d, ':');
-    if (b[i].f & f_cancel)
-      DPUTC(&d, '~');
-    DPUTS(&d, b[i].text);
-    DPUTC(&d, ',');
-  }
-  d.buf[--d.len] = 0;
-
-  i = msg(title, d.buf, "%s", message);
-  if (n > 1)
-    puts(b[i].text);
-  return (0);
-}
-
-/*----- That's all, folks -------------------------------------------------*/
index aae7284..764b542 100644 (file)
--- a/xscsize.1
+++ b/xscsize.1
@@ -57,7 +57,7 @@ Set to the height of the display in pixels.
 .B SHELL
 Used to decide the nature of the calling shell.  If absent, a Bourne
 shell is assumed.
-.SH AUTHOR
-Mark Wooding (mdw@nsict.org).
 .SH BUGS
 Hopefully none.
+.SH AUTHOR
+Mark Wooding (mdw@distorted.org.uk).
diff --git a/xshutdown.1 b/xshutdown.1
deleted file mode 100644 (file)
index 4b3c8a5..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-.\" -*-nroff-*-
-.TH xshutdown 1 "15 November 1998" "Straylight/Edgeware" "xtoys"
-.SH NAME
-xshutdown \- asks for user confirmation before waking an xwait process
-.SH SYNOPSIS
-.ll +5i
-.B xshutdown
-.RB [ \-\-display
-.IR display ]
-.RB [ \-a
-.IR atom ]
-.RB [ \-m
-.IR msg ]
-.if n \{\
-.br
-\h'1i'
-..
-\}
-.RB [ \-t
-.IR title ]
-.RI [ \c
-.IB atom : msg \c
-]
-.ll -5i
-.SH DESCRIPTION
-The
-.B xshutdown
-program pops up a pretty GTK confirmation box asking the user whether he
-(or she) wants to shutdown the current session.  If so, it sends a
-message to a waiting
-.B xwait
-process, by setting a named property on the X root window to a particular
-value.
-.SS Options
-.TP 5
-.BI "\-\-display " display
-Attempt to connect to
-.I display
-rather than the display named in the usual environment variable.
-.TP 5
-.BI "\-a, \-\-atom " atom
-Sets
-.B xshutdown
-to to set the property named
-.IR atom .
-This option is deprecated.
-.TP 5
-.BI "\-m, \-\-msg " msg
-Sets
-.B xshutdown
-to set the given property to
-.IR msg .
-This option is deprecated.
-.TP 5
-.BI "\-p, \-\-prompt " prompt
-Sets the prompt in the confirmation box to
-.IR prompt .
-.TP 5
-.BI "\-t, \-\-title " title
-Sets the window title to be
-.IR title .
-.PP
-The
-.B \-a
-and
-.B \-m
-options are deprecated, though retained for compatibility reasons.  It's
-recommended that you use the non-option specification instead.
-.PP
-The argument specifies an atom name and a message string to set.  The
-default, if no atom or message is given, is to set
-.B XWAIT_PROPERTY
-to the value
-.BR XWAIT_MESSAGE .
-.SH AUTHOR
-Mark Wooding (mdw@nsict.org).
-.SH BUGS
-None currently known.
-.SH SEE ALSO
-.BR xwait (1),
-and
-.BR xtell (1).
diff --git a/xshutdown.c b/xshutdown.c
deleted file mode 100644 (file)
index 8118e62..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*-c-*-
- *
- * $Id: xshutdown.c,v 1.9 2004/04/08 01:36:29 mdw Exp $
- *
- * Pretty GTK interface to waking up an xwait
- *
- * (c) 1998 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of the Edgeware X tools collection.
- *
- * X tools 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 of the License, or
- * (at your option) any later version.
- * 
- * X tools 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 X tools; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/*----- Header files ------------------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include <gtk/gtk.h>
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkkeysyms.h>
-
-#include <mLib/mdwopt.h>
-#include <mLib/quis.h>
-#include <mLib/report.h>
-
-#include <mgLib/msg.h>
-
-#include "xatom.h"
-#include "xwait.h"
-
-/*----- Main code ---------------------------------------------------------*/
-
-/* --- @version@ --- */
-
-static void version(FILE *fp)
-{
-  fprintf(fp, "%s (xtoys version " VERSION ")\n", QUIS);
-}
-
-/* --- @usage@ --- */
-
-static void usage(FILE *fp)
-{
-  fprintf(fp, "Usage: %s [-p PROMPT] [-t TITLE] [ATOM:MSG]\n", QUIS);
-}
-
-/* --- @main@ --- *
- *
- * Main program.
- */
-
-int main(int argc, char *argv[])
-{
-  const char *atom = XWAIT_DIE;
-  const char *xmsg = XWAIT_DIE_MSG;
-  Atom xa, xm;
-
-  const char *prompt = "Are you sure you want to shut down this session?";
-  const char *title;
-  ego(argv[0]);
-  gtk_init(&argc, &argv);
-
-  /* --- Parse options --- */
-
-  title = QUIS;
-  for (;;) {
-    static struct option opt[] = {
-      { "help",                0,              0,      'h' },
-      { "usage",       0,              0,      'u' },
-      { "version",     0,              0,      'v' },
-      { "atom",                OPTF_ARGREQ,    0,      'a' },
-      { "msg",         OPTF_ARGREQ,    0,      'm' },
-      { "prompt",      OPTF_ARGREQ,    0,      'p' },
-      { "title",       OPTF_ARGREQ,    0,      't' },
-      { 0,             0,              0,      0 }
-    };
-    int i;
-
-    i = getopt_long(argc, argv, "huv a:m:p:t:", opt, 0);
-
-    if (i < 0)
-      break;
-
-    switch (i) {
-      case 'h':
-       version(stdout);
-       fputs("\n", stdout);
-       usage(stdout);
-       fputs(
-"\n"
-"Kills a waiting `xwait' process.  Pops up a confirmation window first.\n"
-"\n"
-"Options available are:\n"
-"\n"
-"-h, --help            Display this help text\n"
-"-u, --usage           Display a short usage summary\n"
-"-v, --version         Display the program's version number\n"
-"\n"
-"-a, --atom=ATOM\t     Select the property name atom [deprecated]\n"
-"-m, --msg=MSG         Select the message to send [deprecated]\n"
-"-p, --prompt=PROMPT   Select the prompt string in the confirmation box\n"
-"-t, --title=TITLE     Select the title string in the confirmation box\n",
-          stdout);
-       exit(0);
-       break;
-      case 'u':
-       usage(stdout);
-       exit(0);
-       break;
-      case 'v':
-       version(stdout);
-       exit(0);
-       break;
-       
-      case 'a':
-       atom = optarg;
-       break;
-      case 'm':
-       xmsg = optarg;
-       break;
-      case 'p':
-       prompt = optarg;
-       break;
-      case 't':
-       title = optarg;
-       break;
-      default:
-       usage(stderr);
-       exit(EXIT_FAILURE);
-    }
-  }
-
-  if (optind < argc) {
-    char *p;
-    if ((atom = strtok(argv[optind++], ":")) == 0)
-      die(EXIT_FAILURE, "missing atom name");
-    if ((p = strtok(0, ",")) != 0)
-      xmsg = p;
-  }
-
-  if (optind < argc) {
-    usage(stderr);
-    exit(EXIT_FAILURE);
-  }
-
-  xa = XInternAtom(gdk_display, atom, False);
-  xm = XInternAtom(gdk_display, xmsg, False);
-
-  /* --- Decide whether there's an xwait listening --- *
-   *
-   * If not, pop up an error box and quit.
-   */
-
-  if (xatom_get(gdk_display, DefaultRootWindow(gdk_display), xa) == None) {
-    msg(QUIS, "!:~OK", "no xwait listening for `%s'", atom);
-    exit(EXIT_FAILURE);
-  }
-
-  /* --- Main code --- */
-
-  if (msg(title, "!:OK,~Cancel", "%s", prompt) == 0)
-    xatom_set(gdk_display, DefaultRootWindow(gdk_display), xa, xm);
-
-  return (0);
-}
-
-/*----- That's all, folks -------------------------------------------------*/
diff --git a/xtell.1 b/xtell.1
deleted file mode 100644 (file)
index 93a0bb2..0000000
--- a/xtell.1
+++ /dev/null
@@ -1,64 +0,0 @@
-.\" -*-nroff-*-
-.TH xtell 1 "15 November 1998" "Straylight/Edgeware" "xtoys"
-.SH NAME
-xtell \- prods a waiting xwait process
-.SH SYNOPSIS
-.ll +5i
-.B xtell
-.RB [ \-d
-.IR display ]
-.RB [ \-a
-.IR atom ]
-.RB [ \-m
-.IR msg ]
-.RI [ \c
-.IB atom : msg \c
-]
-.ll -5i
-.SH DESCRIPTION
-The
-.B xtell
-program sets a named property on the X root window to a particular
-value.  This is primarily useful for communicating with
-.BR xwait (1).
-.SS Options
-.TP 5
-.BI "\-d, \-\-display " display
-Attempt to connect to
-.I display
-rather than the display named in the usual environment variable.
-.TP 5
-.BI "\-a, \-\-atom " atom
-Sets
-.B xtell
-to to set the property named
-.IR atom .
-Use of this option is deprecated.
-.TP 5
-.BI "\-m, \-\-msg " msg
-Sets
-.B xtell
-to set the given property to
-.IR msg .
-Use of this option is deprecated.
-.PP
-The
-.B \-a
-and
-.B \-m
-options are deprecated, though retained for compatibility reasons.  It's
-recommended that you use the non-option specification instead.
-.PP
-The argument specifies an atom name and a message string to set.  The
-default, if no atom or message is given, is to set
-.B XWAIT_PROPERTY
-to the value
-.BR XWAIT_MESSAGE .
-.SH AUTHOR
-Mark Wooding (mdw@nsict.org).
-.SH BUGS
-None currently known.
-.SH SEE ALSO
-.BR xwait (1),
-and
-.BR xshutdown (1).
diff --git a/xtell.c b/xtell.c
deleted file mode 100644 (file)
index 961cc2e..0000000
--- a/xtell.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*-c-*-
- *
- * $Id: xtell.c,v 1.6 2004/04/08 01:36:29 mdw Exp $
- *
- * Wake up a waiting xwait process
- *
- * (c) 1998 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of the Edgeware X tools collection.
- *
- * X tools 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 of the License, or
- * (at your option) any later version.
- * 
- * X tools 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 X tools; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/*----- Header files ------------------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include <mLib/mdwopt.h>
-#include <mLib/quis.h>
-#include <mLib/report.h>
-
-#include "xatom.h"
-#include "xwait.h"
-
-/*----- Main code ---------------------------------------------------------*/
-
-static void version(FILE *fp)
-{
-  fprintf(fp, "%s (xtoys version " VERSION ")\n", QUIS);
-}
-
-static void usage(FILE *fp)
-{
-  fprintf(fp, "Usage: %s [-d DISPLAY] [ATOM:MSG]\n", QUIS);
-}
-
-int main(int argc, char *argv[])
-{
-  char *display = 0;
-  Display *dpy;
-  Atom a, m;
-  char *atom = XWAIT_DIE;
-  char *msg = XWAIT_DIE_MSG;
-
-  /* --- Parse options --- */
-
-  ego(argv[0]);
-
-  for (;;) {
-    static struct option opt[] = {
-      { "help",        0,              0,      'h' },
-      { "usage",       0,              0,      'u' },
-      { "version",     0,              0,      'v' },
-      { "display",     OPTF_ARGREQ,    0,      'd' },
-      { "atom",                OPTF_ARGREQ,    0,      'a' },
-      { "msg",         OPTF_ARGREQ,    0,      'm' },
-      {        0,              0,              0,      0 }
-    };
-
-    int i = mdwopt(argc, argv, "huvd:a:m:", opt, 0, 0, 0);
-    if (i < 0)
-      break;
-    switch (i) {
-      case 'h':
-       version(stdout);
-       fputs("\n", stdout);
-       usage(stdout);
-       fputs(
-"\n"
-"Signals a waiting `xwait' process.  Specifically, writes a property\n"
-"named ATOM to the X root window, with value MSG.\n"
-"\n"
-"Options:\n"
-"\n"
-"-h, --help            Display this help text\n"
-"-u, --usage           Display a short usage summary\n"
-"-v, --version         Display the program's version number\n"
-"\n"
-"-d, --display=DISPLAY Choose X display to connect to\n"
-"-a, --atom=ATOM\t     Choose property name to set [deprecated]\n"
-"-m, --msg=MSG         Choose value of property to set [deprecated]\n",
-          stdout);
-       exit(0);
-       break;
-      case 'u':
-       usage(stdout);
-       exit(0);
-       break;
-      case 'v':
-       version(stdout);
-       exit(0);
-       break;
-       
-      case 'd':
-       display = optarg;
-       break;
-      case 'a':
-       atom = optarg;
-       break;
-      case 'm':
-       msg = optarg;
-       break;
-      default:
-       usage(stderr);
-       exit(EXIT_FAILURE);
-       break;
-    }
-  }
-
-  if (optind < argc) {
-    char *p;
-    if ((atom = strtok(argv[optind++], ":")) == 0)
-      die(EXIT_FAILURE, "missing atom name");
-    if ((p = strtok(0, ",")) != 0)
-      msg = p;
-  }
-
-  if (optind < argc) {
-    usage(stderr);
-    exit(EXIT_FAILURE);
-  }
-
-  /* --- Set the property value and exit --- */
-
-  if ((dpy = XOpenDisplay(display)) == 0)
-    die(EXIT_FAILURE, "couldn't open display");
-
-  a = XInternAtom(dpy, atom, False);
-  m = XInternAtom(dpy, msg, False);
-  xatom_set(dpy, DefaultRootWindow(dpy), a, m);
-
-  XCloseDisplay(dpy);
-  return (0);
-}
-
-/*----- That's all, folks -------------------------------------------------*/
diff --git a/xwait.1 b/xwait.1
deleted file mode 100644 (file)
index 5a18e78..0000000
--- a/xwait.1
+++ /dev/null
@@ -1,110 +0,0 @@
-.\" -*-nroff-*-
-.de hP
-.IP
-\h'-\w'\fB\\$1\ \fP'u'\fB\\$1\ \fP\c
-..
-.ie t .ds o \(bu
-.el .ds o o
-.
-.TH xwait 1 "15 November 1998" "Straylight/Edgeware" "xtoys"
-.SH NAME
-xwait \- wait until prodded by another X client
-.SH SYNOPSIS
-.ll +5i
-.B xwait
-.RB [ \-f ]
-.RB [ \-d
-.IR display ]
-.RB [ \-a
-.IR atom ]
-.RB [ \-m
-.IR msg ]
-.RI [ \c
-.IB atom : msg , msg \c
-\&...]
-.ll -5i
-.SH DESCRIPTION
-The
-.B xwait
-program waits until it notices that a particular property on the X root
-window has been assigned a particular value, at which point the program
-exits.  The property can be set using the
-.BR xtell (1)
-and
-.BR xshutdown (1)
-programs.  It's mostly useful for putting at the end of a user's
-.B .xinitrc
-file, so that it can be triggered to end the session.
-.PP
-The properties, and the values to listen for, can be configured at the
-command line.  When
-.B xwait
-exits, it removes the properties from the root window.
-.SS Options
-.TP 5
-.B \-f, \-\-force
-Force 
-.B xwait
-to start up, even though there may be an existing process already
-listening for the particular atom in question.
-.TP 5
-.BI "\-d, \-\-display " display
-Attempt to connect to
-.I display
-rather than the display named in the usual environment variable.
-.TP 5
-.BI "\-a, \-\-atom " atom
-Sets
-.B xwait
-to listen for the property named
-.IR atom .
-Use of this option is deprecated.
-.TP 5
-.BI "\-m, \-\-msg " msg
-Sets
-.B xwait
-to wait for the given property to be set to
-.IR msg .
-Use of this option is deprecated.
-.SS "Argument format"
-The
-.B \-a
-and
-.B \-m
-options are deprecated, though retained for compatibility reasons.
-It's recommended that you use the non-option specification instead.
-.PP
-Each argument specifies an atom name and a list of message strings to
-listen to.  Multiple properties may be listened for, and multiple
-messages may be accepted for each property.  If no messages are
-specified then all values are considered to be acceptable.  The program
-exits when any property is set to an acceptable value.
-.PP
-If no atoms are given on the command line,
-.B xwait
-will wait for
-.B XWAIT_PROPERTY
-to be set to
-.BR XWAIT_MESSAGE .
-.SS "Output format"
-When a message is eventually received,
-.B xwait
-prints information about it to standard output:
-.hP \*o
-If more than one property (atom) was specified, the property name is
-printed.
-.hP \*o
-If more than one message is recognized for the property, the message
-string is printed; if a property name was printed, the two are separated
-by a colon and a single space character.
-.PP
-.B xwait
-then exits with return code 0.
-.SH AUTHOR
-Mark Wooding (mdw@nsict.org).
-.SH BUGS
-None currently known.
-.SH SEE ALSO
-.BR xtell (1),
-and
-.BR xshutdown (1).
diff --git a/xwait.c b/xwait.c
deleted file mode 100644 (file)
index 606321a..0000000
--- a/xwait.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/* -*-c-*-
- *
- * $Id: xwait.c,v 1.10 2004/04/08 01:36:29 mdw Exp $
- *
- * Wait until prodded by another X client
- *
- * (c) 1998 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of the Edgeware X tools collection.
- *
- * X tools 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 of the License, or
- * (at your option) any later version.
- * 
- * X tools 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 X tools; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/*----- Header files ------------------------------------------------------*/
-
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include <mLib/mdwopt.h>
-#include <mLib/quis.h>
-#include <mLib/report.h>
-#include <mLib/sub.h>
-
-#include "xatom.h"
-#include "xwait.h"
-
-/*----- Data structures ---------------------------------------------------*/
-
-typedef struct xwait_msg {
-  struct xwait_msg *next;              /* Next message in the list */
-  Atom a;                              /* The message atom */
-} xwait_msg;
-
-typedef struct xwait_atom {
-  struct xwait_atom *next;             /* Next atom in the list */
-  Atom a;                              /* The actual atom */
-  xwait_msg *m;                                /* List of interesting messages */
-} xwait_atom;
-
-/*----- Static variables --------------------------------------------------*/
-
-static xwait_atom *atoms = 0;
-static Display *dpy;
-
-/*----- Main code ---------------------------------------------------------*/
-
-/* --- @sigchld@ --- */
-
-static void sigchld(int sig)
-{
-  int e = errno;
-  while (waitpid(-1, 0, WNOHANG) > 0)
-    ;
-  errno = e;
-}
-
-/* --- @opendisplay@ --- */
-
-static void opendisplay(const char *d)
-{
-  if (dpy)
-    return;
-  if ((dpy = XOpenDisplay(d)) == 0)
-    die(EXIT_FAILURE, "couldn't open display");
-}
-
-/* --- @addatom@ --- */
-
-static xwait_atom *addatom(const char *a)
-{
-  xwait_atom *xa = CREATE(xwait_atom);
-  opendisplay(0);
-  xa->next = atoms;
-  xa->a = XInternAtom(dpy, a, False);
-  xa->m = 0;
-  atoms = xa;
-  return (xa);
-}
-
-/* --- @addmsg@ --- */
-
-static void addmsg(xwait_atom *xa, const char *a)
-{
-  xwait_msg *xm = CREATE(xwait_msg);
-  opendisplay(0);
-  xm->next = xa->m;
-  xm->a = XInternAtom(dpy, a, False);
-  xa->m = xm;
-}
-
-/* --- @tidy@ --- */
-
-static void tidy(int sig)
-{
-  int i;
-  int nsc = ScreenCount(dpy);
-  xwait_atom *xa;
-
-  for (i = 0; i < nsc; i++) {
-    for (xa = atoms; xa; xa = xa->next)
-      XDeleteProperty(dpy, RootWindow(dpy, i), xa->a);
-  }
-  XCloseDisplay(dpy);
-  exit(0);
-}
-
-/* --- @main@ --- */
-
-static void version(FILE *fp)
-{
-  fprintf(fp, "%s (xtoys version " VERSION ")\n", QUIS);
-}
-
-static void usage(FILE *fp)
-{
-  fprintf(fp, "Usage: %s [-f] [-d DISPLAY] [ATOM:MSG,MSG]...\n", QUIS);
-}
-
-int main(int argc, char *argv[])
-{
-  Atom a;
-  XEvent ev;
-  unsigned f = 0;
-  xwait_atom *xa = 0;
-  xwait_msg *xm = 0;
-
-#define f_force 1u
-
-  /* --- Initialize mLib --- */
-
-  ego(argv[0]);
-  sub_init();
-
-  /* --- Parse options --- */
-
-  for (;;) {
-    static struct option opt[] = {
-      { "help",        0,                      0,      'h' },
-      { "usage",       0,                      0,      'u' },
-      { "version",     0,                      0,      'v' },
-      { "display",     OPTF_ARGREQ,            0,      'd' },
-      { "atom",                OPTF_ARGREQ,            0,      'a' },
-      { "msg",         OPTF_ARGREQ,            0,      'm' },
-      { "force",       0,                      0,      'f' },
-      {        0,              0,                      0,      0 }
-    };
-
-    int i = mdwopt(argc, argv, "huvd:a:m:f", opt, 0, 0, 0);
-    if (i < 0)
-      break;
-    switch (i) {
-      case 'h':
-       version(stdout);
-       fputs("\n", stdout);
-       usage(stdout);
-       fputs(
-"\n"
-"Waits until signalled by `xtell' or `xshutdown'.  Specifically, waits\n"
-"until a property with name ATOM is written to the root window with\n"
-"contents MSG.\n"
-"\n"
-"Options:\n"
-"\n"
-"-h, --help            Display this help text\n"
-"-u, --usage           Display a short usage summary\n"
-"-v, --version         Display the program's version number\n"
-"\n"
-"-d, --display=DISPLAY Choose X display to connect to\n"
-"-f, --force           Run even if this property is waited for by another\n"
-"                      process\n"
-"-a, --atom=ATOM\t     Choose property name to listen for [deprecated]\n"
-"-m, --msg=MSG         Choose value of property to wait for [deprecated]\n",
-          stdout);
-       exit(0);
-       break;
-      case 'u':
-       usage(stdout);
-       exit(0);
-       break;
-      case 'v':
-       version(stdout);
-       exit(0);
-       break;
-       
-      case 'd':
-       opendisplay(optarg);
-       break;
-      case 'a':
-       xa = addatom(optarg);
-       break;
-      case 'm':
-       if (!xa)
-         die(EXIT_FAILURE, "no atom currently defined");
-       addmsg(xa, optarg);
-       break;
-      case 'f':
-       f |= f_force;
-       break;
-      default:
-       usage(stderr);
-       exit(EXIT_FAILURE);
-       break;
-    }
-  }
-
-  /* --- Grind through remaining arguments in the new syntax --- */
-
-  while (optind < argc) {
-    char *p = strtok(argv[optind++], ":");
-    if (!p)
-      continue;
-    xa = addatom(p);
-    while ((p = strtok(0, ",")) != 0)
-      addmsg(xa, p);
-  }
-
-  /* --- If there's nothing set, put in some defaults --- */
-
-  if (!atoms) {
-    xa = addatom(XWAIT_DIE);
-    addmsg(xa, XWAIT_DIE_MSG);
-  }
-
-  /* --- Attach the atoms to the screens --- */
-
-  {
-    int i;
-    Atom ready = XInternAtom(dpy, "XWAIT_READY", False);
-    int nsc = ScreenCount(dpy);
-
-    /* --- First pass: make sure there's not a process already here --- */
-
-    if ((f & f_force) == 0) {
-      for (i = 0; i < nsc; i++) {
-       for (xa = atoms; xa; xa = xa->next) {
-         if (xatom_get(dpy, RootWindow(dpy, i), xa->a) != None)
-           die(EXIT_FAILURE, "already waiting for `%s'");
-       }
-      }
-    }
-
-    /* --- Second pass: set up listening to the property --- */
-
-    for (i = 0; i < nsc; i++) {
-      for (xa = atoms; xa; xa = xa->next)
-       xatom_set(dpy, RootWindow(dpy, i), xa->a, ready);
-      XSelectInput(dpy, RootWindow(dpy, i), PropertyChangeMask);
-    }
-  }
-
-  /* --- Set up a handler when children die --- *
-   *
-   * I don't fork any children?  Why is this useful?  Because I've been
-   * execed from a shell which started lots of background processes, and
-   * they'll zombie themselves otherwise.
-   */
-
-  {
-    struct sigaction sa;
-
-    sa.sa_handler = sigchld;
-    sigemptyset(&sa.sa_mask);
-    sigaddset(&sa.sa_mask, SIGCHLD);
-    sa.sa_flags = SA_NOCLDSTOP;
-#ifdef SA_RESTART
-    sa.sa_flags |= SA_RESTART;
-#endif
-    sigaction(SIGCHLD, &sa, 0);
-  }
-
-  /* --- Now reap any which have been waiting around so far --- */
-
-  {
-    sigset_t ss, oss;
-
-    sigemptyset(&ss);
-    sigaddset(&ss, SIGCHLD);
-    sigprocmask(SIG_BLOCK, &ss, &oss);
-    sigchld(SIGCHLD);
-    sigprocmask(SIG_SETMASK, &oss, 0);
-  }
-
-  signal(SIGINT, tidy);
-  signal(SIGTERM, tidy);
-
-  /* --- Now wait for an event --- */
-
-  for (;;) {
-    XNextEvent(dpy, &ev);
-    switch (ev.type) {
-      case PropertyNotify:
-       for (xa = atoms; xa; xa = xa->next) {
-         if (ev.xproperty.atom != xa->a)
-           continue;
-         a = xatom_get(dpy, ev.xproperty.window, xa->a);
-         if (a == None)
-           continue;
-         if (xa->m == 0)
-           goto exit;
-         for (xm = xa->m; xm; xm = xm->next) {
-           if (a == xm->a)
-             goto exit;
-         }
-       }
-       break;
-    }
-  }
-
-  /* --- Finished: report the result if necessary --- */
-
-exit:
-  if (atoms->next) {
-    fputs(XGetAtomName(dpy, xa->a), stdout);
-    if (!xa->m || xa->m->next)
-      printf(": %s\n", XGetAtomName(dpy, a));
-    else
-      fputc('\n', stdout);
-  } else if (!xa->m || xa->m->next)
-    printf("%s\n", XGetAtomName(dpy, a));
-
-  /* --- Go away --- */
-
-  tidy(0);
-  return (0);
-}
-
-/*----- That's all, folks -------------------------------------------------*/
diff --git a/xwait.h b/xwait.h
deleted file mode 100644 (file)
index b3e94ac..0000000
--- a/xwait.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*-c-*-
- *
- * $Id: xwait.h,v 1.3 2004/04/08 01:36:29 mdw Exp $
- *
- * Common definitions for the `xwait' kit
- *
- * (c) 1998 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of the Edgeware X tools collection.
- *
- * X tools 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 of the License, or
- * (at your option) any later version.
- * 
- * X tools 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 X tools; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef XWAIT_H
-#define XWAIT_H
-
-#ifdef __cplusplus
-  extern "C" {
-#endif
-
-/*----- Macros ------------------------------------------------------------*/
-
-#define XWAIT_DIE "XWAIT_PROPERTY"
-#define XWAIT_DIE_MSG "XWAIT_MESSAGE"
-
-/*----- That's all, folks -------------------------------------------------*/
-
-#ifdef __cplusplus
-  }
-#endif
-
-#endif