Mark H Weaver <m...@netris.org> writes: > > First of all, that '(close-port port)' is wrong. Here you are trying to > tell Guile how to close 'port', and this just recurses. I guess it > should be (close-port auth-file)'.
That's right. It's two bugs, actually---closing the file would cause an infinite loop and I didn't catch it because I never actually closed the file! > > However, I don't see why this custom port is needed at all. You've > already opened 'auth-file' in binary mode, so you should be able to use > it directly, i.e. replace the above code with: > > (define port (open-file (getenv "XAUTHORITY") "rb")) > Ok, I finally get what you're saying... procedures like 'get-bytevector-n' or 'put-u8' and so forth work just fine on ports that are opened in binary mode---no custom binary ports needed! Reading the manual gave me the impression that there was a fundamental difference between file ports opened in binary mode as described in section 6.14.9.1, and R6RS binary input/output ports as described in sections 6.14.10.8 and 6.14.10.11. Now that you've explained it to me, it makes sense that procedures that call for the latter would work on the former as well. -- Mark Witmer