Function: ping

ping is an autoloaded, interactive and byte-compiled function defined in net-utils.el.gz.

Signature

(ping HOST &optional FLAGS)

Documentation

Ping HOST using ping-program.

The user option ping-program-options is passed as flags to ping-program. With a C-u (universal-argument) prefix arg, prompt the user for the flags to pass.

When called from Lisp, the optional argument FLAGS, if non-nil, is a list of strings that will be passed as flags for the ping-program. If FLAGS is nil, ping-program-options will be used.

If your system's ping continues until interrupted, you can try using a prefix argument or setting ping-program-options.

Probably introduced at or before Emacs version 20.3.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/net/net-utils.el.gz
;;;###autoload
(defun ping (host &optional flags)
  "Ping HOST using `ping-program'.

The user option `ping-program-options' is passed as flags to
`ping-program'.  With a \\[universal-argument] prefix arg, prompt the
user for the flags to pass.

When called from Lisp, the optional argument FLAGS, if non-nil, is a
list of strings that will be passed as flags for the `ping-program'.  If
FLAGS is nil, `ping-program-options' will be used.

If your system's ping continues until interrupted, you can try using a
prefix argument or setting `ping-program-options'."
  (interactive
   (list (let ((default (ffap-machine-at-point)))
           (read-string (format-prompt "Ping host" default) nil nil default))
         (when current-prefix-arg
           (split-string
            (read-string (format-prompt "Ping options" ping-program-options)
                         nil nil ping-program-options)))))
  (let ((full-command
	 (if (or (equal flags (list "")) (not flags))
	     (append ping-program-options (list host))
	   (append flags (list host)))))
    (net-utils-run-program
     (concat "Ping" " " host)
     (concat "** Ping ** " ping-program " ** " host)
     ping-program
     full-command)))