- (destructuring-bind (&optional a b &rest junk) args
- (cond ((or (null a) junk) (error "bad args"))
- ((null b) (format t "~{~C~}~%"
- (list-iterator (iterate-fringe (parse-tree a)))))
- (t (format t "~:[no match~;match~]~%"
- (same-iterators-p (iterate-fringe (parse-tree a))
- (iterate-fringe (parse-tree b))))))))
+ (flet ((bail (format args)
+ (format *error-output* "~A: ~?~%" prog format args)
+ (return-from main 1)))
+ (handler-case
+ (destructuring-bind (&optional a b &rest junk) args
+ (cond ((or (null a) junk)
+ (error "bad args"))
+ ((null b)
+ (format t "~{~C~}~%"
+ (list-iterator (iterate-fringe (parse-tree a)))))
+ (t
+ (format t "~:[no match~;match~]~%"
+ (same-iterators-p
+ (iterate-fringe (parse-tree a))
+ (iterate-fringe (parse-tree b)))))))
+ (simple-error (err)
+ (bail (simple-condition-format-control err)
+ (simple-condition-format-arguments err)))
+ (error (err)
+ (bail "~A" err)))
+ 0))