[hackers] [tabbed] Allow no automatic spawning of the command. || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Thu, 9 Feb 2012 17:43:01 +0100 (CET)

changeset: 151:d10370c55890
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Thu Feb 09 17:39:33 2012 +0100
files: tabbed.1 tabbed.c
description:
Allow no automatic spawning of the command.


diff -r 71992a9dad5f -r d10370c55890 tabbed.1
--- a/tabbed.1 Sun Nov 20 17:38:48 2011 +0100
+++ b/tabbed.1 Thu Feb 09 17:39:33 2012 +0100
_AT_@ -4,16 +4,27 @@
 .SH SYNOPSIS
 .B tabbed
 .RB [ \-d ]
+.RB [ \-h ]
+.RB [ \-s ]
 .RB [ \-v ]
 .IR command ...
 .SH DESCRIPTION
 .B tabbed
-is a simple tabbed container for applications which support XEmbed.
+is a simple tabbed container for applications which support XEmbed. Tabbed
+will then run the provides command with the xid of tabbed as appended
+argument. (See EXAMPLES.) The automatic spawning of the command can be
+disabled by provoding the -s parameter.
 .SH OPTIONS
 .TP
 .B \-d
 detaches tabbed from the terminal and prints its XID to stdout.
 .TP
+.B \-h
+will print the usage of tabbed.
+.TP
+.B \-s
+will disable automatic spawning of the command.
+.TP
 .B \-v
 prints version information to stderr, then exits.
 .SH USAGE
diff -r 71992a9dad5f -r d10370c55890 tabbed.c
--- a/tabbed.c Sun Nov 20 17:38:48 2011 +0100
+++ b/tabbed.c Thu Feb 09 17:39:33 2012 +0100
_AT_@ -141,7 +141,7 @@
 };
 static int bh, wx, wy, ww, wh;
 static unsigned int numlockmask = 0;
-static Bool running = True, nextfocus;
+static Bool running = True, nextfocus, doinitspawn = True;
 static Display *dpy;
 static DC dc;
 static Atom wmatom[WMLast], xembedatom;
_AT_@ -687,7 +687,8 @@
         /* main event loop */
         XSync(dpy, False);
         drawbar();
- spawn(NULL);
+ if(doinitspawn == True)
+ spawn(NULL);
         while(running) {
                 XNextEvent(dpy, &ev);
                 if(handler[ev.type])
_AT_@ -862,6 +863,12 @@
         return xerrorxlib(dpy, ee); /* may call exit */
 }
 
+void
+usage(char *argv0)
+{
+ die("usage: %s [-dhsv] command...\n", argv0);
+}
+
 int
 main(int argc, char *argv[]) {
         int i, detach = 0;
_AT_@ -871,11 +878,15 @@
                         die("tabbed-"VERSION", © 2009-2011 tabbed engineers, see LICENSE for details\n");
                 else if(!strcmp("-d", argv[i]))
                         detach = 1;
+ else if(!strcmp("-s", argv[i]))
+ doinitspawn = False;
+ else if(!strcmp("-h", argv[i]))
+ usage(argv[0]);
                 else
                         setcmd(argc-i, argv+i);
         }
         if(!cmd)
- die("usage: tabbed [-d] [-v] command...\n");
+ usage(argv[0]);
         if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
                 fprintf(stderr, "tabbed: no locale support\n");
         if(!(dpy = XOpenDisplay(NULL)))
Received on Thu Feb 09 2012 - 17:43:01 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 09 2012 - 17:48:07 CET