aboutsummaryrefslogtreecommitdiff
path: root/tmux.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/tmux.c b/tmux.c
index 0b8e6a91..dff7952c 100644
--- a/tmux.c
+++ b/tmux.c
@@ -22,17 +22,16 @@
#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>
+#include <time.h>
#include <unistd.h>
#include "tmux.h"
-#ifdef DEBUG
+#if defined(DEBUG) && defined(__OpenBSD__)
extern char *malloc_options;
#endif
@@ -49,11 +48,15 @@ char socket_path[PATH_MAX];
__dead void usage(void);
char *makesocketpath(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);
@@ -194,7 +197,7 @@ main(int argc, char **argv)
char *s, *path, *label, **var, tmp[PATH_MAX];
int opt, flags, keys;
-#ifdef DEBUG
+#if defined(DEBUG) && defined(__OpenBSD__)
malloc_options = (char *) "AFGJPX";
#endif
@@ -207,7 +210,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;
@@ -222,6 +225,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;
@@ -344,9 +350,11 @@ main(int argc, char **argv)
}
free(path);
+#ifdef HAVE_SETPROCTITLE
/* Set process title. */
setproctitle("%s (%s)", __progname, socket_path);
+#endif
/* Pass control to the client. */
- exit(client_main(event_init(), argc, argv, flags));
+ exit(client_main(osdep_event_init(), argc, argv, flags));
}