+++ /dev/null
-/* -*-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 -------------------------------------------------*/