aboutsummaryrefslogtreecommitdiff
path: root/bin/dd
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dd')
-rw-r--r--bin/dd/Makefile15
-rw-r--r--bin/dd/gen.c17
-rw-r--r--bin/dd/ref.ascii18
-rw-r--r--bin/dd/ref.ebcdic18
-rw-r--r--bin/dd/ref.ibm18
-rw-r--r--bin/dd/ref.lcase18
-rw-r--r--bin/dd/ref.oldascii18
-rw-r--r--bin/dd/ref.oldebcdic18
-rw-r--r--bin/dd/ref.oldibm18
-rw-r--r--bin/dd/ref.swab18
-rw-r--r--bin/dd/ref.ucase18
11 files changed, 194 insertions, 0 deletions
diff --git a/bin/dd/Makefile b/bin/dd/Makefile
index 0cbd23895879..ab33aed85499 100644
--- a/bin/dd/Makefile
+++ b/bin/dd/Makefile
@@ -7,3 +7,18 @@ SRCS= args.c conv.c conv_tab.c dd.c misc.c position.c
MAINTAINER= green@FreeBSD.org
.include <bsd.prog.mk>
+
+#
+# Test the character conversion functions. We have to be explicit about
+# which LC_LANG we use because the definition of upper and lower case
+# depends on it.
+test: ${PROG}
+ cc ${.CURDIR}/gen.c
+.for conv in ascii ebcdic ibm oldascii oldebcdic oldibm \
+ swab lcase ucase
+ @echo testing conv=${conv}
+ @./a.out | \
+ /usr/bin/env -i LC_CTYPE=ASCII ./dd conv=${conv} 2>/dev/null | \
+ /usr/bin/env -i LC_CTYPE=ASCII hexdump -C | \
+ diff -IFreeBSD - ${.CURDIR}/ref.${conv}
+.endfor
diff --git a/bin/dd/gen.c b/bin/dd/gen.c
new file mode 100644
index 000000000000..1eb76dc5b625
--- /dev/null
+++ b/bin/dd/gen.c
@@ -0,0 +1,17 @@
+/*
+ * This program is in the public domain
+ *
+ * $FreeBSD$
+ */
+
+#include <stdio.h>
+
+int
+main(int argc __unused, char **argv __unused)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ putchar(i);
+ return (0);
+}
diff --git a/bin/dd/ref.ascii b/bin/dd/ref.ascii
new file mode 100644
index 000000000000..7ff13e5a80ed
--- /dev/null
+++ b/bin/dd/ref.ascii
@@ -0,0 +1,18 @@
+$FreeBSD$
+00000000 00 01 02 03 9c 09 86 7f 97 8d 8e 0b 0c 0d 0e 0f |................|
+00000010 10 11 12 13 9d 85 08 87 18 19 92 8f 1c 1d 1e 1f |................|
+00000020 80 81 82 83 84 0a 17 1b 88 89 8a 8b 8c 05 06 07 |................|
+00000030 90 91 16 93 94 95 96 04 98 99 9a 9b 14 15 9e 1a |................|
+00000040 20 a0 a1 a2 a3 a4 a5 a6 a7 a8 d5 2e 3c 28 2b 7c | ...........<(+||
+00000050 26 a9 aa ab ac ad ae af b0 b1 21 24 2a 29 3b 7e |&.........!$*);~|
+00000060 2d 2f b2 b3 b4 b5 b6 b7 b8 b9 cb 2c 25 5f 3e 3f |-/.........,%_>?|
+00000070 ba bb bc bd be bf c0 c1 c2 60 3a 23 40 27 3d 22 |.........`:#@'="|
+00000080 c3 61 62 63 64 65 66 67 68 69 c4 c5 c6 c7 c8 c9 |.abcdefghi......|
+00000090 ca 6a 6b 6c 6d 6e 6f 70 71 72 5e cc cd ce cf d0 |.jklmnopqr^.....|
+000000a0 d1 e5 73 74 75 76 77 78 79 7a d2 d3 d4 5b d6 d7 |..stuvwxyz...[..|
+000000b0 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 5d e6 e7 |.............]..|
+000000c0 7b 41 42 43 44 45 46 47 48 49 e8 e9 ea eb ec ed |{ABCDEFGHI......|
+000000d0 7d 4a 4b 4c 4d 4e 4f 50 51 52 ee ef f0 f1 f2 f3 |}JKLMNOPQR......|
+000000e0 5c 9f 53 54 55 56 57 58 59 5a f4 f5 f6 f7 f8 f9 |\.STUVWXYZ......|
+000000f0 30 31 32 33 34 35 36 37 38 39 fa fb fc fd fe ff |0123456789......|
+00000100
diff --git a/bin/dd/ref.ebcdic b/bin/dd/ref.ebcdic
new file mode 100644
index 000000000000..605716552cab
--- /dev/null
+++ b/bin/dd/ref.ebcdic
@@ -0,0 +1,18 @@
+$FreeBSD$
+00000000 00 01 02 03 37 2d 2e 2f 16 05 25 0b 0c 0d 0e 0f |....7-./..%.....|
+00000010 10 11 12 13 3c 3d 32 26 18 19 3f 27 1c 1d 1e 1f |....<=2&..?'....|
+00000020 40 5a 7f 7b 5b 6c 50 7d 4d 5d 5c 4e 6b 60 4b 61 |@Z.{[lP}M]\Nk`Ka|
+00000030 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 7a 5e 4c 7e 6e 6f |..........z^L~no|
+00000040 7c c1 c2 c3 c4 c5 c6 c7 c8 c9 d1 d2 d3 d4 d5 d6 ||...............|
+00000050 d7 d8 d9 e2 e3 e4 e5 e6 e7 e8 e9 ad e0 bd 9a 6d |...............m|
+00000060 79 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 |y...............|
+00000070 97 98 99 a2 a3 a4 a5 a6 a7 a8 a9 c0 4f d0 5f 07 |............O._.|
+00000080 20 21 22 23 24 15 06 17 28 29 2a 2b 2c 09 0a 1b | !"#$...()*+,...|
+00000090 30 31 1a 33 34 35 36 08 38 39 3a 3b 04 14 3e e1 |01.3456.89:;..>.|
+000000a0 41 42 43 44 45 46 47 48 49 51 52 53 54 55 56 57 |ABCDEFGHIQRSTUVW|
+000000b0 58 59 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |XYbcdefghipqrstu|
+000000c0 76 77 78 80 8a 8b 8c 8d 8e 8f 90 6a 9b 9c 9d 9e |vwx........j....|
+000000d0 9f a0 aa ab ac 4a ae af b0 b1 b2 b3 b4 b5 b6 b7 |.....J..........|
+000000e0 b8 b9 ba bb bc a1 be bf ca cb cc cd ce cf da db |................|
+000000f0 dc dd de df ea eb ec ed ee ef fa fb fc fd fe ff |................|
+00000100
diff --git a/bin/dd/ref.ibm b/bin/dd/ref.ibm
new file mode 100644
index 000000000000..4836baf221aa
--- /dev/null
+++ b/bin/dd/ref.ibm
@@ -0,0 +1,18 @@
+$FreeBSD$
+00000000 00 01 02 03 37 2d 2e 2f 16 05 25 0b 0c 0d 0e 0f |....7-./..%.....|
+00000010 10 11 12 13 3c 3d 32 26 18 19 3f 27 1c 1d 1e 1f |....<=2&..?'....|
+00000020 40 5a 7f 7b 5b 6c 50 7d 4d 5d 5c 4e 6b 60 4b 61 |@Z.{[lP}M]\Nk`Ka|
+00000030 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 7a 5e 4c 7e 6e 6f |..........z^L~no|
+00000040 7c c1 c2 c3 c4 c5 c6 c7 c8 c9 d1 d2 d3 d4 d5 d6 ||...............|
+00000050 d7 d8 d9 e2 e3 e4 e5 e6 e7 e8 e9 ad e0 bd 5f 6d |.............._m|
+00000060 79 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 |y...............|
+00000070 97 98 99 a2 a3 a4 a5 a6 a7 a8 a9 c0 4f d0 a1 07 |............O...|
+00000080 20 21 22 23 24 15 06 17 28 29 2a 2b 2c 09 0a 1b | !"#$...()*+,...|
+00000090 30 31 1a 33 34 35 36 08 38 39 3a 3b 04 14 3e e1 |01.3456.89:;..>.|
+000000a0 41 42 43 44 45 46 47 48 49 51 52 53 54 55 56 57 |ABCDEFGHIQRSTUVW|
+000000b0 58 59 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |XYbcdefghipqrstu|
+000000c0 76 77 78 80 8a 8b 8c 8d 8e 8f 90 9a 9b 9c 9d 9e |vwx.............|
+000000d0 9f a0 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 |................|
+000000e0 b8 b9 ba bb bc bd be bf ca cb cc cd ce cf da db |................|
+000000f0 dc dd de df ea eb ec ed ee ef fa fb fc fd fe ff |................|
+00000100
diff --git a/bin/dd/ref.lcase b/bin/dd/ref.lcase
new file mode 100644
index 000000000000..9f9567296468
--- /dev/null
+++ b/bin/dd/ref.lcase
@@ -0,0 +1,18 @@
+$FreeBSD$
+00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................|
+00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................|
+00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./|
+00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?|
+00000040 40 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |@abcdefghijklmno|
+00000050 70 71 72 73 74 75 76 77 78 79 7a 5b 5c 5d 5e 5f |pqrstuvwxyz[\]^_|
+00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno|
+00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.|
+00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................|
+00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................|
+000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................|
+000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................|
+000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................|
+000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................|
+000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................|
+000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff |................|
+00000100
diff --git a/bin/dd/ref.oldascii b/bin/dd/ref.oldascii
new file mode 100644
index 000000000000..bb1ad0a7242b
--- /dev/null
+++ b/bin/dd/ref.oldascii
@@ -0,0 +1,18 @@
+$FreeBSD$
+00000000 00 01 02 03 9c 09 86 7f 97 8d 8e 0b 0c 0d 0e 0f |................|
+00000010 10 11 12 13 9d 85 08 87 18 19 92 8f 1c 1d 1e 1f |................|
+00000020 80 81 82 83 84 0a 17 1b 88 89 8a 8b 8c 05 06 07 |................|
+00000030 90 91 16 93 94 95 96 04 98 99 9a 9b 14 15 9e 1a |................|
+00000040 20 a0 a1 a2 a3 a4 a5 a6 a7 a8 5b 2e 3c 28 2b 21 | .........[.<(+!|
+00000050 26 a9 aa ab ac ad ae af b0 b1 5d 24 2a 29 3b 5e |&.........]$*);^|
+00000060 2d 2f b2 b3 b4 b5 b6 b7 b8 b9 7c 2c 25 5f 3e 3f |-/........|,%_>?|
+00000070 ba bb bc bd be bf c0 c1 c2 60 3a 23 40 27 3d 22 |.........`:#@'="|
+00000080 c3 61 62 63 64 65 66 67 68 69 c4 c5 c6 c7 c8 c9 |.abcdefghi......|
+00000090 ca 6a 6b 6c 6d 6e 6f 70 71 72 cb cc cd ce cf d0 |.jklmnopqr......|
+000000a0 d1 7e 73 74 75 76 77 78 79 7a d2 d3 d4 d5 d6 d7 |.~stuvwxyz......|
+000000b0 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 |................|
+000000c0 7b 41 42 43 44 45 46 47 48 49 e8 e9 ea eb ec ed |{ABCDEFGHI......|
+000000d0 7d 4a 4b 4c 4d 4e 4f 50 51 52 ee ef f0 f1 f2 f3 |}JKLMNOPQR......|
+000000e0 5c 9f 53 54 55 56 57 58 59 5a f4 f5 f6 f7 f8 f9 |\.STUVWXYZ......|
+000000f0 30 31 32 33 34 35 36 37 38 39 fa fb fc fd fe ff |0123456789......|
+00000100
diff --git a/bin/dd/ref.oldebcdic b/bin/dd/ref.oldebcdic
new file mode 100644
index 000000000000..4a7fde7e65b6
--- /dev/null
+++ b/bin/dd/ref.oldebcdic
@@ -0,0 +1,18 @@
+$FreeBSD$
+00000000 00 01 02 03 37 2d 2e 2f 16 05 25 0b 0c 0d 0e 0f |....7-./..%.....|
+00000010 10 11 12 13 3c 3d 32 26 18 19 3f 27 1c 1d 1e 1f |....<=2&..?'....|
+00000020 40 4f 7f 7b 5b 6c 50 7d 4d 5d 5c 4e 6b 60 4b 61 |@O.{[lP}M]\Nk`Ka|
+00000030 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 7a 5e 4c 7e 6e 6f |..........z^L~no|
+00000040 7c c1 c2 c3 c4 c5 c6 c7 c8 c9 d1 d2 d3 d4 d5 d6 ||...............|
+00000050 d7 d8 d9 e2 e3 e4 e5 e6 e7 e8 e9 4a e0 5a 5f 6d |...........J.Z_m|
+00000060 79 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 |y...............|
+00000070 97 98 99 a2 a3 a4 a5 a6 a7 a8 a9 c0 6a d0 a1 07 |............j...|
+00000080 20 21 22 23 24 15 06 17 28 29 2a 2b 2c 09 0a 1b | !"#$...()*+,...|
+00000090 30 31 1a 33 34 35 36 08 38 39 3a 3b 04 14 3e e1 |01.3456.89:;..>.|
+000000a0 41 42 43 44 45 46 47 48 49 51 52 53 54 55 56 57 |ABCDEFGHIQRSTUVW|
+000000b0 58 59 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |XYbcdefghipqrstu|
+000000c0 76 77 78 80 8a 8b 8c 8d 8e 8f 90 9a 9b 9c 9d 9e |vwx.............|
+000000d0 9f a0 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 |................|
+000000e0 b8 b9 ba bb bc bd be bf ca cb cc cd ce cf da db |................|
+000000f0 dc dd de df ea eb ec ed ee ef fa fb fc fd fe ff |................|
+00000100
diff --git a/bin/dd/ref.oldibm b/bin/dd/ref.oldibm
new file mode 100644
index 000000000000..4836baf221aa
--- /dev/null
+++ b/bin/dd/ref.oldibm
@@ -0,0 +1,18 @@
+$FreeBSD$
+00000000 00 01 02 03 37 2d 2e 2f 16 05 25 0b 0c 0d 0e 0f |....7-./..%.....|
+00000010 10 11 12 13 3c 3d 32 26 18 19 3f 27 1c 1d 1e 1f |....<=2&..?'....|
+00000020 40 5a 7f 7b 5b 6c 50 7d 4d 5d 5c 4e 6b 60 4b 61 |@Z.{[lP}M]\Nk`Ka|
+00000030 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 7a 5e 4c 7e 6e 6f |..........z^L~no|
+00000040 7c c1 c2 c3 c4 c5 c6 c7 c8 c9 d1 d2 d3 d4 d5 d6 ||...............|
+00000050 d7 d8 d9 e2 e3 e4 e5 e6 e7 e8 e9 ad e0 bd 5f 6d |.............._m|
+00000060 79 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 |y...............|
+00000070 97 98 99 a2 a3 a4 a5 a6 a7 a8 a9 c0 4f d0 a1 07 |............O...|
+00000080 20 21 22 23 24 15 06 17 28 29 2a 2b 2c 09 0a 1b | !"#$...()*+,...|
+00000090 30 31 1a 33 34 35 36 08 38 39 3a 3b 04 14 3e e1 |01.3456.89:;..>.|
+000000a0 41 42 43 44 45 46 47 48 49 51 52 53 54 55 56 57 |ABCDEFGHIQRSTUVW|
+000000b0 58 59 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |XYbcdefghipqrstu|
+000000c0 76 77 78 80 8a 8b 8c 8d 8e 8f 90 9a 9b 9c 9d 9e |vwx.............|
+000000d0 9f a0 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 |................|
+000000e0 b8 b9 ba bb bc bd be bf ca cb cc cd ce cf da db |................|
+000000f0 dc dd de df ea eb ec ed ee ef fa fb fc fd fe ff |................|
+00000100
diff --git a/bin/dd/ref.swab b/bin/dd/ref.swab
new file mode 100644
index 000000000000..79e57b79b738
--- /dev/null
+++ b/bin/dd/ref.swab
@@ -0,0 +1,18 @@
+$FreeBSD$
+00000000 01 00 03 02 05 04 07 06 09 08 0b 0a 0d 0c 0f 0e |................|
+00000010 11 10 13 12 15 14 17 16 19 18 1b 1a 1d 1c 1f 1e |................|
+00000020 21 20 23 22 25 24 27 26 29 28 2b 2a 2d 2c 2f 2e |! #"%$'&)(+*-,/.|
+00000030 31 30 33 32 35 34 37 36 39 38 3b 3a 3d 3c 3f 3e |1032547698;:=<?>|
+00000040 41 40 43 42 45 44 47 46 49 48 4b 4a 4d 4c 4f 4e |A@CBEDGFIHKJMLON|
+00000050 51 50 53 52 55 54 57 56 59 58 5b 5a 5d 5c 5f 5e |QPSRUTWVYX[Z]\_^|
+00000060 61 60 63 62 65 64 67 66 69 68 6b 6a 6d 6c 6f 6e |a`cbedgfihkjmlon|
+00000070 71 70 73 72 75 74 77 76 79 78 7b 7a 7d 7c 7f 7e |qpsrutwvyx{z}|.~|
+00000080 81 80 83 82 85 84 87 86 89 88 8b 8a 8d 8c 8f 8e |................|
+00000090 91 90 93 92 95 94 97 96 99 98 9b 9a 9d 9c 9f 9e |................|
+000000a0 a1 a0 a3 a2 a5 a4 a7 a6 a9 a8 ab aa ad ac af ae |................|
+000000b0 b1 b0 b3 b2 b5 b4 b7 b6 b9 b8 bb ba bd bc bf be |................|
+000000c0 c1 c0 c3 c2 c5 c4 c7 c6 c9 c8 cb ca cd cc cf ce |................|
+000000d0 d1 d0 d3 d2 d5 d4 d7 d6 d9 d8 db da dd dc df de |................|
+000000e0 e1 e0 e3 e2 e5 e4 e7 e6 e9 e8 eb ea ed ec ef ee |................|
+000000f0 f1 f0 f3 f2 f5 f4 f7 f6 f9 f8 fb fa fd fc ff fe |................|
+00000100
diff --git a/bin/dd/ref.ucase b/bin/dd/ref.ucase
new file mode 100644
index 000000000000..70d8a903c354
--- /dev/null
+++ b/bin/dd/ref.ucase
@@ -0,0 +1,18 @@
+$FreeBSD$
+00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................|
+00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................|
+00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./|
+00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?|
+00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO|
+00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_|
+00000060 60 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |`ABCDEFGHIJKLMNO|
+00000070 50 51 52 53 54 55 56 57 58 59 5a 7b 7c 7d 7e 7f |PQRSTUVWXYZ{|}~.|
+00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................|
+00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................|
+000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................|
+000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................|
+000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................|
+000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................|
+000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................|
+000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff |................|
+00000100