Skip to content

Commit 78bae4f

Browse files
yamtxiaoxiang781216
authored andcommitted
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 <[email protected]>
1 parent dfd1eb0 commit 78bae4f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

system/dd/dd_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
#include <sys/types.h>
3232
#include <sys/stat.h>
3333

34+
#if defined(__NuttX__)
3435
#include <debug.h>
36+
#endif
3537
#include <inttypes.h>
3638
#include <stdint.h>
3739
#include <stdbool.h>
@@ -246,11 +248,15 @@ static int dd_verify(FAR struct dd_s *dd)
246248

247249
if (memcmp(dd->buffer, buffer, dd->nbytes) != 0)
248250
{
251+
#if defined(__NuttX__)
249252
char msg[32];
250253
snprintf(msg, sizeof(msg), "infile sector %d", sector);
251254
lib_dumpbuffer(msg, dd->buffer, dd->nbytes);
252255
snprintf(msg, sizeof(msg), "\noutfile sector %d", sector);
253256
lib_dumpbuffer(msg, buffer, dd->nbytes);
257+
#else
258+
printf("%s: sector %d differs unexpectedly\n", g_dd, sector);
259+
#endif
254260
ret = ERROR;
255261
break;
256262
}

0 commit comments

Comments
 (0)