Guest User

Untitled

a guest
Dec 30th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.84 KB | None | 0 0
  1. (defun diff-strings (string1 string2)
  2.   (let (realpath1 realpath2 fullpath return)
  3.    (uiop:with-temporary-file (:pathname path1 :keep t :directory "/tmp")
  4.      (uiop:with-temporary-file (:pathname path2 :keep t :directory "/tmp")
  5.        (with-open-file (file1 path1 :direction :output)
  6.          (with-open-file (file2 path2 :direction :output)
  7.            (setq realpath1 path1
  8.                  realpath2 path2)
  9.            (princ string1 file1)
  10.            (princ string2 file2)))))
  11.    (setq fullpath (list "/usr/bin/diff" (uiop:native-namestring realpath1) (uiop:native-namestring realpath2)))
  12.    (setq return (uiop:run-program fullpath
  13.                                   :output :string
  14.                                   :ignore-error-status t))
  15.    (uiop:delete-file-if-exists realpath1)
  16.    (uiop:delete-file-if-exists realpath2)
  17.    return))
Advertisement
Add Comment
Please, Sign In to add comment