summaryrefslogtreecommitdiff
path: root/guile/tests/raw-to-c.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guile/tests/raw-to-c.scm')
-rw-r--r--guile/tests/raw-to-c.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/guile/tests/raw-to-c.scm b/guile/tests/raw-to-c.scm
new file mode 100644
index 0000000000..8f506e7f7c
--- /dev/null
+++ b/guile/tests/raw-to-c.scm
@@ -0,0 +1,16 @@
+(use-modules (r6rs i/o ports)
+ (ice-9 format))
+
+(define line-len 12)
+
+(let ((input (open-input-file "openpgp-keyring.gpg")))
+ (let loop ((byte (get-u8 input))
+ (total 0))
+ (if (eof-object? byte)
+ #t
+ (begin
+ (format #t "0x~:@(~2,'0x, " byte)
+ (if (>= (+ 1 total) line-len) (newline))
+ (loop (get-u8 input)
+ (modulo (+ total 1) line-len))))))
+(newline) \ No newline at end of file