Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Lisp is fucking shit!

Name: Anonymous 2012-03-07 6:18

I'm trying to invoke shell command (trivial-shell:shell-command "pwd") and it tries to create temporary file inside current directory, which happens to be "/", with a shitty code like
(loop thereis (open (format nil "TEMP-~D" (random 100000))
               :direction :probe :if-exists nil
               :if-does-not-exist :create)


Of course that results into "error opening #P"/TEMP-12698": Permission denied"

That is why we cant have nice things. Everything will be wrong and fail. I hate you all!

Name: Anonymous 2012-03-07 6:22

Do you believe me?!! Lisp has no fucking standard way to create a tmp file!

Name: Anonymous 2012-03-07 6:23

>>1
(random 100000)
And what if one happens to open more than 100000 files?

Name: Anonymous 2012-03-07 7:43

Name: Anonymous 2012-03-07 7:59

>>4
I cant use osicat, cause I'm not a maintainer of trivial-shell. And a maintainer of trivial-shell cant use osicat cause he is too retarded.

Name: Anonymous 2012-03-07 8:16

Oh my, you have such impeccable deductive skills.

Name: Anonymous 2012-03-07 10:18

You're doing it so wrong. Read the relevant documentation. Besides, do you even need a temporary file? You can make in-memory streams quite easily and have those streams backed by files if you want.

Name: Anonymous 2012-03-07 10:40

>>7
You're doing it so wrong
Please, kindly fuck off. I'm not the author of http://common-lisp.net/project/trivial-shell/

Name: Anonymous 2012-03-07 11:00

>>8
So what? He's still ``doing it wrong''.

Name: Anonymous 2012-03-07 11:18

>>9
choke on a cock

Name: Anonymous 2012-03-07 12:21


(defcfun "malloc" :pointer (count :int))
(defcfun "tmpnam" :string (buffer :pointer))
(tmpnam (malloc 1000))


That is how one does that. There is no need to be clever retard.

Name: Anonymous 2012-03-07 13:14


(defun shell (command)
  (let ((tmp (generate-temporary-name)))
    (libc::system (format nil "bash -c '~a' > '~a'" command tmp))
    (let* ((r (with-fopen (file tmp "r")
                (let ((l (libc::fsize file)))
                  (with-malloc (buf l)
                    (libc::fread buf 1 l file)
                    (cffi::foreign-string-to-lisp buf))))))
      (libc::unlink tmp)
      r)))

Name: Anonymous 2012-03-07 15:38

have you considered javascript?

Name: Anonymous 2012-03-07 15:50

FILE *MakeTempFile() {
 char strBuffer[6];
 char strBuffer2[256+1];
 system("echo %random% > temp.tmp");
 FILE *fpAnus = fopen("temp.tmp", "r");
 fgets(strBuffer, 6, fpAnus);
 fclose(fpAnus);
 remove("temp.tmp");
 sprintf(strBuffer2, "C:\temp\TMP%s.FIL", strBuffer);
 FILE *fpTempfile = fopen(strBuffer2, "w+");
 return(fpTempfile);
}

Don't change these.
Name: Email:
Entire Thread Thread List