f#: Tidy same_iterators_p a little.
[fringe] / cl-fringe.lisp
index 7386c38..a2ddf85 100644 (file)
@@ -63,9 +63,7 @@
 
   (let ((len (length string)))
     (labels ((parse (i)
-              (cond ((>= i len)
-                     (values nil i))
-                    ((char= (char string i) #\()
+              (cond ((and (< i len) (char= (char string i) #\())
                      (multiple-value-bind (left i) (parse (1+ i))
                        (unless (< i len) (error "no data"))
                        (let ((data (char string i)))
                                       (iterate-fringe (parse-tree b))))))))
 
 #+cl-launch
-(defun launch ()
-  (flet ((bail (format args)
-          (format *error-output* "~A: ~?~%"
-                  (cl-launch:getenv "CL_LAUNCH_FILE") format args)
-          (cl-launch:quit 1)))
-    (handler-case
-       (main cl-launch:*arguments*)
-      (simple-error (err)
-       (bail (simple-condition-format-control err)
-             (simple-condition-format-arguments err)))
-      (error (err)
-       (bail "~A" err)))))
+(progn
+  (defparameter *program-name*
+    (pathname-name (or (cl-launch:getenv "CL_LAUNCH_FILE")
+                      (namestring *load-pathname*)
+                      "<unknown>")))
+  (defun launch ()
+    (flet ((bail (format args)
+            (format *error-output* "~A: ~?~%" *program-name* format args)
+            (cl-launch:quit 1)))
+      (handler-case
+         (main cl-launch:*arguments*)
+       (simple-error (err)
+         (bail (simple-condition-format-control err)
+               (simple-condition-format-arguments err)))
+       (error (err)
+         (bail "~A" err))))))
 
 ;;;----- That's all, folks --------------------------------------------------