961cc2e98468e90132846a11b4f9194ad416d0be
3 * $Id: xtell.c,v 1.6 2004/04/08 01:36:29 mdw Exp $
5 * Wake up a waiting xwait process
7 * (c) 1998 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of the Edgeware X tools collection.
14 * X tools is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * X tools is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with X tools; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /*----- Header files ------------------------------------------------------*/
36 #include <X11/Xutil.h>
38 #include <mLib/mdwopt.h>
39 #include <mLib/quis.h>
40 #include <mLib/report.h>
45 /*----- Main code ---------------------------------------------------------*/
47 static void version(FILE *fp
)
49 fprintf(fp
, "%s (xtoys version " VERSION
")\n", QUIS
);
52 static void usage(FILE *fp
)
54 fprintf(fp
, "Usage: %s [-d DISPLAY] [ATOM:MSG]\n", QUIS
);
57 int main(int argc
, char *argv
[])
62 char *atom
= XWAIT_DIE
;
63 char *msg
= XWAIT_DIE_MSG
;
65 /* --- Parse options --- */
70 static struct option opt
[] = {
71 { "help", 0, 0, 'h' },
72 { "usage", 0, 0, 'u' },
73 { "version", 0, 0, 'v' },
74 { "display", OPTF_ARGREQ
, 0, 'd' },
75 { "atom", OPTF_ARGREQ
, 0, 'a' },
76 { "msg", OPTF_ARGREQ
, 0, 'm' },
80 int i
= mdwopt(argc
, argv
, "huvd:a:m:", opt
, 0, 0, 0);
90 "Signals a waiting `xwait' process. Specifically, writes a property\n"
91 "named ATOM to the X root window, with value MSG.\n"
95 "-h, --help Display this help text\n"
96 "-u, --usage Display a short usage summary\n"
97 "-v, --version Display the program's version number\n"
99 "-d, --display=DISPLAY Choose X display to connect to\n"
100 "-a, --atom=ATOM\t Choose property name to set [deprecated]\n"
101 "-m, --msg=MSG Choose value of property to set [deprecated]\n",
132 if ((atom
= strtok(argv
[optind
++], ":")) == 0)
133 die(EXIT_FAILURE
, "missing atom name");
134 if ((p
= strtok(0, ",")) != 0)
143 /* --- Set the property value and exit --- */
145 if ((dpy
= XOpenDisplay(display
)) == 0)
146 die(EXIT_FAILURE
, "couldn't open display");
148 a
= XInternAtom(dpy
, atom
, False
);
149 m
= XInternAtom(dpy
, msg
, False
);
150 xatom_set(dpy
, DefaultRootWindow(dpy
), a
, m
);
156 /*----- That's all, folks -------------------------------------------------*/