Added command-line option to display version.
authorTim Vaughan <tgvaughan@gmail.com>
Thu, 5 Sep 2019 08:34:33 +0000 (10:34 +0200)
committerTim Vaughan <tgvaughan@gmail.com>
Thu, 5 Sep 2019 08:34:33 +0000 (10:34 +0200)
lambdamail.scm

index 25454e1..eb5943c 100644 (file)
 (define (print-usage progname)
   (print "Usage:\n"
          progname " -h/--help\n"
+         progname " -v/--version\n"
          progname " [-u/--user UID] [-g/--group GID] hostname [[port [spooldir]]\n"
          "\n"
          "The -u and -g options can be used to set the UID and GID of the process\n"
          "following the creation of the TCP port listener (which often requires root)."))
 
+(define (print-version)
+  (print lambdamail-version))
+
 (define (main)
   (let ((progname (pathname-file (car (argv))))
         (config (make-config "" 25 "/var/spool/mail" '() '())))
                  ((or (equal? this-arg "-h")
                       (equal? this-arg "--help"))
                   (print-usage progname))
+                 ((or (equal? this-arg "-v")
+                      (equal? this-arg "--version"))
+                  (print-version))
                  (else
                   (print "Unknown option " this-arg "\n")
                   (print-usage progname)))