;;
;; $Id: site-athena.el,v 1.2 1995/12/05 03:52:01 qjb Exp $
;; $Source: /home/qjb/elisp/q/RCS/site-athena.el,v $
;; $Author: qjb $
;;

(setq make-command "gmake")

(require 'sendmail)
(defun athena-version (&optional version-only)
  "\
Find the current version of the workstation, by consulting /etc/version.
Optional arg VERSION-ONLY, if non-nil, specifies that only the version number
should be extracted."
  (let ((version-file "/etc/version") buf)
    (save-excursion
      (if (not (file-exists-p version-file))
	  (error "This doesn't seem to be an athena system!"))
      (unwind-protect 
	  (progn
	    (setq buf (find-file-noselect "/etc/version"))
	    (set-buffer buf)
	    (goto-char (point-max))
	    (forward-line -1)
	    (if version-only
		(re-search-forward "^[^ ]+ [^ ]+ ([^)]+) Version \\([^ ]+\\) ")
	      (re-search-forward "^[^ ]+ [^ ]+ \\(([^)]+) Version [^ ]+\\) "))
	    (buffer-substring (match-beginning 1) (match-end 1)))
	(if buf (kill-buffer buf))))))

(defun machine-type (&optional flag)
  "\
Run machtype to determine the machine type.  Optional arg FLAG is passed to
machtype."
  (let ((foo nil)
	(buf (get-buffer-create " *machtype-xyzzy*")))
    (save-excursion
      (set-buffer buf)
      (erase-buffer)
      (if flag
	  (call-process-region (point) (point) "machtype" nil t nil flag)
	(call-process-region (point) (point) "machtype" nil t nil))
      (goto-char (point-max))
      (delete-backward-char 1)
      (setq foo (buffer-string))
      (kill-buffer buf)
      foo)))

(defun rmail-HOTLINE ()
  "Send in an ATHENA bug report, with identification.\n"
  (interactive)
  
  (let ((pop-up-windows t))
    (pop-to-buffer "*mail*"))
  (switch-to-buffer "*mail*")
  (setq default-directory (expand-file-name "~/"))
  (auto-save-mode auto-save-default)
  (mail-mode)
  (erase-buffer)
  (mail-setup "hotline" (concat (system-name) ": **** INSERT PROBLEM ****")
	      nil nil nil nil)
  (insert "System type:\t\t" (athena-version)
	  "\nSystem name:\t\t" (system-name)
	  "\nCPU/Serial number:\t\t" 
	  "\nWhat's wrong:\n\n"
	  "\nContact person and phone number:\t"))
