summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-03-25 23:25:57 +0100
committerLudovic Courtès <ludo@gnu.org>2013-03-25 23:25:57 +0100
commit59b0f9d7635ea7e272e2976ab69764a570d7f6ff (patch)
tree5316f59226c849d60ac22db68858f043f49fbf93 /module
parent5bb40f9df02c3395b198f254fdd43e7468b5ceee (diff)
downloadguile-59b0f9d7635ea7e272e2976ab69764a570d7f6ff.tar.gz
SRFI-37: Fix infinite loop when processing short option with no required arg.
Fixes <http://bugs.gnu.org/13176>. * module/srfi/srfi-37.scm (args-fold)[short-option-argument]: When ARGS is a pair, always set it to its cdr. * test-suite/tests/srfi-37.test ("SRFI-37")["short option with optional argument omitted", "short option with optional argument provided"]: New tests.
Diffstat (limited to 'module')
-rw-r--r--module/srfi/srfi-37.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/module/srfi/srfi-37.scm b/module/srfi/srfi-37.scm
index 565b44cb9..3f654af2c 100644
--- a/module/srfi/srfi-37.scm
+++ b/module/srfi/srfi-37.scm
@@ -1,6 +1,6 @@
;;; srfi-37.scm --- args-fold
-;; Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2008, 2013 Free Software Foundation, Inc.
;;
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@@ -145,6 +145,9 @@ program-arguments in ARGS, as decided by the OPTIONS'
(let ((result (cadr args)))
(set! args (cddr args))
result))
+ ((pair? args)
+ (set! args (cdr args))
+ #f)
(else #f)))
;; Interpret the short-option at index POSITION in (car ARGS),