commit - 36bb28dc638bb3091e05996156b5fbecbc67dcd5
commit + 01e3847b7e6ff87f72a34a42cd98425e569250f6
blob - 10307aa0b2c95df072b080987a3a7e950b6d2d11
blob + 9d43a750822b54900fac724b8eebb4cbc41fd8b0
--- man/man1/xd.1
+++ man/man1/xd.1
.B -s
Reverse (swab) the order of bytes in each group of 4 before printing.
.TP
+.B -S
+Reverse the order of bytes in each group of 8 before printing.
+.TP
.B -r
Print repeating groups of identical 16-byte sequences as the first group
followed by an asterisk.
blob - 3e8ba5d334b0351950d296a4a1946b7aa3c66bd7
blob + 7be55b21043263e339b9b74ded227dadf57afc3e
--- src/cmd/xd.c
+++ src/cmd/xd.c
unsigned long addr;
int repeats;
int swizzle;
+int swizzle8;
int flush;
int abase=2;
int xd(char *, int);
goto Usage;
continue;
}
+ if(argv[0][0] == 'S'){
+ swizzle8 = 1;
+ if(argv[0][1])
+ goto Usage;
+ continue;
+ }
if(argv[0][0] == 'u'){
flush = 1;
if(argv[0][1])
data[i] = 0;
if(swizzle)
swizz();
+ if(swizzle8)
+ swizz8();
if(ndata==16 && repeats){
if(addr>0 && data[0]==odata[0]){
for(i=1; i<16; i++)
p[3] = q[0];
p += 4;
q += 4;
+ }
+}
+
+void
+swizz8(void)
+{
+ uchar *p, *q;
+ int i;
+ uchar swdata[16];
+
+ p = data;
+ q = swdata;
+ for(i=0; i<16; i++)
+ *q++ = *p++;
+ p = data;
+ q = swdata;
+ for(i=0; i<8; i++){
+ p[0] = q[7];
+ p[1] = q[6];
+ p[2] = q[5];
+ p[3] = q[4];
+ p[4] = q[3];
+ p[5] = q[2];
+ p[6] = q[1];
+ p[7] = q[0];
+ p += 8;
+ q += 8;
}
}