5 ;;; Zone generator frontend
7 ;;; (c) 2005 Straylight/Edgeware
10 ;;;----- Licensing notice ---------------------------------------------------
12 ;;; This program is free software; you can redistribute it and/or modify
13 ;;; it under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 2 of the License, or
15 ;;; (at your option) any later version.
17 ;;; This program is distributed in the hope that it will be useful,
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with this program; if not, write to the Free Software Foundation,
24 ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 (defpackage #:zone.frontend
27 (:use #:common-lisp #:mdw.optparse #:zone)
29 (in-package #:zone.frontend)
31 (defconstant version "1.0.0")
34 "Which zones to be emitted.")
39 (declare (ignore arg))
40 (show-help *program-name* version usage options)
43 (declare (ignore arg))
44 (format t "~A, version ~A~%" *program-name* version)
46 (defun do-usage (&optional (stream *standard-output*))
47 (show-usage *program-name* usage stream))
49 (declare (ignore arg))
56 "Show this help message.")
57 (#\v "version" #'version
58 ("Show the `~A' program's version number." *program-name*))
60 ("Show a very brief usage summary for `~A'." *program-name*))
63 (#\z "zone" (:arg "NAME") (list opt-zones)
64 "Write information about zone NAME.")))
65 (setf usage (simple-usage options "ZONEDEF..."))
68 (with-unix-error-reporting ()
71 (op (make-option-parser (cdr *command-line-strings*) options)))
72 (unless (option-parse-try
74 (multiple-value-bind (opt arg) (option-parse-next op)
75 (declare (ignore arg))
78 (setf files (option-parse-remainder op))
79 (when (zerop (length files))
80 (option-parse-error "no files to read")))
81 (do-usage *error-output*)
84 (let ((*package* (make-package (format nil "zone.scratch-~A"
86 :use '(#:common-lisp #:zone))))
87 (load f :verbose nil :print nil :if-does-not-exist :error)))
88 (zone-save opt-zones))))
90 ;;;----- That's all, folks --------------------------------------------------