#!/usr/bin/guile16 -s
!#
(use-modules (ice-9 getopt-long)
	     (alterator common)

	     (alterator telegraph)
	     (alterator transport pipe-channel)
	     (alterator lookout)
	     (alterator logfile)
	     (alterator ensign))

(define cmdline (command-line))
(define progname (car cmdline))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (usage progname)
  (format #t "Usage:  ~A [-l]~%" progname)
  (format #t "  -h, --help     display help screen~%")
  (format #t "  -l,--local     try to use local files (maps,po,layout,etc.) if available ~%~%")
  (format #t "  Report bugs to <inger@altlinux.ru>~%")
  (quit))

(define option-spec
  '((help  (single-char #\h) (value #f))
    (local (single-char #\l) (value #f))))

(define options (getopt-long cmdline option-spec))

(and (option-ref options 'help #f) (usage progname))

(alterator-init)
(and (option-ref options 'local #f) (alterator-init-local))

(telegraph
  (pipe-in "/usr/bin/alterator-browser-qt" "/tmp")
  (lookout "/wizard")
  (logfile "/tmp/wizard.log")
  (ensign))

(telegraph-start)
