summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/main_dd.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libmisc/shell/main_dd.c')
-rw-r--r--cpukit/libmisc/shell/main_dd.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/cpukit/libmisc/shell/main_dd.c b/cpukit/libmisc/shell/main_dd.c
index 1a715303ef..35cd826711 100644
--- a/cpukit/libmisc/shell/main_dd.c
+++ b/cpukit/libmisc/shell/main_dd.c
@@ -335,6 +335,21 @@ getfdtype(rtems_shell_dd_globals* globals, IO *io)
}
static void
+swapbytes(void *v, size_t len)
+{
+ unsigned char *p = v;
+ unsigned char t;
+
+ while (len > 1) {
+ t = p[0];
+ p[0] = p[1];
+ p[1] = t;
+ p += 2;
+ len -= 2;
+ }
+}
+
+static void
dd_in(rtems_shell_dd_globals* globals)
{
ssize_t n;
@@ -431,7 +446,7 @@ dd_in(rtems_shell_dd_globals* globals)
++st.swab;
--n;
}
- swab(in.dbp, in.dbp, (size_t)n);
+ swapbytes(in.dbp, (size_t)n);
}
in.dbp += in.dbrcnt;