[hackers] [tabbed] Fixing the position parameter and adding the documentation for it. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Wed, 26 Dec 2012 00:05:01 +0100

commit 82fdff00239196e97958aceb6139f650fd9122ee
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Wed Dec 26 00:02:50 2012 +0100

    Fixing the position parameter and adding the documentation for it.

diff --git a/tabbed.1 b/tabbed.1
index 48b3182..a6a6534 100644
--- a/tabbed.1
+++ b/tabbed.1
_AT_@ -10,6 +10,8 @@ tabbed \- generic tabbed interface
 .RB [ \-v ]
 .RB [ \-n
 .IR name ]
+.RB [ \-p
+.IR [ s +/- ] pos ]
 .RB [ \-r
 .IR narg ]
 .IR [ command ... ]
_AT_@ -39,6 +41,16 @@ will print the usage of tabbed.
 will set the WM_CLASS attribute to
 .I name.
 .TP
+.BI \-p " [ s +/-] pos"
+will set the absolute or relative position of where to start a new tab. When
+.I pos
+is is given without 's' in front it is an absolute position. Then negative
+numbers will be the position from the last tab, where -1 is the last tab.
+If 's' is given, then
+.I pos
+is a relative position to the current selected tab. If this reaches the limits
+of the tabs; those limits then apply.
+.TP
 .BI \-r " narg"
 will replace the
 .I narg
diff --git a/tabbed.c b/tabbed.c
index 308776e..b08d4f4 100644
--- a/tabbed.c
+++ b/tabbed.c
_AT_@ -1089,7 +1089,7 @@ char *argv0;
 
 void
 usage(void) {
- die("usage: %s [-dfhsv] [-n name] [-p [+/-]pos] [-r narg]"
+ die("usage: %s [-dfhsv] [-n name] [-p [s+/-]pos] [-r narg]"
                 " command...
", argv0);
 }
 
_AT_@ -1114,9 +1114,12 @@ main(int argc, char *argv[]) {
                 break;
         case 'p':
                 pstr = EARGF(usage());
- if (pstr[0] == '-' || pstr[0] == '+')
+ if(pstr[0] == 's') {
                         npisrelative = True;
- newposition = atoi(pstr);
+ newposition = atoi(&pstr[1]);
+ } else {
+ newposition = atoi(pstr);
+ }
                 break;
         case 'r':
                 replace = atoi(EARGF(usage()));
Received on Wed Dec 26 2012 - 00:05:01 CET

This archive was generated by hypermail 2.3.0 : Wed Dec 26 2012 - 00:12:21 CET