port-line broken?

Harvey J. Stein (hjstein@bfr.co.il)
16 Aug 1998 02:02:46 +0300

The guile docs say:

- primitive: port-line [INPUT-PORT]
Return the current column number or line number of INPUT-PORT,
using the current input port if none is specified. If the number
is unknown, the result is #f. Otherwise, the result is a 0-origin
integer - i.e. the first character of the first line is line 0,
column 0. (However, when you display a file position, for example
in an error message, we recommand you add 1 to get 1-origin
integers. This is because lines and column numbers traditionally
start with 1, and that is what non-programmers will find most
natural.)

However, it doesn't seem to work:

guile> (define p (open-input-file "extract.scm"))
guile> (port-line p)
0
guile> (read-line p)
"#!/bin/sh"
guile> (read-line p)
"exec guile -l $0 -- --run-from-shell \"$@\""
guile> (read-line p)
"!#"
guile> (read-line p)
";;; extract.scm"
guile> (read-line p)
";;; Copyright (C) 1998, Harvey J. Stein, hjstein@bfr.co.il"
guile> (port-line p)
0

Is this broken, or is it me?

-- 
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il