Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/tmux resolve conflicts



details:   https://anonhg.NetBSD.org/src/rev/ac73cee4b4eb
branches:  trunk
changeset: 838171:ac73cee4b4eb
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 05 21:44:40 2019 +0000

description:
resolve conflicts

diffstat:

 external/bsd/tmux/dist/client.c              |   16 +-
 external/bsd/tmux/dist/cmd-attach-session.c  |    1 +
 external/bsd/tmux/dist/cmd-display-message.c |   16 +-
 external/bsd/tmux/dist/cmd-if-shell.c        |   12 +-
 external/bsd/tmux/dist/cmd-load-buffer.c     |   22 +-
 external/bsd/tmux/dist/cmd-new-session.c     |   73 ++-
 external/bsd/tmux/dist/cmd-new-window.c      |   30 +-
 external/bsd/tmux/dist/cmd-send-keys.c       |    5 +-
 external/bsd/tmux/dist/cmd-split-window.c    |   26 +-
 external/bsd/tmux/dist/compat/imsg-buffer.c  |   14 +-
 external/bsd/tmux/dist/compat/imsg.c         |    6 +-
 external/bsd/tmux/dist/format.c              |  153 +++++--
 external/bsd/tmux/dist/grid.c                |  522 ++++++++++++++++++---------
 external/bsd/tmux/dist/hooks.c               |   27 -
 external/bsd/tmux/dist/input.c               |  471 ++++++++++++++---------
 external/bsd/tmux/dist/job.c                 |    3 +-
 external/bsd/tmux/dist/key-bindings.c        |   64 ++-
 external/bsd/tmux/dist/mode-tree.c           |  161 +++++--
 external/bsd/tmux/dist/notify.c              |   22 +-
 external/bsd/tmux/dist/screen-write.c        |  103 ++++-
 external/bsd/tmux/dist/screen.c              |  149 +++++-
 external/bsd/tmux/dist/server-client.c       |  101 +++--
 external/bsd/tmux/dist/server-fn.c           |   50 ++-
 external/bsd/tmux/dist/session.c             |   23 +-
 external/bsd/tmux/dist/status.c              |  127 ++++--
 external/bsd/tmux/dist/tmux.1                |  174 +++++++-
 external/bsd/tmux/dist/tmux.c                |   43 +-
 external/bsd/tmux/dist/tmux.h                |  169 ++++----
 external/bsd/tmux/dist/tty-keys.c            |  116 +++--
 external/bsd/tmux/dist/tty-term.c            |   13 +-
 external/bsd/tmux/dist/tty.c                 |  157 ++++---
 external/bsd/tmux/dist/window-buffer.c       |   85 ++--
 external/bsd/tmux/dist/window-client.c       |   81 +--
 external/bsd/tmux/dist/window-copy.c         |  289 ++++++++------
 external/bsd/tmux/dist/window-tree.c         |  363 +++++++++++++++---
 external/bsd/tmux/dist/window.c              |   40 +-
 external/bsd/tmux/usr.bin/tmux/Makefile      |   11 +-
 37 files changed, 2398 insertions(+), 1340 deletions(-)

diffs (truncated from 7617 to 300 lines):

diff -r 7f73d1f09e26 -r ac73cee4b4eb external/bsd/tmux/dist/client.c
--- a/external/bsd/tmux/dist/client.c   Sat Jan 05 21:32:48 2019 +0000
+++ b/external/bsd/tmux/dist/client.c   Sat Jan 05 21:44:40 2019 +0000
@@ -17,11 +17,10 @@
  */
 
 #include <sys/types.h>
-#include <sys/file.h>
 #include <sys/socket.h>
-#include <sys/stat.h>
 #include <sys/un.h>
 #include <sys/wait.h>
+#include <sys/file.h>
 
 #include <errno.h>
 #include <event.h>
@@ -278,10 +277,10 @@
        client_peer = proc_add_peer(client_proc, fd, client_dispatch, NULL);
 
        /* Save these before pledge(). */
-       if ((cwd = getcwd(path, sizeof path)) == NULL) {
-               if ((cwd = find_home()) == NULL)
-                       cwd = "/";
-       }
+       if ((cwd = getenv("PWD")) == NULL &&
+           (cwd = getcwd(path, sizeof path)) == NULL &&
+           (cwd = find_home()) == NULL)
+               cwd = "/";
        if ((ttynam = ttyname(STDIN_FILENO)) == NULL)
                ttynam = "";
 
@@ -338,6 +337,10 @@
                size = 0;
                for (i = 0; i < argc; i++)
                        size += strlen(argv[i]) + 1;
+               if (size > MAX_IMSGSIZE - (sizeof *data)) {
+                       fprintf(stderr, "command too long\n");
+                       return (1);
+               }
                data = xmalloc((sizeof *data) + size);
 
                /* Prepare command for server. */
@@ -449,6 +452,7 @@
 {
        ssize_t used;
 
+       log_debug("%s: %.*s", __func__, (int)size, data);
        while (size != 0) {
                used = write(fd, data, size);
                if (used == -1) {
diff -r 7f73d1f09e26 -r ac73cee4b4eb external/bsd/tmux/dist/cmd-attach-session.c
--- a/external/bsd/tmux/dist/cmd-attach-session.c       Sat Jan 05 21:32:48 2019 +0000
+++ b/external/bsd/tmux/dist/cmd-attach-session.c       Sat Jan 05 21:44:40 2019 +0000
@@ -100,6 +100,7 @@
                s->cwd = format_single(item, cflag, c, s, wl, wp);
        }
 
+       c->last_session = c->session;
        if (c->session != NULL) {
                if (dflag) {
                        TAILQ_FOREACH(c_loop, &clients, entry) {
diff -r 7f73d1f09e26 -r ac73cee4b4eb external/bsd/tmux/dist/cmd-display-message.c
--- a/external/bsd/tmux/dist/cmd-display-message.c      Sat Jan 05 21:32:48 2019 +0000
+++ b/external/bsd/tmux/dist/cmd-display-message.c      Sat Jan 05 21:44:40 2019 +0000
@@ -53,7 +53,7 @@
 cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
 {
        struct args             *args = self->args;
-       struct client           *c;
+       struct client           *c, *target_c;
        struct session          *s = item->target.s;
        struct winlink          *wl = item->target.wl;
        struct window_pane      *wp = item->target.wp;
@@ -65,7 +65,6 @@
                cmdq_error(item, "only one of -F or argument must be given");
                return (CMD_RETURN_ERROR);
        }
-       c = cmd_find_client(item, args_get(args, 'c'), 1);
 
        template = args_get(args, 'F');
        if (args->argc != 0)
@@ -73,8 +72,19 @@
        if (template == NULL)
                template = DISPLAY_MESSAGE_TEMPLATE;
 
+       /*
+        * -c is intended to be the client where the message should be
+        * displayed if -p is not given. But it makes sense to use it for the
+        * formats too, assuming it matches the session. If it doesn't, use the
+        * best client for the session.
+        */
+       c = cmd_find_client(item, args_get(args, 'c'), 1);
+       if (c != NULL && c->session == s)
+               target_c = c;
+       else
+               target_c = cmd_find_best_client(s);
        ft = format_create(item->client, item, FORMAT_NONE, 0);
-       format_defaults(ft, c, s, wl, wp);
+       format_defaults(ft, target_c, s, wl, wp);
 
        msg = format_expand_time(ft, template, time(NULL));
        if (args_has(self->args, 'p'))
diff -r 7f73d1f09e26 -r ac73cee4b4eb external/bsd/tmux/dist/cmd-if-shell.c
--- a/external/bsd/tmux/dist/cmd-if-shell.c     Sat Jan 05 21:32:48 2019 +0000
+++ b/external/bsd/tmux/dist/cmd-if-shell.c     Sat Jan 05 21:44:40 2019 +0000
@@ -73,14 +73,6 @@
        struct session                  *s = item->target.s;
        struct winlink                  *wl = item->target.wl;
        struct window_pane              *wp = item->target.wp;
-       const char                      *cwd;
-
-       if (item->client != NULL && item->client->session == NULL)
-               cwd = item->client->cwd;
-       else if (s != NULL)
-               cwd = s->cwd;
-       else
-               cwd = NULL;
 
        shellcmd = format_single(item, args->argv[0], c, s, wl, wp);
        if (args_has(args, 'F')) {
@@ -128,8 +120,8 @@
                cdata->item = NULL;
        memcpy(&cdata->mouse, &shared->mouse, sizeof cdata->mouse);
 
-       job_run(shellcmd, s, cwd, NULL, cmd_if_shell_callback,
-           cmd_if_shell_free, cdata);
+       job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL,
+           cmd_if_shell_callback, cmd_if_shell_free, cdata, 0);
        free(shellcmd);
 
        if (args_has(args, 'b'))
diff -r 7f73d1f09e26 -r ac73cee4b4eb external/bsd/tmux/dist/cmd-load-buffer.c
--- a/external/bsd/tmux/dist/cmd-load-buffer.c  Sat Jan 05 21:32:48 2019 +0000
+++ b/external/bsd/tmux/dist/cmd-load-buffer.c  Sat Jan 05 21:44:40 2019 +0000
@@ -56,10 +56,14 @@
 {
        struct args                     *args = self->args;
        struct cmd_load_buffer_data     *cdata;
-       struct client                   *c = item->client;
+       struct client                   *c = cmd_find_client(item, NULL, 1);
+       struct session                  *s = item->target.s;
+       struct winlink                  *wl = item->target.wl;
+       struct window_pane              *wp = item->target.wp;
        FILE                            *f;
-       const char                      *path, *bufname;
-       char                            *pdata, *new_pdata, *cause, *file;
+       const char                      *bufname;
+       char                            *pdata = NULL, *new_pdata, *cause;
+       char                            *path, *file;
        size_t                           psize;
        int                              ch, error;
 
@@ -67,8 +71,11 @@
        if (args_has(args, 'b'))
                bufname = args_get(args, 'b');
 
-       path = args->argv[0];
+       path = format_single(item, args->argv[0], c, s, wl, wp);
        if (strcmp(path, "-") == 0) {
+               free(path);
+               c = item->client;
+
                cdata = xcalloc(1, sizeof *cdata);
                cdata->item = item;
 
@@ -78,7 +85,7 @@
                error = server_set_stdin_callback(c, cmd_load_buffer_callback,
                    cdata, &cause);
                if (error != 0) {
-                       cmdq_error(item, "%s: %s", path, cause);
+                       cmdq_error(item, "-: %s", cause);
                        free(cause);
                        return (CMD_RETURN_ERROR);
                }
@@ -86,11 +93,12 @@
        }
 
        file = server_client_get_path(c, path);
+       free(path);
+
        f = fopen(file, "rb");
        if (f == NULL) {
                cmdq_error(item, "%s: %s", file, strerror(errno));
-               free(file);
-               return (CMD_RETURN_ERROR);
+               goto error;
        }
 
        pdata = NULL;
diff -r 7f73d1f09e26 -r ac73cee4b4eb external/bsd/tmux/dist/cmd-new-session.c
--- a/external/bsd/tmux/dist/cmd-new-session.c  Sat Jan 05 21:32:48 2019 +0000
+++ b/external/bsd/tmux/dist/cmd-new-session.c  Sat Jan 05 21:44:40 2019 +0000
@@ -73,14 +73,15 @@
        struct environ          *env;
        struct termios           tio, *tiop;
        struct session_group    *sg;
-       const char              *newname, *errstr, *template, *group, *prefix;
-       const char              *path, *cmd, *cwd;
-       char                   **argv, *cause, *cp, *to_free = NULL;
+       const char              *errstr, *template, *group, *prefix;
+       const char              *path, *cmd, *tmp;
+       char                   **argv, *cause, *cp, *newname, *cwd = NULL;
        int                      detached, already_attached, idx, argc;
        int                      is_control = 0;
        u_int                    sx, sy;
        struct environ_entry    *envent;
        struct cmd_find_state    fs;
+       enum cmd_retval          retval;
 
        if (self->entry == &cmd_has_session_entry) {
                /*
@@ -95,20 +96,24 @@
                return (CMD_RETURN_ERROR);
        }
 
-       newname = args_get(args, 's');
-       if (newname != NULL) {
+       newname = NULL;
+       if (args_has(args, 's')) {
+               newname = format_single(item, args_get(args, 's'), c, NULL,
+                   NULL, NULL);
                if (!session_check_name(newname)) {
                        cmdq_error(item, "bad session name: %s", newname);
-                       return (CMD_RETURN_ERROR);
+                       goto error;
                }
                if ((as = session_find(newname)) != NULL) {
                        if (args_has(args, 'A')) {
-                               return (cmd_attach_session(item,
+                               retval = cmd_attach_session(item,
                                    newname, args_has(args, 'D'),
-                                   0, NULL, args_has(args, 'E')));
+                                   0, NULL, args_has(args, 'E'));
+                               free(newname);
+                               return (retval);
                        }
                        cmdq_error(item, "duplicate session: %s", newname);
-                       return (CMD_RETURN_ERROR);
+                       goto error;
                }
        }
 
@@ -149,14 +154,10 @@
                already_attached = 1;
 
        /* Get the new session working directory. */
-       if (args_has(args, 'c')) {
-               cwd = args_get(args, 'c');
-               to_free = format_single(item, cwd, c, NULL, NULL, NULL);
-               cwd = to_free;
-       } else if (c != NULL && c->session == NULL && c->cwd != NULL)
-               cwd = c->cwd;
+       if ((tmp = args_get(args, 'c')) != NULL)
+               cwd = format_single(item, tmp, c, NULL, NULL, NULL);
        else
-               cwd = ".";
+               cwd = xstrdup(server_client_get_cwd(c, NULL));
 
        /*
         * If this is a new client, check for nesting and save the termios
@@ -201,17 +202,29 @@
                sy = 24;
        }
        if ((is_control || detached) && args_has(args, 'x')) {
-               sx = strtonum(args_get(args, 'x'), 1, USHRT_MAX, &errstr);
-               if (errstr != NULL) {
-                       cmdq_error(item, "width %s", errstr);
-                       goto error;
+               tmp = args_get(args, 'x');
+               if (strcmp(tmp, "-") == 0) {
+                       if (c != NULL)
+                               sx = c->tty.sx;
+               } else {
+                       sx = strtonum(tmp, 1, USHRT_MAX, &errstr);
+                       if (errstr != NULL) {
+                               cmdq_error(item, "width %s", errstr);
+                               goto error;
+                       }
                }
        }
        if ((is_control || detached) && args_has(args, 'y')) {
-               sy = strtonum(args_get(args, 'y'), 1, USHRT_MAX, &errstr);
-               if (errstr != NULL) {
-                       cmdq_error(item, "height %s", errstr);
-                       goto error;
+               tmp = args_get(args, 'y');
+               if (strcmp(tmp, "-") == 0) {
+                       if (c != NULL)
+                               sy = c->tty.sy;
+               } else {
+                       sy = strtonum(tmp, 1, USHRT_MAX, &errstr);
+                       if (errstr != NULL) {
+                               cmdq_error(item, "height %s", errstr);
+                               goto error;
+                       }
                }
        }
        if (sx == 0)
@@ -261,10 +274,12 @@
        }



Home | Main Index | Thread Index | Old Index