Function: semantic-gcc-query
semantic-gcc-query is a byte-compiled function defined in gcc.el.gz.
Signature
(semantic-gcc-query GCC-CMD &rest GCC-OPTIONS)
Documentation
Return program output or error code in case error happens.
GCC-CMD is the program to execute and GCC-OPTIONS are the options to give to the program.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/gcc.el.gz
;;; Code:
(defun semantic-gcc-query (gcc-cmd &rest gcc-options)
"Return program output or error code in case error happens.
GCC-CMD is the program to execute and GCC-OPTIONS are the options
to give to the program."
;; $ gcc -v
;;
(let* ((buff (get-buffer-create " *gcc-query*"))
(old-lc-messages (getenv "LC_ALL"))
(options `(,nil ,(cons buff t) ,nil ,@gcc-options))
(err 0))
(with-current-buffer buff
(erase-buffer)
(setenv "LC_ALL" "C")
(condition-case nil
(setq err (apply #'call-process gcc-cmd options))
(error ;; Some bogus directory for the first time perhaps?
(let ((default-directory (expand-file-name "~/")))
(condition-case nil
(setq err (apply #'call-process gcc-cmd options))
(error ;; gcc doesn't exist???
nil)))))
(setenv "LC_ALL" old-lc-messages)
(prog1
(if (zerop err)
(buffer-string)
err)
(kill-buffer buff)))))