diff --git a/source/shell/mufs.c b/source/shell/mufs.c index aa87ebd..6a8cd8d 100644 --- a/source/shell/mufs.c +++ b/source/shell/mufs.c @@ -205,18 +205,9 @@ int shell_write(struct console *con, size_t argc, const char **argv) return -1; } -#if CONFIG_USER_ECHO - fprintf(con->fp, "> "); -#endif - - while ((ret = console_read(con, data, sizeof data)) > 0) { + if ((ret = console_read(con, data, sizeof data)) > 0) mufs_write(file, data, ret); -#if CONFIG_USER_ECHO - fprintf(con->fp, "\n> "); -#endif - } - mufs_close(file); return 0; @@ -224,12 +215,12 @@ int shell_write(struct console *con, size_t argc, const char **argv) int shell_append(struct console *con, size_t argc, const char **argv) { - struct mufs_file *file; char data[256]; - size_t n; + struct mufs_file *file; + ssize_t ret; - if (argc < 2) { - fprintf(con->fp, "usage: mufs append \n"); + if (argc < 1) { + fprintf(con->fp, "usage: mufs append \n"); return -1; } @@ -243,13 +234,9 @@ int shell_append(struct console *con, size_t argc, const char **argv) return -1; } - n = strlen(argv[1]); - - memcpy(data, argv[1], n); - data[n] = '\n'; - data[n + 1] = '\0'; + if ((ret = console_read(con, data, sizeof data)) > 0) + mufs_write(file, data, ret); - mufs_write(file, data, n + 1); mufs_close(file); return 0;