From 59b0f9d7635ea7e272e2976ab69764a570d7f6ff Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 25 Mar 2013 23:25:57 +0100 Subject: SRFI-37: Fix infinite loop when processing short option with no required arg. Fixes . * 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. --- module/srfi/srfi-37.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/srfi/srfi-37.scm') 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), -- cgit v1.2.3