diff -r 71cf9456e6ec tabbed.1 --- a/tabbed.1 Sat Oct 13 06:57:32 2012 +0200 +++ b/tabbed.1 Mon Nov 05 16:52:09 2012 -0500 @@ -9,6 +9,8 @@ .RB [ \-v ] .RB [ \-n .IR name ] +.RB [ \-r +.IR narg ] .IR [ command ... ] .SH DESCRIPTION .B tabbed @@ -32,6 +34,13 @@ .B \-s will disable automatic spawning of the command. .TP +.BI \-r " narg" +will replace the +.I narg +th argument in +.I command +with the window id, rather than appending it to the end. +.TP .B \-v prints version information to stderr, then exits. .SH USAGE @@ -61,4 +70,6 @@ $ tabbed xterm -into .TP $ $(tabbed -d >/tmp/tabbed.xid); urxvt -embed $(0)?replace:argc] = winid; + cmd[argc+!(replace>0)] = NULL; } void @@ -888,12 +888,12 @@ void usage(void) { - die("usage: %s [-dhsv] [-n name] command...\n", argv0); + die("usage: %s [-dhsv] [-r narg][-n name] command...\n", argv0); } int main(int argc, char *argv[]) { - int detach = 0; + int replace = 0, detach = 0; ARGBEGIN { case 'd': @@ -905,6 +905,9 @@ case 's': doinitspawn = False; break; + case 'r': + replace = atoi(EARGF(usage())); + break; case 'v': die("tabbed-"VERSION", © 2009-2012" " tabbed engineers, see LICENSE" @@ -917,7 +920,7 @@ if(argc < 1) doinitspawn = False; - setcmd(argc, argv); + setcmd(argc, argv, replace); if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) fprintf(stderr, "tabbed: no locale support\n");