~ chicken-core (chicken-5) f792f463c48789f3dfa0cffd76aa06f21d338318


commit f792f463c48789f3dfa0cffd76aa06f21d338318
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Jul 1 22:41:00 2021 +0200
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Tue Jul 6 13:29:55 2021 +0200

    show a more helpful error message when passing "-l<lib>" to csc (suggested by jcroisant)
    
    Signed-off-by: Peter Bex <peter@more-magic.net>

diff --git a/csc.scm b/csc.scm
index 67223eea..dba9703b 100644
--- a/csc.scm
+++ b/csc.scm
@@ -827,11 +827,15 @@ EOF
 			     [(and (> (string-length arg) 3) (string=? "-Wl," (substring arg 0 4)))
 			      (set! link-options (append link-options (list arg))) ]
 			     [(> (string-length arg) 2)
- 			      (let ([opts (cdr (string->list arg))])
-				(if (null? (lset-difference/eq? opts short-options))
- 				    (set! rest
- 				      (append (map (lambda (o) (string-append "-" (string o))) opts) rest) )
- 				    (stop "invalid option `~A'" arg) ) ) ]
+			      (let ([opts (cdr (string->list arg))])
+				(cond ((null? (lset-difference/eq? opts short-options))
+				       (set! rest
+					 (append (map (lambda (o)
+							(string-append "-" (string o))) opts) 
+						 rest) ))
+				      ((char=? #\l (car opts))
+				       (stop "invalid option `~A' - did you mean `-L -l<library>'?" arg))
+				      (else (stop "invalid option `~A'" arg) ) )) ]
 			     [else (stop "invalid option `~A'" s)] ) ]
 		      [(file-exists? arg)
 		       (let-values ([(dirs name ext) (decompose-pathname arg)])
Trap