See patch, suggested by jcroisant on #chicken. Since -lxxx may
be ambiguous, not all cases may be caught, but it can still be helpful to new
users.


felix
From d7bde56252bd8be1b60fac417f8014cfc9d8fb33 Mon Sep 17 00:00:00 2001
From: felix <[email protected]>
Date: Thu, 1 Jul 2021 22:41:00 +0200
Subject: [PATCH] show a more helpful error message when passing "-l<lib>" to
 csc (suggested by jcroisant)

---
 csc.scm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/csc.scm b/csc.scm
index 67223eea..1dd8840e 100644
--- a/csc.scm
+++ b/csc.scm
@@ -828,10 +828,14 @@ EOF
                              (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) ) ) ]
+                               (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)])
-- 
2.26.2

Reply via email to