Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/CommandParser/cmd.cpp
- Revision:
- 109:bb4ef6a4bd0a
- Parent:
- 102:715f754cf5a8
- Child:
- 111:d31b3a347e6a
--- a/src/CommandParser/cmd.cpp Thu Sep 22 12:15:24 2016 +0000 +++ b/src/CommandParser/cmd.cpp Thu Sep 22 14:47:35 2016 +0000 @@ -153,13 +153,16 @@ printf("\rusage: cat <filename>\n"); return; } - char data_buf[1024]; - bool rc = GLOBAL_mdot->readUserFile(argv[1], data_buf, sizeof(data_buf)); - if ( rc != true ) { - printf("\rFailed to read %s\n", argv[1]); + char *data_buf; + + mDot::mdot_file file = GLOBAL_mdot->openUserFile(argv[1], mDot::FM_RDONLY); + if ( file.fd < 0 ) { return; } + data_buf = (char *)malloc(file.size); + bool rc = GLOBAL_mdot->readUserFile(argv[1], data_buf, (file.size)); printf("%s\n", data_buf); + free(data_buf); } /***************************************************************************** * Function: cmd_help