Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/20cfa3d95004
branches:  trunk
changeset: 353195:20cfa3d95004
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Apr 23 02:01:59 2017 +0000

description:
merge conflicts
XXX: Does not work; core-dumps!

diffstat:

 external/bsd/tmux/README                     |     2 +
 external/bsd/tmux/dist/array.h               |   120 -
 external/bsd/tmux/dist/client.c              |   108 +-
 external/bsd/tmux/dist/cmd-attach-session.c  |    66 +-
 external/bsd/tmux/dist/cmd-capture-pane.c    |    56 +-
 external/bsd/tmux/dist/cmd-clear-history.c   |    55 -
 external/bsd/tmux/dist/cmd-display-message.c |    26 +-
 external/bsd/tmux/dist/cmd-if-shell.c        |   158 +-
 external/bsd/tmux/dist/cmd-load-buffer.c     |    90 +-
 external/bsd/tmux/dist/cmd-new-session.c     |   128 +-
 external/bsd/tmux/dist/cmd-new-window.c      |    50 +-
 external/bsd/tmux/dist/cmd-paste-buffer.c    |    15 +-
 external/bsd/tmux/dist/cmd-queue.c           |     2 +-
 external/bsd/tmux/dist/cmd-send-keys.c       |    87 +-
 external/bsd/tmux/dist/cmd-show-messages.c   |    56 +-
 external/bsd/tmux/dist/cmd-split-window.c    |    76 +-
 external/bsd/tmux/dist/cmd-string.c          |   132 +-
 external/bsd/tmux/dist/cmd-wait-for.c        |   134 +-
 external/bsd/tmux/dist/colour.c              |   389 +----
 external/bsd/tmux/dist/compat/b64_ntop.c     |   182 --
 external/bsd/tmux/dist/compat/imsg-buffer.c  |    10 +-
 external/bsd/tmux/dist/compat/imsg.c         |    76 +-
 external/bsd/tmux/dist/compat/openat.c       |    65 -
 external/bsd/tmux/dist/environ.c             |    89 +-
 external/bsd/tmux/dist/format.c              |   392 +++-
 external/bsd/tmux/dist/grid.c                |   352 +++-
 external/bsd/tmux/dist/hooks.c               |    86 +-
 external/bsd/tmux/dist/input-keys.c          |    54 +-
 external/bsd/tmux/dist/input.c               |   498 ++++--
 external/bsd/tmux/dist/job.c                 |    15 +-
 external/bsd/tmux/dist/key-bindings.c        |   183 ++-
 external/bsd/tmux/dist/log.c                 |     2 +
 external/bsd/tmux/dist/mode-key.c            |   626 --------
 external/bsd/tmux/dist/notify.c              |     2 +-
 external/bsd/tmux/dist/options.c             |   658 +++++++-
 external/bsd/tmux/dist/paste.c               |    53 +-
 external/bsd/tmux/dist/proc.c                |     7 +-
 external/bsd/tmux/dist/screen-write.c        |   859 ++++++++---
 external/bsd/tmux/dist/screen.c              |    70 +-
 external/bsd/tmux/dist/server-client.c       |   621 ++++++-
 external/bsd/tmux/dist/server-fn.c           |    97 +-
 external/bsd/tmux/dist/session.c             |   167 +-
 external/bsd/tmux/dist/status.c              |   814 +++++++----
 external/bsd/tmux/dist/tmux.1                |   681 +++++---
 external/bsd/tmux/dist/tmux.c                |    74 +-
 external/bsd/tmux/dist/tmux.h                |   980 ++++++-------
 external/bsd/tmux/dist/tty-acs.c             |     6 +-
 external/bsd/tmux/dist/tty-keys.c            |   359 +++-
 external/bsd/tmux/dist/tty-term.c            |   172 +-
 external/bsd/tmux/dist/tty.c                 |     4 +-
 external/bsd/tmux/dist/utf8.c                |    84 +-
 external/bsd/tmux/dist/window-copy.c         |  1886 ++++++++++++++-----------
 external/bsd/tmux/dist/window.c              |   315 ++-
 external/bsd/tmux/dist/xmalloc.h             |     3 +-
 external/bsd/tmux/prepare-import.sh          |     9 +-
 external/bsd/tmux/usr.bin/tmux/Makefile      |   372 ++--
 external/bsd/tmux/usr.bin/tmux/utempter.c    |   213 ++
 external/bsd/tmux/usr.bin/tmux/utempter.h    |    46 +
 58 files changed, 7183 insertions(+), 5749 deletions(-)

diffs (truncated from 20859 to 300 lines):

diff -r 256b9d2f8e38 -r 20cfa3d95004 external/bsd/tmux/README
--- a/external/bsd/tmux/README  Sun Apr 23 01:58:48 2017 +0000
+++ b/external/bsd/tmux/README  Sun Apr 23 02:01:59 2017 +0000
@@ -1,3 +1,5 @@
+$NetBSD: README,v 1.3 2017/04/23 02:01:59 christos Exp $
+
 To update tmux to a new version:
 
 - Build the package from pkgsrc and write down all -D flags passed to the
diff -r 256b9d2f8e38 -r 20cfa3d95004 external/bsd/tmux/dist/array.h
--- a/external/bsd/tmux/dist/array.h    Sun Apr 23 01:58:48 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/* $OpenBSD$ */
-
-/*
- * Copyright (c) 2006 Nicholas Marriott <nicholas.marriott%gmail.com@localhost>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
- * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef ARRAY_H
-#define ARRAY_H
-
-#define ARRAY_INITIALIZER { NULL, 0, 0 }
-
-#define ARRAY_DECL(n, c)                                               \
-       struct n {                                                      \
-               c       *list;                                          \
-               u_int    num;                                           \
-               size_t   space;                                         \
-       }
-
-#define ARRAY_ITEM(a, i) ((a)->list[i])
-#define ARRAY_ITEMSIZE(a) (sizeof *(a)->list)
-#define ARRAY_INITIALSPACE(a) (10 * ARRAY_ITEMSIZE(a))
-
-#define ARRAY_ENSURE(a, n) do {                                                \
-       if (UINT_MAX - (n) < (a)->num)                                  \
-               fatalx("number too big");                               \
-       if (SIZE_MAX / ((a)->num + (n)) < ARRAY_ITEMSIZE(a))            \
-               fatalx("size too big");                                 \
-       if ((a)->space == 0) {                                          \
-               (a)->space = ARRAY_INITIALSPACE(a);                     \
-               (a)->list = xrealloc((a)->list, (a)->space);            \
-       }                                                               \
-       while ((a)->space <= ((a)->num + (n)) * ARRAY_ITEMSIZE(a)) {    \
-               (a)->list = xreallocarray((a)->list, 2, (a)->space);    \
-               (a)->space *= 2;                                        \
-       }                                                               \
-} while (0)
-
-#define ARRAY_EMPTY(a) (((void *) (a)) == NULL || (a)->num == 0)
-#define ARRAY_LENGTH(a) ((a)->num)
-#define ARRAY_DATA(a) ((a)->list)
-
-#define ARRAY_FIRST(a) ARRAY_ITEM(a, 0)
-#define ARRAY_LAST(a) ARRAY_ITEM(a, (a)->num - 1)
-
-#define ARRAY_INIT(a) do {                                             \
-       (a)->num = 0;                                                   \
-       (a)->list = NULL;                                               \
-       (a)->space = 0;                                                 \
-} while (0)
-#define ARRAY_CLEAR(a) do {                                            \
-       (a)->num = 0;                                                   \
-} while (0)
-
-#define ARRAY_SET(a, i, s) do {                                                \
-       (a)->list[i] = s;                                               \
-} while (0)
-
-#define ARRAY_ADD(a, s) do {                                           \
-       ARRAY_ENSURE(a, 1);                                             \
-       (a)->list[(a)->num] = s;                                        \
-       (a)->num++;                                                     \
-} while (0)
-#define ARRAY_INSERT(a, i, s) do {                                     \
-       ARRAY_ENSURE(a, 1);                                             \
-       if ((i) < (a)->num) {                                           \
-               memmove((a)->list + (i) + 1, (a)->list + (i),           \
-                   ARRAY_ITEMSIZE(a) * ((a)->num - (i)));              \
-       }                                                               \
-       (a)->list[i] = s;                                               \
-       (a)->num++;                                                     \
-} while (0)
-#define ARRAY_REMOVE(a, i) do {                                                \
-       if ((i) < (a)->num - 1) {                                       \
-               memmove((a)->list + (i), (a)->list + (i) + 1,           \
-                   ARRAY_ITEMSIZE(a) * ((a)->num - (i) - 1));          \
-       }                                                               \
-       (a)->num--;                                                     \
-       if ((a)->num == 0)                                              \
-               ARRAY_FREE(a);                                          \
-} while (0)
-
-#define ARRAY_EXPAND(a, n) do {                                                \
-       ARRAY_ENSURE(a, n);                                             \
-       (a)->num += n;                                                  \
-} while (0)
-#define ARRAY_TRUNC(a, n) do {                                         \
-       if ((a)->num > n)                                               \
-               (a)->num -= n;                                          \
-       else                                                            \
-               ARRAY_FREE(a);                                          \
-} while (0)
-
-#define ARRAY_CONCAT(a, b) do {                                                \
-       ARRAY_ENSURE(a, (b)->num);                                      \
-       memcpy((a)->list + (a)->num, (b)->list, (b)->num * ARRAY_ITEMSIZE(a)); \
-       (a)->num += (b)->num;                                           \
-} while (0)
-
-#define ARRAY_FREE(a) do {                                             \
-       free((a)->list);                                                \
-       ARRAY_INIT(a);                                                  \
-} while (0)
-#define ARRAY_FREEALL(a) do {                                          \
-       ARRAY_FREE(a);                                                  \
-       free(a);                                                        \
-} while (0)
-
-#endif
diff -r 256b9d2f8e38 -r 20cfa3d95004 external/bsd/tmux/dist/client.c
--- a/external/bsd/tmux/dist/client.c   Sun Apr 23 01:58:48 2017 +0000
+++ b/external/bsd/tmux/dist/client.c   Sun Apr 23 02:01:59 2017 +0000
@@ -33,11 +33,11 @@
 
 #include "tmux.h"
 
-struct tmuxproc        *client_proc;
-struct tmuxpeer        *client_peer;
-int             client_flags;
-struct event    client_stdin;
-enum {
+static struct tmuxproc *client_proc;
+static struct tmuxpeer *client_peer;
+static int              client_flags;
+static struct event     client_stdin;
+static enum {
        CLIENT_EXIT_NONE,
        CLIENT_EXIT_DETACHED,
        CLIENT_EXIT_DETACHED_HUP,
@@ -47,29 +47,31 @@
        CLIENT_EXIT_EXITED,
        CLIENT_EXIT_SERVER_EXITED,
 } client_exitreason = CLIENT_EXIT_NONE;
-int             client_exitval;
-enum msgtype    client_exittype;
-const char     *client_exitsession;
-int             client_attached;
+static int              client_exitval;
+static enum msgtype     client_exittype;
+static const char      *client_exitsession;
+static const char      *client_execshell;
+static const char      *client_execcmd;
+static int              client_attached;
 
-__dead void    client_exec(const char *,const char *);
-int            client_get_lock(char *);
-int            client_connect(struct event_base *, const char *, int);
-void           client_send_identify(const char *, const char *);
-void           client_stdin_callback(int, short, void *);
-void           client_write(int, const char *, size_t);
-void           client_signal(int);
-void           client_dispatch(struct imsg *, void *);
-void           client_dispatch_attached(struct imsg *);
-void           client_dispatch_wait(struct imsg *, const char *);
-const char     *client_exit_message(void);
+static __dead void      client_exec(const char *,const char *);
+static int              client_get_lock(char *);
+static int              client_connect(struct event_base *, const char *, int);
+static void             client_send_identify(const char *, const char *);
+static void             client_stdin_callback(int, short, void *);
+static void             client_write(int, const char *, size_t);
+static void             client_signal(int);
+static void             client_dispatch(struct imsg *, void *);
+static void             client_dispatch_attached(struct imsg *);
+static void             client_dispatch_wait(struct imsg *, const char *);
+static const char      *client_exit_message(void);
 
 /*
  * Get server create lock. If already held then server start is happening in
  * another client, so block until the lock is released and return -2 to
  * retry. Return -1 on failure to continue and start the server anyway.
  */
-int
+static int
 client_get_lock(char *lockfile)
 {
        int lockfd;
@@ -96,7 +98,7 @@
 }
 
 /* Connect client to server. */
-int
+static int
 client_connect(struct event_base *base, const char *path, int start_server)
 {
        struct sockaddr_un      sa;
@@ -249,16 +251,13 @@
                 * flag.
                 */
                cmdlist = cmd_list_parse(argc, argv, NULL, 0, &cause);
-               if (cmdlist == NULL) {
-                       fprintf(stderr, "%s\n", cause);
-                       return (1);
+               if (cmdlist != NULL) {
+                       TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
+                               if (cmd->entry->flags & CMD_STARTSERVER)
+                                       cmdflags |= CMD_STARTSERVER;
+                       }
+                       cmd_list_free(cmdlist);
                }
-               cmdflags &= ~CMD_STARTSERVER;
-               TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
-                       if (cmd->entry->flags & CMD_STARTSERVER)
-                               cmdflags |= CMD_STARTSERVER;
-               }
-               cmd_list_free(cmdlist);
        }
 
        /* Create client process structure (starts logging). */
@@ -287,7 +286,6 @@
        if ((ttynam = ttyname(STDIN_FILENO)) == NULL)
                ttynam = "";
 
-#ifdef __OpenBSD__
        /*
         * Drop privileges for client. "proc exec" is needed for -c and for
         * locking (which uses system(3)).
@@ -299,9 +297,10 @@
         */
        if (pledge("stdio unix sendfd proc exec tty", NULL) != 0)
                fatal("pledge failed");
-#endif
 
        /* Free stuff that is not used in the client. */
+       if (ptm_fd != -1)
+               close(ptm_fd);
        options_free(global_options);
        options_free(global_s_options);
        options_free(global_w_options);
@@ -312,8 +311,11 @@
        event_set(&client_stdin, STDIN_FILENO, EV_READ|EV_PERSIST,
            client_stdin_callback, NULL);
        if (client_flags & CLIENT_CONTROLCONTROL) {
-               if (tcgetattr(STDIN_FILENO, &saved_tio) != 0)
-                       fatal("tcgetattr failed");
+               if (tcgetattr(STDIN_FILENO, &saved_tio) != 0) {
+                       fprintf(stderr, "tcgetattr failed: %s\n",
+                           strerror(errno));
+                       return (1);
+               }
                cfmakeraw(&tio);
                tio.c_iflag = ICRNL|IXANY;
                tio.c_oflag = OPOST|ONLCR;
@@ -361,6 +363,14 @@
        /* Start main loop. */
        proc_loop(client_proc, NULL);
 
+       /* Run command if user requested exec, instead of exiting. */
+       if (client_exittype == MSG_EXEC) {
+               if (client_flags & CLIENT_CONTROLCONTROL)
+                       tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio);
+               clear_signals(0);
+               client_exec(client_execshell, client_execcmd);
+       }
+
        /* Print the exit message, if any, and exit. */
        if (client_attached) {
                if (client_exitreason != CLIENT_EXIT_NONE)
@@ -383,7 +393,7 @@
 }
 
 /* Send identify messages to server. */
-void
+static void
 client_send_identify(const char *ttynam, const char *cwd)
 {
        const char       *s;
@@ -420,7 +430,7 @@
 }
 
 /* Callback for client stdin read events. */
-void
+static void
 client_stdin_callback(__unused int fd, __unused short events,
     __unused void *arg)
 {



Home | Main Index | Thread Index | Old Index