diff options
author | Justus Winter <[email protected]> | 2016-11-07 12:12:01 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-11-07 12:13:31 +0000 |
commit | 413cc50345557e0a516f33b98e8aab19bbc8b4fe (patch) | |
tree | 94c7d45446e4ef032fde976ff194dad63ad29558 /tests/gpgscm/lib.scm | |
parent | gpgscm: Add support for pseudo-random numbers. (diff) | |
download | gnupg-413cc50345557e0a516f33b98e8aab19bbc8b4fe.tar.gz gnupg-413cc50345557e0a516f33b98e8aab19bbc8b4fe.zip |
gpgscm,w32: Provide schemish file handling for binary files.
* tests/gpgscm/lib.scm (call-with-binary-input-file): New function.
(call-with-binary-output-file): Likewise.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests/gpgscm/lib.scm')
-rw-r--r-- | tests/gpgscm/lib.scm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index 270189dcd..a8ae2f805 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -187,6 +187,20 @@ (loop acc)))))) ;; +;; Windows support. +;; + +;; Like call-with-input-file but opens the file in 'binary' mode. +(define (call-with-binary-input-file filename proc) + (letfd ((fd (open filename (logior O_RDONLY O_BINARY)))) + (proc (fdopen fd "rb")))) + +;; Like call-with-output-file but opens the file in 'binary' mode. +(define (call-with-binary-output-file filename proc) + (letfd ((fd (open filename (logior O_WRONLY O_CREAT O_BINARY) #o600))) + (proc (fdopen fd "wb")))) + +;; ;; Libc functions. ;; |