aboutsummaryrefslogtreecommitdiff
path: root/tmux.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-03 05:35:51 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-03 05:35:51 +0000
commitf91e7bfd381826eb88edacc7b5766c262a71b033 (patch)
tree13fdab052b3993bb54adb54bc976afe27b666e94 /tmux.c
parenteaee4dc800734a8ccebb78af02440a8e3d7769bd (diff)
downloadrtmux-f91e7bfd381826eb88edacc7b5766c262a71b033.tar.gz
rtmux-f91e7bfd381826eb88edacc7b5766c262a71b033.tar.bz2
rtmux-f91e7bfd381826eb88edacc7b5766c262a71b033.zip
If no command is specified, assume new-session.
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tmux.c b/tmux.c
index ca255b0c..67ff2a58 100644
--- a/tmux.c
+++ b/tmux.c
@@ -1,4 +1,4 @@
-/* $Id: tmux.c,v 1.48 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: tmux.c,v 1.49 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -59,7 +59,7 @@ __dead void
usage(void)
{
fprintf(stderr,
- "usage: %s [-v] [-f file] [-S socket-path] command [flags]",
+ "usage: %s [-v] [-f file] [-S socket-path] [command [flags]]",
__progname);
exit(1);
}
@@ -197,8 +197,6 @@ main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc == 0)
- usage();
log_open(stderr, LOG_USER, debug_level);
siginit();
@@ -264,7 +262,11 @@ main(int argc, char **argv)
}
xasprintf(&default_command, "exec %s", shell);
- if ((cmd = cmd_parse(argc, argv, &cause)) == NULL) {
+ if (argc == 0) {
+ cmd = xmalloc(sizeof *cmd);
+ cmd->entry = &cmd_new_session_entry;
+ cmd->entry->init(&cmd->data, 0);
+ } else if ((cmd = cmd_parse(argc, argv, &cause)) == NULL) {
log_warnx("%s", cause);
exit(1);
}