diff options
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD$ */ +/* $Id$ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -22,7 +22,6 @@ #include <errno.h> #include <event.h> #include <fcntl.h> -#include <paths.h> #include <pwd.h> #include <stdlib.h> #include <string.h> @@ -30,7 +29,7 @@ #include "tmux.h" -#ifdef DEBUG +#if defined(DEBUG) && defined(__OpenBSD__) extern char *malloc_options; #endif @@ -55,11 +54,15 @@ __dead void usage(void); void parseenvironment(void); char *makesocketpath(const char *); +#ifndef HAVE___PROGNAME +char *__progname = (char *) "tmux"; +#endif + __dead void usage(void) { fprintf(stderr, - "usage: %s [-28lquv] [-c shell-command] [-f file] [-L socket-name]\n" + "usage: %s [-28lquvV] [-c shell-command] [-f file] [-L socket-name]\n" " [-S socket-path] [command [flags]]\n", __progname); exit(1); @@ -237,14 +240,14 @@ main(int argc, char **argv) char *s, *path, *label, *home, **var; int opt, flags, quiet, keys; -#ifdef DEBUG +#if defined(DEBUG) && defined(__OpenBSD__) malloc_options = (char *) "AFGJPX"; #endif quiet = flags = 0; label = path = NULL; login_shell = (**argv == '-'); - while ((opt = getopt(argc, argv, "28c:Cdf:lL:qS:uUv")) != -1) { + while ((opt = getopt(argc, argv, "28c:Cdf:lL:qS:uUvV")) != -1) { switch (opt) { case '2': flags |= IDENTIFY_256COLOURS; @@ -264,6 +267,9 @@ main(int argc, char **argv) else flags |= IDENTIFY_CONTROL; break; + case 'V': + printf("%s %s\n", __progname, VERSION); + exit(0); case 'f': free(cfg_file); cfg_file = xstrdup(optarg); @@ -390,10 +396,12 @@ main(int argc, char **argv) strlcpy(socket_path, path, sizeof socket_path); free(path); +#ifdef HAVE_SETPROCTITLE /* Set process title. */ setproctitle("%s (%s)", __progname, socket_path); +#endif /* Pass control to the client. */ - ev_base = event_init(); + ev_base = osdep_event_init(); exit(client_main(argc, argv, flags)); } |