Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7697

Modified Files:
        cmd-new-session.c tmux.1 
Log Message:
Sync OpenBSD patchset 844:

Support -x and -y for new-session to specify the initial size of the
window if created detached with -d.


Index: cmd-new-session.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-new-session.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- cmd-new-session.c   7 Jan 2011 14:45:34 -0000       1.82
+++ cmd-new-session.c   21 Jan 2011 23:55:26 -0000      1.83
@@ -19,6 +19,7 @@
 #include <sys/types.h>
 
 #include <pwd.h>
+#include <stdlib.h>
 #include <string.h>
 #include <termios.h>
 #include <unistd.h>
@@ -34,8 +35,9 @@
 
 const struct cmd_entry cmd_new_session_entry = {
        "new-session", "new",
-       "dn:s:t:", 0, 1,
-       "[-d] [-n window-name] [-s session-name] [-t target-session] [command]",
+       "dn:s:t:x:y:", 0, 1,
+       "[-d] [-n window-name] [-s session-name] [-t target-session] "
+       "[-x width] [-y height] [command]",
        CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON,
        NULL,
        cmd_new_session_check,
@@ -47,6 +49,9 @@
 {
        if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n')))
                return (-1);
+       if (!args_has(args, 'd') &&
+           (args_has(args, 'x') || args_has(args, 'y')))
+               return (-1);
        return (0);
 }
 
@@ -60,7 +65,7 @@
        struct environ           env;
        struct termios           tio, *tiop;
        struct passwd           *pw;
-       const char              *newname, *target, *update, *cwd;
+       const char              *newname, *target, *update, *cwd, *errstr;
        char                    *overrides, *cmd, *cause;
        int                      detached, idx;
        u_int                    sx, sy, i;
@@ -149,6 +154,22 @@
        if (detached) {
                sx = 80;
                sy = 24;
+               if (args_has(args, 'x')) {
+                       sx = strtonum(
+                           args_get(args, 'x'), 1, USHRT_MAX, &errstr);
+                       if (errstr != NULL) {
+                               ctx->error(ctx, "width %s", errstr);
+                               return (-1);
+                       }
+               }
+               if (args_has(args, 'y')) {
+                       sy = strtonum(
+                           args_get(args, 'y'), 1, USHRT_MAX, &errstr);
+                       if (errstr != NULL) {
+                               ctx->error(ctx, "height %s", errstr);
+                               return (-1);
+                       }
+               }
        } else if (ctx->cmdclient != NULL) {
                sx = ctx->cmdclient->tty.sx;
                sy = ctx->cmdclient->tty.sy;

Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -d -r1.294 -r1.295
--- tmux.1      21 Jan 2011 23:53:45 -0000      1.294
+++ tmux.1      21 Jan 2011 23:55:26 -0000      1.295
@@ -595,6 +595,8 @@
 .Op Fl n Ar window-name
 .Op Fl s Ar session-name
 .Op Fl t Ar target-session
+.Op Fl x Ar width
+.Op Fl y Ar height
 .Op Ar shell-command
 .Xc
 .D1 (alias: Ic new )
@@ -608,6 +610,13 @@
 and
 .Ar shell-command
 are the name of and shell command to execute in the initial window.
+If
+.Fl d
+is used,
+.Fl x
+and
+.Fl y
+specify the size of the initial window (80 by 24 if not given).
 .Pp
 If run from a terminal, any
 .Xr termios 4


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to