diff options
| author | Richard M. Stallman | 1997-04-20 07:29:56 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-04-20 07:29:56 +0000 |
| commit | 4289d95b3857e945c2bc367a8d9e128f74da44d8 (patch) | |
| tree | d965bd32f48bc9368679a64f79340ac83eeedff1 | |
| parent | 5b75ef8b0b7824c28078ea82dfb4dfcf9f87757f (diff) | |
| download | emacs-4289d95b3857e945c2bc367a8d9e128f74da44d8.tar.gz emacs-4289d95b3857e945c2bc367a8d9e128f74da44d8.zip | |
Initial revision
| -rw-r--r-- | lisp/setaddr.el | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/lisp/setaddr.el b/lisp/setaddr.el new file mode 100644 index 00000000000..1ae72ef6cb5 --- /dev/null +++ b/lisp/setaddr.el | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | ;;; setaddr.el --- determine whether sendmail is configured on this machine | ||
| 2 | |||
| 3 | ;; Copyright (C) 1997 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Maintainer: FSF | ||
| 6 | ;; Keywords: mail | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 13 | ;; any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 22 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 23 | ;; Boston, MA 02111-1307, USA. | ||
| 24 | |||
| 25 | ;;; Commentary: | ||
| 26 | |||
| 27 | ;; If neither sendmail nor Emacs knows what host address to use | ||
| 28 | ;; for this machine, ask for it, and save it in site-start.el | ||
| 29 | ;; so we won't have to ask again. | ||
| 30 | |||
| 31 | ;; This uses a heuristic about the output from sendmail | ||
| 32 | ;; which may or may not really work. We will have to find | ||
| 33 | ;; out by experiment. | ||
| 34 | |||
| 35 | ;;; Code: | ||
| 36 | |||
| 37 | (or mail-host-address | ||
| 38 | (let (sendmail-configured) | ||
| 39 | (with-temp-buffer " mail-host-address" | ||
| 40 | (call-process sendmail-program nil t nil "-bv" "root") | ||
| 41 | (goto-char (point-min)) | ||
| 42 | (setq sendmail-configured (looking-at "root@"))) | ||
| 43 | (or sendmail-configured | ||
| 44 | (let (buffer) | ||
| 45 | (setq mail-host-address | ||
| 46 | (read-string "Specify your host's fully qualified domain name: "))) | ||
| 47 | ;; Create an init file, and if we just read mail-host-address, | ||
| 48 | ;; make the init file set it. | ||
| 49 | (unwind-protect | ||
| 50 | (save-excursion | ||
| 51 | (set-buffer (find-file-noselect "site-start.el")) | ||
| 52 | (setq buffer (current-buffer)) | ||
| 53 | ;; Get rid of the line that ran this file. | ||
| 54 | (if (search-forward "(load \"setaddr\")\n") | ||
| 55 | (progn | ||
| 56 | (beginning-of-line) | ||
| 57 | (delete-region (point) | ||
| 58 | (progn (end-of-line) | ||
| 59 | (point))))) | ||
| 60 | ;; Add the results | ||
| 61 | (goto-char (point-max)) | ||
| 62 | (insert "\n(setq mail-host-address " | ||
| 63 | (prin1-to-string mail-host-address) | ||
| 64 | ")\n") | ||
| 65 | (condition-case nil | ||
| 66 | (save-buffer) | ||
| 67 | (file-error nil))) | ||
| 68 | (if buffer | ||
| 69 | (kill-buffer buffer)))))) | ||
| 70 | |||
| 71 | ;;; setaddr.el ends here | ||