Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ dist_tmux_SOURCES = \
cmd-display-menu.c \
cmd-display-message.c \
cmd-display-panes.c \
cmd-echo.c \
cmd-find-window.c \
cmd-find.c \
cmd-if-shell.c \
Expand Down
31 changes: 31 additions & 0 deletions cmd-echo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <sys/types.h>

#include <stdlib.h>
#include <unistd.h>

#include "tmux.h"

static enum cmd_retval cmd_echo_exec(struct cmd *, struct cmdq_item *);

const struct cmd_entry cmd_echo_entry = {
.name = "echo",
.alias = NULL,

.args = { "", 1, 1, NULL },
.usage = "[message-to-echo]",

.flags = 0,
.exec = cmd_echo_exec
};

static enum cmd_retval cmd_echo_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
const char *s = args_string(args, 0);

if(s == NULL)
return (CMD_RETURN_ERROR);

cmdq_print(item, "%s", s);
return (CMD_RETURN_NORMAL);
}
2 changes: 2 additions & 0 deletions cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extern const struct cmd_entry cmd_display_message_entry;
extern const struct cmd_entry cmd_display_popup_entry;
extern const struct cmd_entry cmd_display_panes_entry;
extern const struct cmd_entry cmd_down_pane_entry;
extern const struct cmd_entry cmd_echo_entry;
extern const struct cmd_entry cmd_find_window_entry;
extern const struct cmd_entry cmd_has_session_entry;
extern const struct cmd_entry cmd_if_shell_entry;
Expand Down Expand Up @@ -141,6 +142,7 @@ const struct cmd_entry *cmd_table[] = {
&cmd_display_message_entry,
&cmd_display_popup_entry,
&cmd_display_panes_entry,
&cmd_echo_entry,
&cmd_find_window_entry,
&cmd_has_session_entry,
&cmd_if_shell_entry,
Expand Down