summaryrefslogtreecommitdiffstats
path: root/tmux.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/tmux.c b/tmux.c
index 98f0091d..ac0e7fbd 100644
--- a/tmux.c
+++ b/tmux.c
@@ -50,31 +50,21 @@ int debug_level;
int prefix_key = META;
u_char status_colour;
u_int history_limit;
u_int status_lines;
void sighandler(int);
+__dead void usage(void);
-void
-usage(char **ptr, const char *fmt, ...)
+__dead void
+usage(void)
{
- char *msg;
- va_list ap;
-
-#define USAGE "usage: %s [-v] [-f file] [-S socket-path]"
- if (fmt == NULL) {
- xasprintf(ptr, USAGE " command [flags]", __progname);
- } else {
- va_start(ap, fmt);
- xvasprintf(&msg, fmt, ap);
- va_end(ap);
-
- xasprintf(ptr, USAGE " %s", __progname, msg);
- xfree(msg);
- }
-#undef USAGE
+ fprintf(stderr,
+ "usage: %s [-v] [-f file] [-S socket-path] command [flags]",
+ __progname);
+ exit(1);
}
void
logfile(const char *name)
{
FILE *f;
@@ -199,19 +189,19 @@ main(int argc, char **argv)
debug_level++;
break;
case 'V':
printf("%s " BUILD "\n", __progname);
exit(0);
default:
- goto usage;
+ usage();
}
}
argc -= optind;
argv += optind;
if (argc == 0)
- goto usage;
+ usage();
log_open(stderr, LOG_USER, debug_level);
siginit();
status_lines = 1;
status_colour = 0x02;
@@ -272,14 +262,12 @@ main(int argc, char **argv)
if (shell == NULL || *shell == '\0')
shell = _PATH_BSHELL;
}
xasprintf(&default_command, "exec %s", shell);
if ((cmd = cmd_parse(argc, argv, &cause)) == NULL) {
- if (cause == NULL)
- goto usage;
log_warnx("%s", cause);
exit(1);
}
memset(&cctx, 0, sizeof cctx);
client_fill_session(&data);
@@ -351,12 +339,7 @@ out:
buffer_destroy(cctx.srv_out);
#ifdef DEBUG
xmalloc_report(getpid(), "client");
#endif
return (n);
-
-usage:
- usage(&cause, NULL);
- fprintf(stderr, "%s\n", cause);
- exit(1);
}