mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-17 07:12:06 +08:00
system/dd: portability to non-nuttx platforms
while this is not a goal for this repository, it's convenient for me (hopefully for some others too) to be able to build this for other platforms. an obvious downside is to have a few more ifdefs. tested with: ``` /opt/wasi-sdk-25.0/bin/clang -Wall -Oz -s -o dd.wasm dd_main.c ``` Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
This commit is contained in:

committed by
Xiang Xiao

parent
dfd1eb0672
commit
78bae4f14f
@@ -31,7 +31,9 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined(__NuttX__)
|
||||
#include <debug.h>
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@@ -246,11 +248,15 @@ static int dd_verify(FAR struct dd_s *dd)
|
||||
|
||||
if (memcmp(dd->buffer, buffer, dd->nbytes) != 0)
|
||||
{
|
||||
#if defined(__NuttX__)
|
||||
char msg[32];
|
||||
snprintf(msg, sizeof(msg), "infile sector %d", sector);
|
||||
lib_dumpbuffer(msg, dd->buffer, dd->nbytes);
|
||||
snprintf(msg, sizeof(msg), "\noutfile sector %d", sector);
|
||||
lib_dumpbuffer(msg, buffer, dd->nbytes);
|
||||
#else
|
||||
printf("%s: sector %d differs unexpectedly\n", g_dd, sector);
|
||||
#endif
|
||||
ret = ERROR;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user