(nneething-file-name): Don't create spurions
[gnus] / lisp / dig.el
index eb70722..e71d6db 100644 (file)
@@ -1,10 +1,10 @@
 ;;; dig.el --- Domain Name System dig interface
-;; Copyright (c) 2000 Free Software Foundation, Inc.
+;; Copyright (c) 2000, 2001, 2003 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Keywords: DNS BIND dig
 
-;; This file is not a part of GNU Emacs, but the same permissions apply.
+;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published
@@ -168,6 +168,21 @@ Optional arguments are passed to `dig-invoke'."
   (setq buffer-read-only t)
   (set-buffer-modified-p nil))
 
+;; named for consistency with query-dns in dns.el
+(defun query-dig (domain &optional
+                        query-type query-class query-option dig-option server)
+  "Query addresses of a DOMAIN using dig.
+It works by calling `dig-invoke' and `dig-extract-rr'.  Optional
+arguments are passed to `dig-invoke' and `dig-extract-rr'.  Returns
+nil for domain/class/type queries that results in no data."
+(let ((buffer (dig-invoke domain query-type query-class
+                         query-option dig-option server)))
+  (when buffer
+    (switch-to-buffer buffer)
+    (let ((digger (dig-extract-rr domain query-type query-class)))
+      (kill-buffer buffer)
+      digger))))
+
 (provide 'dig)
 
 ;;; dig.el ends here