diff options
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -23,9 +23,7 @@ #include <errno.h> #include <event.h> #include <fcntl.h> -#include <getopt.h> #include <locale.h> -#include <paths.h> #include <pwd.h> #include <stdlib.h> #include <string.h> @@ -34,6 +32,10 @@ #include "tmux.h" +#if defined(DEBUG) && defined(__OpenBSD__) +extern char *malloc_options; +#endif + struct options *global_options; /* server options */ struct options *global_s_options; /* session options */ struct options *global_w_options; /* window options */ @@ -46,11 +48,15 @@ const char *socket_path; __dead void usage(void); static char *make_label(const char *); +#ifndef HAVE___PROGNAME +char *__progname = (char *) "tmux"; +#endif + __dead void usage(void) { fprintf(stderr, - "usage: %s [-2Cluv] [-c shell-command] [-f file] [-L socket-name]\n" + "usage: %s [-2CluvV] [-c shell-command] [-f file] [-L socket-name]\n" " [-S socket-path] [command [flags]]\n", __progname); exit(1); @@ -188,6 +194,10 @@ main(int argc, char **argv) const char *s; int opt, flags, keys; +#if defined(DEBUG) && defined(__OpenBSD__) + malloc_options = (char *) "AFGJPX"; +#endif + setlocale(LC_TIME, ""); tzset(); @@ -197,7 +207,7 @@ main(int argc, char **argv) flags = 0; label = path = NULL; - while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUv")) != -1) { + while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUVv")) != -1) { switch (opt) { case '2': flags |= CLIENT_256COLOURS; @@ -212,6 +222,9 @@ main(int argc, char **argv) else flags |= CLIENT_CONTROL; break; + case 'V': + printf("%s %s\n", __progname, VERSION); + exit(0); case 'f': set_cfg_file(optarg); break; @@ -244,9 +257,11 @@ main(int argc, char **argv) if (shellcmd != NULL && argc != 0) usage(); +#ifdef __OpenBSD__ if (pledge("stdio rpath wpath cpath flock fattr unix getpw sendfd " "recvfd proc exec tty ps", NULL) != 0) err(1, "pledge"); +#endif /* * tmux is a UTF-8 terminal, so if TMUX is set, assume UTF-8. |