9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit eff6c097f55b7122e50ef1870f803511c509df16
parent f6a472a46c12f670cd34bcd4d22965bd7ba0cc04
Author: Roberto Vargas <roberto.vargas@arm.com>
Date:   Thu, 25 Apr 2019 11:33:30 +0100

[dlang] Remove duplicated command

do_echo was duplicated in the list of commands. This patch
also adds a new line at the end of the echo command. This
newline is now mandated by the driver protocol.

Change-Id: I623bc45913c87d40a14b62aca44e014393f73076

Diffstat:
Msrc/romfw/dlang.c | 12++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/romfw/dlang.c b/src/romfw/dlang.c @@ -258,7 +258,7 @@ static int do_echo(const struct cmd *cmd, struct args *args) { int fd, i, len, offset, n; - char *s, buffer[LINELEN + 2]; + char *s, buffer[LINELEN]; if ((fd = open(args->argv[1], O_WRITE)) < 0) goto err; @@ -267,10 +267,13 @@ do_echo(const struct cmd *cmd, struct args *args) for (i = 2; i < args->argc; i++) { s = args->argv[i]; len = strlen(s); + if (len + offset >= LINELEN-2) + error("line too long"); memcpy(buffer + offset, s, len); offset += len; buffer[offset++] = ' '; } + buffer[offset] = '\n'; n = write(fd, buffer, offset); if (close(fd) < 0 || n < 0) @@ -415,13 +418,6 @@ static const struct cmd cmds[] = { .helpmsg = "Print this help menu: help", }, { - .name = "cat", - .eval = do_cat, - .min = 2, - .max = 2, - .helpmsg = "Print the content of an entry: cat path", - }, - { .name = "ls", .eval = do_ls, .min = 2,