summaryrefslogtreecommitdiffstats
path: root/scanf.scm
diff options
context:
space:
mode:
authorJim Pick <jim@jimpick.com>1998-03-08 23:05:22 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commitb21cac3362022718634f7086964208b2eed8e897 (patch)
tree16f4b2e70645c0e8e2202023170b5a94baa967e3 /scanf.scm
parent3796d2595035e192ed4bf1c9a6bfdb13c3c9d261 (diff)
parentf24b9140d6f74804d5599ec225717d38ca443813 (diff)
downloadslib-b21cac3362022718634f7086964208b2eed8e897.tar.gz
slib-b21cac3362022718634f7086964208b2eed8e897.zip
Import Debian changes 2c0-3debian/2c0-3
slib (2c0-3) unstable; urgency=low * New maintainer. * slibconfig script to automatically configure guile. * Fix type in description, closes: Bug#18996 slib (2c0-2) unstable; urgency=low * Minor fix for debian/rules targets slib (2c0-1) unstable; urgency=low * New upstream source * New maintainer
Diffstat (limited to 'scanf.scm')
-rw-r--r--scanf.scm23
1 files changed, 11 insertions, 12 deletions
diff --git a/scanf.scm b/scanf.scm
index b1ae30a..e4fc919 100644
--- a/scanf.scm
+++ b/scanf.scm
@@ -1,5 +1,5 @@
;;;;"scanf.scm" implemenation of formated input
-;Copyright (C) 1996 Aubrey Jaffer
+;Copyright (C) 1996, 1997 Aubrey Jaffer
;
;Permission to copy this software, to redistribute it, and to use it
;for any purpose is granted, subject to the following restrictions and
@@ -54,7 +54,7 @@
(define (add-item report-field? next-item)
(cond (args
- (cond ((null? setters)
+ (cond ((and report-field? (null? setters))
(slib:error 'scanf "not enough variables for format"
format-string))
((not next-item) (return))
@@ -221,14 +221,12 @@
((#\c #\C)
(if (not width) (set! width 1))
(let ((str (make-string width)))
- (do ((i 0 (+ 1 i)))
- ((>= i width)
- (add-item report-field? str))
- (let ((c (read-char input-port)))
- (cond ((eof-object? c)
- (set! str c)
- (set! i width))
- (else (string-set! str i c)))))))
+ (do ((i 0 (+ 1 i))
+ (c (peek-char input-port) (peek-char input-port)))
+ ((or (>= i width)
+ (eof-object? c))
+ (add-item report-field? (substring str 0 i)))
+ (string-set! str i (read-input-char)))))
((#\s #\S)
;;(flush-whitespace-input)
(add-item report-field? (read-word width char-whitespace?)))
@@ -292,7 +290,7 @@
(read-input-char)
(loop1))
(else (return))))
-
+ ;;(trace flush-whitespace-input flush-whitespace add-item return read-string read-word loop1)
(loop1))))
(args 0)
(else '())))
@@ -312,7 +310,8 @@
(call-with-input-string
input-port (lambda (input-port)
(stdio:scan-and-set format-string input-port #f))))
- (else (slib:error 'scanf-read-list "argument not port" input-port))))
+ (else (slib:error 'scanf-read-list "argument 2 not a port"
+ input-port))))
(define (stdio:setter-procedure sexp)
(let ((v (gentemp)))