comparison lisp/progmodes/sh-script.el @ 65996:a001884be063

(sh-tmp-file): Use mktemp.
author Richard M. Stallman <rms@gnu.org>
date Mon, 10 Oct 2005 21:23:45 +0000
parents 5c0acc1c2a2c
children 61174c5e6da6
comparison
equal deleted inserted replaced
65995:e081ee8c2eb2 65996:a001884be063
3390 3390
3391 (define-skeleton sh-tmp-file 3391 (define-skeleton sh-tmp-file
3392 "Insert code to setup temporary file handling. See `sh-feature'." 3392 "Insert code to setup temporary file handling. See `sh-feature'."
3393 (bash sh-append ksh88) 3393 (bash sh-append ksh88)
3394 (csh (file-name-nondirectory (buffer-file-name)) 3394 (csh (file-name-nondirectory (buffer-file-name))
3395 "set tmp = /tmp/" str ".$$" \n 3395 "set tmp = `mktemp /tmp/" str ".XXXXXX`" \n
3396 "onintr exit" \n _ 3396 "onintr exit" \n _
3397 (and (goto-char (point-max)) 3397 (and (goto-char (point-max))
3398 (not (bolp)) 3398 (not (bolp))
3399 ?\n) 3399 ?\n)
3400 "exit:\n" 3400 "exit:\n"
3401 "rm $tmp* >&/dev/null" > \n) 3401 "rm $tmp* >&/dev/null" > \n)
3402 ;; The change to use mktemp here has not been tested;
3403 ;; I don't know es syntax, so I had to guess.
3404 ;; If you try it, or if you know es syntax and can check it,
3405 ;; please tell me whether it needs any change. --rms.
3402 (es (file-name-nondirectory (buffer-file-name)) 3406 (es (file-name-nondirectory (buffer-file-name))
3403 > "local( signals = $signals sighup sigint; tmp = /tmp/" str 3407 > "local( signals = $signals sighup sigint; tmp = `mktemp /tmp/" str
3404 ".$pid ) {" \n 3408 ".XXXXXX` ) {" \n
3405 > "catch @ e {" \n 3409 > "catch @ e {" \n
3406 > "rm $tmp^* >[2]/dev/null" \n 3410 > "rm $tmp^* >[2]/dev/null" \n
3407 "throw $e" \n 3411 "throw $e" \n
3408 "} {" > \n 3412 "} {" > \n
3409 _ \n 3413 _ \n
3410 ?\} > \n 3414 ?\} > \n
3411 ?\} > \n) 3415 ?\} > \n)
3412 (ksh88 sh-modify sh 3416 (ksh88 sh-modify sh
3413 7 "EXIT") 3417 7 "EXIT")
3418 ;; The change to use mktemp here has not been tested;
3419 ;; I don't know rc syntax, so I had to guess.
3420 ;; If you try it, or if you know rc syntax and can check it,
3421 ;; please tell me whether it needs any change. --rms.
3414 (rc (file-name-nondirectory (buffer-file-name)) 3422 (rc (file-name-nondirectory (buffer-file-name))
3415 > "tmp = /tmp/" str ".$pid" \n 3423 > "tmp = `mktemp /tmp/" str ".XXXXXX`" \n
3416 "fn sigexit { rm $tmp^* >[2]/dev/null }" \n) 3424 "fn sigexit { rm $tmp^* >[2]/dev/null }" \n)
3417 (sh (file-name-nondirectory (buffer-file-name)) 3425 (sh (file-name-nondirectory (buffer-file-name))
3418 > "TMP=${TMPDIR:-/tmp}/" str ".$$" \n 3426 > "TMP=`mktemp ${TMPDIR:-/tmp}/" str ".XXXXXX`" \n
3419 "trap \"rm $TMP* 2>/dev/null\" " ?0 \n)) 3427 "trap \"rm $TMP* 2>/dev/null\" " ?0 \n))
3420 3428
3421 3429
3422 3430
3423 (define-skeleton sh-until 3431 (define-skeleton sh-until