Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/tmux/dist Initial import of tmux-1.4:



details:   https://anonhg.NetBSD.org/src/rev/69a488036838
branches:  trunk
changeset: 763096:69a488036838
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Thu Mar 10 09:15:36 2011 +0000

description:
Initial import of tmux-1.4:

tmux is a "terminal multiplexer".  It enables a number of terminals (or
windows) to be accessed and controlled from a single terminal.  tmux is
intended to be a simple, modern, BSD-licensed alternative to programs
such as GNU screen.

The import of tmux is intended to replace window(1) in the not-too-distant
future.  For reference, tmux is also present in the base system of FreeBSD
and OpenBSD.

Approved by core@.

diffstat:

 external/bsd/tmux/dist/array.h                          |   121 +
 external/bsd/tmux/dist/attributes.c                     |    93 +
 external/bsd/tmux/dist/cfg.c                            |   143 +
 external/bsd/tmux/dist/client.c                         |   498 ++
 external/bsd/tmux/dist/clock.c                          |   159 +
 external/bsd/tmux/dist/cmd-attach-session.c             |   110 +
 external/bsd/tmux/dist/cmd-bind-key.c                   |   211 +
 external/bsd/tmux/dist/cmd-break-pane.c                 |    84 +
 external/bsd/tmux/dist/cmd-capture-pane.c               |    83 +
 external/bsd/tmux/dist/cmd-choose-buffer.c              |   146 +
 external/bsd/tmux/dist/cmd-choose-client.c              |   152 +
 external/bsd/tmux/dist/cmd-choose-session.c             |   157 +
 external/bsd/tmux/dist/cmd-choose-window.c              |   181 +
 external/bsd/tmux/dist/cmd-clear-history.c              |    55 +
 external/bsd/tmux/dist/cmd-clock-mode.c                 |    52 +
 external/bsd/tmux/dist/cmd-command-prompt.c             |   270 +
 external/bsd/tmux/dist/cmd-confirm-before.c             |   147 +
 external/bsd/tmux/dist/cmd-copy-buffer.c                |   205 +
 external/bsd/tmux/dist/cmd-copy-mode.c                  |    72 +
 external/bsd/tmux/dist/cmd-delete-buffer.c              |    59 +
 external/bsd/tmux/dist/cmd-detach-client.c              |    52 +
 external/bsd/tmux/dist/cmd-display-message.c            |    66 +
 external/bsd/tmux/dist/cmd-display-panes.c              |    52 +
 external/bsd/tmux/dist/cmd-find-window.c                |   175 +
 external/bsd/tmux/dist/cmd-generic.c                    |   423 ++
 external/bsd/tmux/dist/cmd-has-session.c                |    49 +
 external/bsd/tmux/dist/cmd-if-shell.c                   |   119 +
 external/bsd/tmux/dist/cmd-join-pane.c                  |   257 +
 external/bsd/tmux/dist/cmd-kill-pane.c                  |    76 +
 external/bsd/tmux/dist/cmd-kill-server.c                |    50 +
 external/bsd/tmux/dist/cmd-kill-session.c               |    56 +
 external/bsd/tmux/dist/cmd-kill-window.c                |    53 +
 external/bsd/tmux/dist/cmd-last-pane.c                  |    58 +
 external/bsd/tmux/dist/cmd-last-window.c                |    58 +
 external/bsd/tmux/dist/cmd-link-window.c                |    66 +
 external/bsd/tmux/dist/cmd-list-buffers.c               |    63 +
 external/bsd/tmux/dist/cmd-list-clients.c               |    66 +
 external/bsd/tmux/dist/cmd-list-commands.c              |    50 +
 external/bsd/tmux/dist/cmd-list-keys.c                  |   134 +
 external/bsd/tmux/dist/cmd-list-panes.c                 |    76 +
 external/bsd/tmux/dist/cmd-list-sessions.c              |    71 +
 external/bsd/tmux/dist/cmd-list-windows.c               |    62 +
 external/bsd/tmux/dist/cmd-list.c                       |   150 +
 external/bsd/tmux/dist/cmd-load-buffer.c                |   185 +
 external/bsd/tmux/dist/cmd-lock-client.c                |    53 +
 external/bsd/tmux/dist/cmd-lock-server.c                |    52 +
 external/bsd/tmux/dist/cmd-lock-session.c               |    53 +
 external/bsd/tmux/dist/cmd-move-window.c                |    67 +
 external/bsd/tmux/dist/cmd-new-session.c                |   352 +
 external/bsd/tmux/dist/cmd-new-window.c                 |   236 +
 external/bsd/tmux/dist/cmd-next-layout.c                |    54 +
 external/bsd/tmux/dist/cmd-next-window.c                |    76 +
 external/bsd/tmux/dist/cmd-paste-buffer.c               |   222 +
 external/bsd/tmux/dist/cmd-pipe-pane.c                  |   148 +
 external/bsd/tmux/dist/cmd-previous-layout.c            |    54 +
 external/bsd/tmux/dist/cmd-previous-window.c            |    76 +
 external/bsd/tmux/dist/cmd-refresh-client.c             |    52 +
 external/bsd/tmux/dist/cmd-rename-session.c             |    64 +
 external/bsd/tmux/dist/cmd-rename-window.c              |    59 +
 external/bsd/tmux/dist/cmd-resize-pane.c                |   111 +
 external/bsd/tmux/dist/cmd-respawn-window.c             |    95 +
 external/bsd/tmux/dist/cmd-rotate-window.c              |   124 +
 external/bsd/tmux/dist/cmd-run-shell.c                  |   144 +
 external/bsd/tmux/dist/cmd-save-buffer.c                |    95 +
 external/bsd/tmux/dist/cmd-select-layout.c              |    94 +
 external/bsd/tmux/dist/cmd-select-pane.c                |    94 +
 external/bsd/tmux/dist/cmd-select-window.c              |    69 +
 external/bsd/tmux/dist/cmd-send-keys.c                  |   153 +
 external/bsd/tmux/dist/cmd-send-prefix.c                |    55 +
 external/bsd/tmux/dist/cmd-server-info.c                |   183 +
 external/bsd/tmux/dist/cmd-set-buffer.c                 |    68 +
 external/bsd/tmux/dist/cmd-set-environment.c            |    88 +
 external/bsd/tmux/dist/cmd-set-option.c                 |   569 +++
 external/bsd/tmux/dist/cmd-set-window-option.c          |    47 +
 external/bsd/tmux/dist/cmd-show-buffer.c                |   101 +
 external/bsd/tmux/dist/cmd-show-environment.c           |    67 +
 external/bsd/tmux/dist/cmd-show-messages.c              |    65 +
 external/bsd/tmux/dist/cmd-show-options.c               |    88 +
 external/bsd/tmux/dist/cmd-show-window-options.c        |    50 +
 external/bsd/tmux/dist/cmd-source-file.c                |   131 +
 external/bsd/tmux/dist/cmd-split-window.c               |   266 +
 external/bsd/tmux/dist/cmd-start-server.c               |    45 +
 external/bsd/tmux/dist/cmd-string.c                     |   344 +
 external/bsd/tmux/dist/cmd-suspend-client.c             |    62 +
 external/bsd/tmux/dist/cmd-swap-pane.c                  |   144 +
 external/bsd/tmux/dist/cmd-swap-window.c                |    85 +
 external/bsd/tmux/dist/cmd-switch-client.c              |   216 +
 external/bsd/tmux/dist/cmd-unbind-key.c                 |   163 +
 external/bsd/tmux/dist/cmd-unlink-window.c              |    71 +
 external/bsd/tmux/dist/cmd.c                            |  1127 ++++++
 external/bsd/tmux/dist/colour.c                         |   162 +
 external/bsd/tmux/dist/compat.h                         |   245 +
 external/bsd/tmux/dist/compat/asprintf.c                |    89 +
 external/bsd/tmux/dist/compat/bitstring.h               |   129 +
 external/bsd/tmux/dist/compat/closefrom.c               |   111 +
 external/bsd/tmux/dist/compat/daemon.c                  |    65 +
 external/bsd/tmux/dist/compat/fgetln.c                  |    88 +
 external/bsd/tmux/dist/compat/forkpty-aix.c             |    95 +
 external/bsd/tmux/dist/compat/forkpty-sunos.c           |    89 +
 external/bsd/tmux/dist/compat/getopt.c                  |   117 +
 external/bsd/tmux/dist/compat/imsg-buffer.c             |   303 +
 external/bsd/tmux/dist/compat/imsg.c                    |   271 +
 external/bsd/tmux/dist/compat/imsg.h                    |   110 +
 external/bsd/tmux/dist/compat/queue.h                   |   528 ++
 external/bsd/tmux/dist/compat/setenv.c                  |    49 +
 external/bsd/tmux/dist/compat/strcasestr.c              |    61 +
 external/bsd/tmux/dist/compat/strlcat.c                 |    58 +
 external/bsd/tmux/dist/compat/strlcpy.c                 |    54 +
 external/bsd/tmux/dist/compat/strsep.c                  |    72 +
 external/bsd/tmux/dist/compat/strtonum.c                |    68 +
 external/bsd/tmux/dist/compat/tree.h                    |   739 +++
 external/bsd/tmux/dist/compat/unvis.c                   |   281 +
 external/bsd/tmux/dist/compat/vis.c                     |   220 +
 external/bsd/tmux/dist/compat/vis.h                     |    83 +
 external/bsd/tmux/dist/environ.c                        |   181 +
 external/bsd/tmux/dist/examples/bash_completion_tmux.sh |   105 +
 external/bsd/tmux/dist/examples/h-boetes.conf           |    42 +
 external/bsd/tmux/dist/examples/n-marriott.conf         |   110 +
 external/bsd/tmux/dist/examples/screen-keys.conf        |   102 +
 external/bsd/tmux/dist/examples/t-williams.conf         |   104 +
 external/bsd/tmux/dist/examples/tmux.vim                |   104 +
 external/bsd/tmux/dist/examples/vim-keys.conf           |    36 +
 external/bsd/tmux/dist/grid-utf8.c                      |    96 +
 external/bsd/tmux/dist/grid-view.c                      |   234 +
 external/bsd/tmux/dist/grid.c                           |   545 ++
 external/bsd/tmux/dist/input-keys.c                     |   211 +
 external/bsd/tmux/dist/input.c                          |  1499 ++++++++
 external/bsd/tmux/dist/job.c                            |   236 +
 external/bsd/tmux/dist/key-bindings.c                   |   277 +
 external/bsd/tmux/dist/key-string.c                     |   231 +
 external/bsd/tmux/dist/layout-custom.c                  |   264 +
 external/bsd/tmux/dist/layout-set.c                     |   569 +++
 external/bsd/tmux/dist/layout-string.c                  |   168 +
 external/bsd/tmux/dist/layout.c                         |   683 +++
 external/bsd/tmux/dist/log.c                            |   213 +
 external/bsd/tmux/dist/mode-key.c                       |   465 ++
 external/bsd/tmux/dist/names.c                          |   125 +
 external/bsd/tmux/dist/options.c                        |   201 +
 external/bsd/tmux/dist/osdep-darwin.c                   |    47 +
 external/bsd/tmux/dist/osdep-freebsd.c                  |   129 +
 external/bsd/tmux/dist/osdep-linux.c                    |    59 +
 external/bsd/tmux/dist/osdep-netbsd.c                   |   122 +
 external/bsd/tmux/dist/osdep-openbsd.c                  |   132 +
 external/bsd/tmux/dist/osdep-sunos.c                    |    65 +
 external/bsd/tmux/dist/osdep-unknown.c                  |    27 +
 external/bsd/tmux/dist/paste.c                          |   182 +
 external/bsd/tmux/dist/resize.c                         |   145 +
 external/bsd/tmux/dist/screen-redraw.c                  |   319 +
 external/bsd/tmux/dist/screen-write.c                   |  1163 ++++++
 external/bsd/tmux/dist/screen.c                         |   342 +
 external/bsd/tmux/dist/server-client.c                  |   936 +++++
 external/bsd/tmux/dist/server-fn.c                      |   473 ++
 external/bsd/tmux/dist/server-window.c                  |   238 +
 external/bsd/tmux/dist/server.c                         |   532 ++
 external/bsd/tmux/dist/session.c                        |   553 ++
 external/bsd/tmux/dist/signal.c                         |   103 +
 external/bsd/tmux/dist/status.c                         |  1186 ++++++
 external/bsd/tmux/dist/tmux.1                           |  2778 +++++++++++++++
 external/bsd/tmux/dist/tmux.c                           |   514 ++
 external/bsd/tmux/dist/tmux.h                           |  2032 ++++++++++
 external/bsd/tmux/dist/tty-acs.c                        |    97 +
 external/bsd/tmux/dist/tty-keys.c                       |   627 +++
 external/bsd/tmux/dist/tty-term.c                       |   501 ++
 external/bsd/tmux/dist/tty.c                            |  1456 +++++++
 external/bsd/tmux/dist/utf8.c                           |   340 +
 external/bsd/tmux/dist/window-choose.c                  |   457 ++
 external/bsd/tmux/dist/window-clock.c                   |   124 +
 external/bsd/tmux/dist/window-copy.c                    |  1866 ++++++++++
 external/bsd/tmux/dist/window.c                         |   986 +++++
 external/bsd/tmux/dist/xmalloc.c                        |   144 +
 external/bsd/tmux/dist/xterm-keys.c                     |   201 +
 171 files changed, 41861 insertions(+), 0 deletions(-)

diffs (truncated from 42545 to 300 lines):

diff -r 7e3ef460e8fc -r 69a488036838 external/bsd/tmux/dist/array.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tmux/dist/array.h    Thu Mar 10 09:15:36 2011 +0000
@@ -0,0 +1,121 @@
+/* $Id: array.h,v 1.1.1.1 2011/03/10 09:15:36 jmmv Exp $ */
+
+/*
+ * Copyright (c) 2006 Nicholas Marriott <nicm%users.sourceforge.net@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, 1, (a)->space);         \
+       }                                                               \
+       while ((a)->space <= ((a)->num + (n)) * ARRAY_ITEMSIZE(a)) {    \
+               (a)->list = xrealloc((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 {                                             \
+       if ((a)->list != NULL)                                          \
+               xfree((a)->list);                                       \
+       ARRAY_INIT(a);                                                  \
+} while (0)
+#define ARRAY_FREEALL(a) do {                                          \
+       ARRAY_FREE(a);                                                  \
+       xfree(a);                                                       \
+} while (0)
+
+#endif
diff -r 7e3ef460e8fc -r 69a488036838 external/bsd/tmux/dist/attributes.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tmux/dist/attributes.c       Thu Mar 10 09:15:36 2011 +0000
@@ -0,0 +1,93 @@
+/* $Id: attributes.c,v 1.1.1.1 2011/03/10 09:15:36 jmmv Exp $ */
+
+/*
+ * Copyright (c) 2009 Joshua Elsasser <josh%elsasser.org@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.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "tmux.h"
+
+const char *
+attributes_tostring(u_char attr)
+{
+       static char     buf[128];
+
+       if (attr == 0)
+               return ("none");
+
+       buf[0] = '\0';
+       if (attr & GRID_ATTR_BRIGHT)
+               strlcat(buf, "bright,", sizeof (buf));
+       if (attr & GRID_ATTR_DIM)
+               strlcat(buf, "dim,", sizeof (buf));
+       if (attr & GRID_ATTR_UNDERSCORE)
+               strlcat(buf, "underscore,", sizeof (buf));
+       if (attr & GRID_ATTR_BLINK)
+               strlcat(buf, "blink,", sizeof (buf));
+       if (attr & GRID_ATTR_REVERSE)
+               strlcat(buf, "reverse,", sizeof (buf));
+       if (attr & GRID_ATTR_HIDDEN)
+               strlcat(buf, "hidden,", sizeof (buf));
+       if (attr & GRID_ATTR_ITALICS)
+               strlcat(buf, "italics,", sizeof (buf));
+       if (*buf != '\0')
+               *(strrchr(buf, ',')) = '\0';
+
+       return (buf);
+}
+
+int
+attributes_fromstring(const char *str)
+{
+       const char      delimiters[] = " ,|";
+       u_char          attr;
+       size_t          end;
+
+       if (*str == '\0' || strcspn(str, delimiters) == 0)
+               return (-1);
+       if (strchr(delimiters, str[strlen(str) - 1]) != NULL)
+               return (-1);
+
+       if (strcasecmp(str, "default") == 0 || strcasecmp(str, "none") == 0)
+               return (0);
+
+       attr = 0;
+       do {
+               end = strcspn(str, delimiters);
+               if ((end == 6 && strncasecmp(str, "bright", end) == 0) ||
+                   (end == 4 && strncasecmp(str, "bold", end) == 0))
+                       attr |= GRID_ATTR_BRIGHT;
+               else if (end == 3 && strncasecmp(str, "dim", end) == 0)
+                       attr |= GRID_ATTR_DIM;
+               else if (end == 10 && strncasecmp(str, "underscore", end) == 0)
+                       attr |= GRID_ATTR_UNDERSCORE;
+               else if (end == 5 && strncasecmp(str, "blink", end) == 0)
+                       attr |= GRID_ATTR_BLINK;
+               else if (end == 7 && strncasecmp(str, "reverse", end) == 0)
+                       attr |= GRID_ATTR_REVERSE;
+               else if (end == 6 && strncasecmp(str, "hidden", end) == 0)
+                       attr |= GRID_ATTR_HIDDEN;
+               else if (end == 7 && strncasecmp(str, "italics", end) == 0)
+                       attr |= GRID_ATTR_ITALICS;
+               else
+                       return (-1);
+               str += end + strspn(str + end, delimiters);
+       } while (*str != '\0');
+
+       return (attr);
+}
diff -r 7e3ef460e8fc -r 69a488036838 external/bsd/tmux/dist/cfg.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tmux/dist/cfg.c      Thu Mar 10 09:15:36 2011 +0000
@@ -0,0 +1,143 @@
+/* $Id: cfg.c,v 1.1.1.1 2011/03/10 09:15:36 jmmv Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm%users.sourceforge.net@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.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "tmux.h"
+
+/*
+ * Config file parser. Pretty quick and simple, each line is parsed into a
+ * argv array and executed as a command.
+ */
+
+void printflike2 cfg_print(struct cmd_ctx *, const char *, ...);
+void printflike2 cfg_error(struct cmd_ctx *, const char *, ...);
+
+char                  *cfg_cause;
+int                    cfg_finished;
+struct causelist       cfg_causes = ARRAY_INITIALIZER;
+
+/* ARGSUSED */
+void printflike2
+cfg_print(unused struct cmd_ctx *ctx, unused const char *fmt, ...)
+{
+}
+
+/* ARGSUSED */
+void printflike2
+cfg_error(unused struct cmd_ctx *ctx, const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       xvasprintf(&cfg_cause, fmt, ap);
+       va_end(ap);
+}
+
+void printflike2
+cfg_add_cause(struct causelist *causes, const char *fmt, ...)
+{
+       char    *cause;
+       va_list  ap;
+
+       va_start(ap, fmt);
+       xvasprintf(&cause, fmt, ap);
+       va_end(ap);
+
+       ARRAY_ADD(causes, cause);
+}
+
+/*
+ * Load configuration file. Returns -1 for an error with a list of messages in
+ * causes. Note that causes must be initialised by the caller!
+ */
+int



Home | Main Index | Thread Index | Old Index