This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 78bae4f14f242c47dfd65d5d5a1fc83e2f789807
Author: YAMAMOTO Takashi <yamam...@midokura.com>
AuthorDate: Mon Jul 7 13:18:21 2025 +0900

    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 <yamam...@midokura.com>
---
 system/dd/dd_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/system/dd/dd_main.c b/system/dd/dd_main.c
index 4ab595b07..a67698608 100644
--- a/system/dd/dd_main.c
+++ b/system/dd/dd_main.c
@@ -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;
         }

Reply via email to