text to all programs. Update manual pages to match.
xgetline \- request a line of text in an X dialogue box
.SH SYNOPSIS
.B xgetline
+.RB [ -i ]
.RB [ \-t
.IR title ]
.RB [ \-p
.fi
.SS OPTIONS
.TP 5
+.B \-i, \-\-invisible
+Don't echo characters to the screen when they're typed. Useful when
+requesting passwords and similar secrets.
+.TP 5
.BI "\-t, \-\-title " title
Sets the title of the dialogue box to
.IR title .
/* -*-c-*-
*
- * $Id: xgetline.c,v 1.2 1998/11/18 21:25:30 mdw Exp $
+ * $Id: xgetline.c,v 1.3 1998/11/21 22:30:20 mdw Exp $
*
* Fetch a line of text from the user
*
/*----- Revision history --------------------------------------------------*
*
* $Log: xgetline.c,v $
+ * Revision 1.3 1998/11/21 22:30:20 mdw
+ * Support GNU-style long options throughout, and introduce proper help
+ * text to all programs. Update manual pages to match.
+ *
* Revision 1.2 1998/11/18 21:25:30 mdw
* Remove bogus `-h' option from the options list.
*
#include <gdk/gdkkeysyms.h>
#include "mdwopt.h"
+#include "quis.h"
/*----- Main code ---------------------------------------------------------*/
return (0);
}
+/* --- @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 [-i] [-t title] [-p prompt] [-d default]\n", QUIS);
+}
+
/* --- @main@ --- *
*
* Arguments: @int argc@ = number of command line arguments
* parser would barf about.
*/
+ ego(argv[0]);
gtk_init(&argc, &argv);
/* --- Parse options from command line --- */
static struct option opt[] = {
{ "help", 0, 0, 'h' },
+ { "usage", 0, 0, 'u' },
+ { "version", 0, 0, 'v' },
{ "title", required_argument, 0, 't' },
{ "prompt", required_argument, 0, 'p' },
{ "default", required_argument, 0, 'd' },
/* --- Fetch an option --- */
- i = getopt_long(argc, argv, "t:p:d:i", opt, 0);
+ i = getopt_long(argc, argv, "huv t:p:d:i", 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",
+ stdout);
+ exit(0);
+ break;
+ case 'u':
+ usage(stdout);
+ exit(0);
+ break;
+ case 'v':
+ version(stdout);
+ exit(0);
+ break;
+
case 't':
title = optarg;
break;
}
if (f & f_duff) {
- fprintf(stderr, "xgetline: bad arguments\n");
+ usage(stderr);
exit(EXIT_FAILURE);
}
.fi
.SS OPTIONS
.TP 5
-.B \-b
+.BI "\-d, \-\-display " display
+Choose which display to connect to.
+.TP 5
+.B \-b, --bourne-shell
Output the assignments in Bourne shell syntax (usable by Bourne,
POSIX, Korn, Z and Bourne Again shells).
.TP 5
-.B \-c
+.B \-c, --c-shell
Output the assignments in C shell syntax (usable by C and Terminal C
shells).
.TP 5
-.B \-x
+.B \-x, --export
Output a variable export command, so that the screen size is inherited
by child processes. The default is to just set local shell variables.
.SH ENVIRONMENT
/* -*-c-*-
*
- * $Id: xscsize.c,v 1.1 1998/11/16 23:00:49 mdw Exp $
+ * $Id: xscsize.c,v 1.2 1998/11/21 22:30:22 mdw Exp $
*
* Return X display size to shell script
*
/*----- Revision history --------------------------------------------------*
*
* $Log: xscsize.c,v $
+ * Revision 1.2 1998/11/21 22:30:22 mdw
+ * Support GNU-style long options throughout, and introduce proper help
+ * text to all programs. Update manual pages to match.
+ *
* Revision 1.1 1998/11/16 23:00:49 mdw
* Initial versions.
*
#include <stdlib.h>
#include <string.h>
-#include <getopt.h>
#include <X11/Xlib.h>
+#include "mdwopt.h"
+#include "quis.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 [-bcx] [-d display]\n", QUIS);
+}
+
int main(int argc, char *argv[])
{
const char *display = 0;
/* --- Parse command line options --- */
+ ego(argv[0]);
+
for (;;) {
- int i = getopt(argc, argv, "d:bcx");
+ static struct option opt[] = {
+ { "help", 0, 0, 'h' },
+ { "usage", 0, 0, 'u' },
+ { "version", 0, 0, 'v' },
+ { "display", required_argument, 0, 'd' },
+ { "bourne-shell", 0, 0, 'b' },
+ { "c-shell", 0, 0, 'c' },
+ { "export", 0, 0, 'x' },
+ { 0, 0, 0, 0 }
+ };
+
+ int i = getopt_long(argc, argv, "huv d:bcx", opt, 0);
if (i < 0)
break;
switch (i) {
+ case 'h':
+ version(stdout);
+ fputs("\n", stdout);
+ usage(stdout);
+ fputs(
+"\n"
+"Reads the size of the X root window and outputs it in a form suitable\n"
+"for use as a shell assignment statement, defining variables XWIDTH and\n"
+"XHEIGHT.\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"
+"-b, --bourne-shell Output text suitable for a Bourne shell\n"
+"-c, --c-shell Output text suitable for a C shell\n"
+"-x, --export Export the variables into the environment\n",
+ stdout);
+ exit(0);
+ break;
+ case 'u':
+ usage(stdout);
+ exit(0);
+ break;
+ case 'v':
+ version(stdout);
+ exit(0);
+ break;
+
case 'd':
display = optarg;
break;
f |= f_export;
break;
default:
- fprintf(stderr, "Usage: xscsize [-bcx] [-d DISPLAY]\n");
+ usage(stderr);
exit(EXIT_FAILURE);
break;
}
/* -*-c-*-
*
- * $Id: xshutdown.c,v 1.1 1998/11/16 23:00:49 mdw Exp $
+ * $Id: xshutdown.c,v 1.2 1998/11/21 22:30:23 mdw Exp $
*
* Pretty GTK interface to waking up an xwait
*
/*----- Revision history --------------------------------------------------*
*
* $Log: xshutdown.c,v $
+ * Revision 1.2 1998/11/21 22:30:23 mdw
+ * Support GNU-style long options throughout, and introduce proper help
+ * text to all programs. Update manual pages to match.
+ *
* Revision 1.1 1998/11/16 23:00:49 mdw
* Initial versions.
*
#include <gdk/gdkprivate.h>
#include "mdwopt.h"
+#include "quis.h"
#include "xwait.h"
/*----- Static variables --------------------------------------------------*/
gtk_main_quit();
}
+/* --- @version@ --- */
+
+static void version(FILE *fp)
+{
+ fprintf(fp, "%s (xtoys version " VERSION ")\n", QUIS);
+}
+
+/* --- @usage@ --- */
+
+static void usage(FILE *fp)
+{
+ fprintf(fp, "Usage: %s [-a ATOM] [-m MSG] [-p PROMPT] [-t TITLE]\n", QUIS);
+}
+
/* --- @main@ --- *
*
* Main program.
{
char *prompt = "Are you sure you want to shut down this session?";
char *title = "xshutdown";
+ ego(argv[0]);
gtk_init(&argc, &argv);
/* --- Parse options --- */
for (;;) {
static struct option opt[] = {
+ { "help", 0, 0, 'h' },
+ { "usage", 0, 0, 'u' },
+ { "version", 0, 0, 'v' },
{ "atom", required_argument, 0, 'a' },
{ "msg", required_argument, 0, 'm' },
{ "prompt", required_argument, 0, 'p' },
};
int i;
- i = getopt_long(argc, argv, "a:m:p:t:", opt, 0);
+ 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 Select the atom that `xwait' is waiting for\n"
+"-m, --msg=MSG Select the message to send to `xwait'\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;
title = optarg;
break;
default:
+ usage(stderr);
exit(EXIT_FAILURE);
}
}
.BR xwait (1).
.SS OPTIONS
.TP 5
-.BI "\-d " display
+.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
+.BI "\-a, \-\-atom " atom
Sets
.B xtell
to to set the property named
The default property to set to is
.BR XWAIT_PROPERTY .
.TP 5
-.BI "\-m " message
+.BI "\-m, \-\-msg " message
Sets
.B xtell
to set the given property to
/* -*-c-*-
*
- * $Id: xtell.c,v 1.1 1998/11/16 23:00:49 mdw Exp $
+ * $Id: xtell.c,v 1.2 1998/11/21 22:30:25 mdw Exp $
*
* Wake up a waiting xwait process
*
/*----- Revision history --------------------------------------------------*
*
* $Log: xtell.c,v $
+ * Revision 1.2 1998/11/21 22:30:25 mdw
+ * Support GNU-style long options throughout, and introduce proper help
+ * text to all programs. Update manual pages to match.
+ *
* Revision 1.1 1998/11/16 23:00:49 mdw
* Initial versions.
*
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
-
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "mdwopt.h"
+#include "quis.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] [-a ATOM] [-m MSG]\n", QUIS);
+}
+
int main(int argc, char *argv[])
{
char *display = 0;
/* --- Parse options --- */
+ ego(argv[0]);
+
for (;;) {
- int i = getopt(argc, argv, "d:a:m:");
+ static struct option opt[] = {
+ { "help", 0, 0, 'h' },
+ { "usage", 0, 0, 'u' },
+ { "version", 0, 0, 'v' },
+ { "display", required_argument, 0, 'd' },
+ { "atom", required_argument, 0, 'a' },
+ { "msg", required_argument, 0, 'm' },
+ { 0, 0, 0, 0 }
+ };
+
+ int i = getopt_long(argc, argv, "d:a:m:", opt, 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 Choose property name to set\n"
+"-m, --msg=MSG Choose value of property to set\n",
+ stdout);
+ exit(0);
+ break;
+ case 'u':
+ usage(stdout);
+ exit(0);
+ break;
+ case 'v':
+ version(stdout);
+ exit(0);
+ break;
+
case 'd':
display = optarg;
break;
exits, it removes the property from the root window.
.SS OPTIONS
.TP 5
-.B \-f
+.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
+.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
+.BI "\-a, \-\-atom " atom
Sets
.B xwait
to listen for the property named
The default property to listen to is
.BR XWAIT_PROPERTY .
.TP 5
-.BI "\-m " message
+.BI "\-m, \-\-msg " message
Sets
.B xwait
to wait for the given property to be set to
/* -*-c-*-
*
- * $Id: xwait.c,v 1.2 1998/11/18 21:25:06 mdw Exp $
+ * $Id: xwait.c,v 1.3 1998/11/21 22:30:27 mdw Exp $
*
* Wait until prodded by another X client
*
/*----- Revision history --------------------------------------------------*
*
* $Log: xwait.c,v $
+ * Revision 1.3 1998/11/21 22:30:27 mdw
+ * Support GNU-style long options throughout, and introduce proper help
+ * text to all programs. Update manual pages to match.
+ *
* Revision 1.2 1998/11/18 21:25:06 mdw
* Reap dead children as they arrive. The previous shell may have
* carelessly left them behind.
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "mdwopt.h"
+#include "quis.h"
#include "xwait.h"
/*----- Main code ---------------------------------------------------------*/
/* --- @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] [-a ATOM] [-m MSG]\n", QUIS);
+}
+
int main(int argc, char *argv[])
{
char *display = 0;
/* --- Parse options --- */
+ ego(argv[0]);
+
for (;;) {
- int i = getopt(argc, argv, "d:a:m:f");
+ static struct option opt[] = {
+ { "help", 0, 0, 'h' },
+ { "usage", 0, 0, 'u' },
+ { "version", 0, 0, 'v' },
+ { "display", required_argument, 0, 'd' },
+ { "atom", required_argument, 0, 'a' },
+ { "msg", required_argument, 0, 'm' },
+ { "force", 0, 0, 'f' },
+ { 0, 0, 0, 0 }
+ };
+
+ int i = getopt_long(argc, argv, "d:a:m:f", opt, 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 Choose property name to listen for\n"
+"-m, --msg=MSG Choose value of property to wait for\n",
+ stdout);
+ exit(0);
+ break;
+ case 'u':
+ usage(stdout);
+ exit(0);
+ break;
+ case 'v':
+ version(stdout);
+ exit(0);
+ break;
+
case 'd':
display = optarg;
break;
f |= f_force;
break;
default:
- fprintf(stderr,
- "Usage: xwait [-f] [-d DISPLAY] [-a ATOM] [-m MSG]\n");
+ usage(stderr);
exit(EXIT_FAILURE);
break;
}