summaryrefslogtreecommitdiffstats
path: root/tmux.c
Side-by-side diff
Diffstat (limited to 'tmux.c') (more/less context) (ignore whitespace changes)
-rw-r--r--tmux.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/tmux.c b/tmux.c
index 98f0091..ac0e7fb 100644
--- a/tmux.c
+++ b/tmux.c
@@ -53,25 +53,15 @@ 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
@@ -202,13 +192,13 @@ main(int argc, char **argv)
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();
@@ -275,8 +265,6 @@ main(int argc, char **argv)
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);
}
@@ -354,9 +342,4 @@ out:
xmalloc_report(getpid(), "client");
#endif
return (n);
-
-usage:
- usage(&cause, NULL);
- fprintf(stderr, "%s\n", cause);
- exit(1);
}