Function: te-parse-program-and-args

te-parse-program-and-args is a byte-compiled function defined in terminal.el.gz.

Signature

(te-parse-program-and-args S)

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/terminal.el.gz
(defun te-parse-program-and-args (s)
  (cond ((string-match "\\`[-a-zA-Z0-9+=_.@/:][-a-zA-Z0-9+=_.@/: \t]*\\'" s)
	 (let ((l ()) (p 0))
	   (while p
	     (setq l (cons (if (string-match
				"\\([-a-zA-Z0-9+=_.@/:]+\\)[ \t]*"
				s p)
			       (prog1 (substring s p (match-end 1))
				 (setq p (match-end 0))
				 (if (eq p (length s)) (setq p nil)))
			       (prog1 (substring s p)
				 (setq p nil)))
			   l)))
	   (setq l (nreverse l))
	   (list (car l) (cdr l))))
	((and (string-match "[ \t]" s) (not (file-exists-p s)))
	 (list shell-file-name (list "-c" (concat "exec " s))))
	(t (list s ()))))