Skip to content
Merged
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
12 changes: 8 additions & 4 deletions src/slash.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,8 @@ int slash_refresh(struct slash *slash)

static void slash_insert(struct slash *slash, int c)
{
if (slash->length >= slash->line_size)
/* We need 1 extra byte for the zero termination */
if (slash->length + 1 >= slash->line_size)
return;

memmove(&slash->buffer[slash->cursor + 1],
Expand Down Expand Up @@ -1320,10 +1321,13 @@ static int slash_builtin_echo(struct slash *slash)
{
int i;

for (i = 1; i < slash->argc; i++)
printf("%s ", slash->argv[i]);
for (i = 1; i < slash->argc; i++) {
slash_printf(slash, "%s", slash->argv[i]);
if (i + 1 < slash->argc)
slash_printf(slash, " ");
}

printf("\n");
slash_printf(slash, "\n");

return SLASH_SUCCESS;
}
Expand Down