source:
patches/mktemp-1.5-add_tempfile-3.patch@
7bb164dc
Last change on this file since 7bb164dc was 69cde8d, checked in by , 19 years ago | |
---|---|
|
|
File size: 3.5 KB |
-
Makefile.in
Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org> Date: 2005-07-25 Initial Package Version: 1.5 Upstream Status: Sent, no response yet. Origin: http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2003-April/033602.html http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2003-June/035234.html http://linuxfromscratch.org/pipermail/lfs-dev/2005-June/051908.html Description: Add tempfile wrapper script. Use "make install-tempfile" to install it. diff -Naur mktemp-1.5.orig/Makefile.in mktemp-1.5/Makefile.in
old new 113 113 install-man: 114 114 $(INSTALL) -m 0444 $(srcdir)/$(PROG).$(mantype) $(mandir)/man1/$(PROG).1 115 115 116 install-tempfile: $(srcdir)/tempfile 117 $(INSTALL) -m 0555 $(srcdir)/tempfile $(bindir)/tempfile 118 116 119 check: 117 120 @echo nothing to check 118 121 -
mktemp-1.5
diff -Naur mktemp-1.5.orig/tempfile mktemp-1.5/tempfile
old new 1 #!/bin/bash 2 # A tempfile wrapper for mktemp 3 # Note: If you can, avoid using tempfile and use mktemp instead. 4 # This wrapper is provided for compatibility since some scripts use 5 # tempfile. If possible, the best solution is to patch the scripts 6 # to use mktemp. 7 # 8 # Copyright (c) Tushar Teredesai <tush@yahoo.com> 9 # 10 # Permission to use, copy, modify, and distribute this software for any 11 # purpose with or without fee is hereby granted, provided that the above 12 # copyright notice and this permission notice appear in all copies. 13 # 14 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 15 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 16 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 17 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 18 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 19 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 20 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21 # 22 23 # Usage info 24 usage() 25 { 26 echo "Usage: tempfile [OPTION]" 27 echo 28 echo "Create a temporary file in a safe manner." 29 echo "This version is a wrapper that invokes mktemp." 30 echo "NOTE: Do not use tempfile in your scripts." 31 echo " Use mktemp instead." 32 echo 33 echo "[-d|--directory] DIR -> place temporary file in DIR" 34 echo "[-p|--prefix] PREFIX -> ignored" 35 echo "[-s|--suffix] SUFFIX -> ignored" 36 echo "[-n|--name] NAME -> ignored" 37 echo "[-m|--mode] MODE -> ignored" 38 echo "--version -> output version information and exit" 39 } 40 41 # parse all arguments 42 while [ $# != 0 ] 43 do 44 case "$1" in 45 # -d for tempfile is equivalent to -p for mktemp 46 -d|--directory) 47 dir="$2" 48 shift 2 49 ;; 50 --directory=*) 51 dir="${1#--directory=}" 52 shift 1 53 ;; 54 -d*) 55 dir="${1#-d}" 56 shift 1 57 ;; 58 # The following switches are ignored. 59 -p|--prefix|-s|--suffix|-n|--name|-m|--mode) 60 shift 2 61 ;; 62 -p*|--prefix=*|-s*|--suffix=*|-n*|--name=*|-m*|--mode=*) 63 shift 1 64 ;; 65 # --version for tempfile is equivalent to -V for mktemp 66 --version) 67 echo "tempfile 1.0 (`mktemp -V 2>/dev/null`)" 68 exit 0 69 ;; 70 # Unknown switch 71 *) 72 usage 73 exit 1 74 ;; 75 esac 76 done 77 78 # Use the dir if $TMPDIR is not set. 79 if [ -z "$TMPDIR" -a ! -z "$dir" ] 80 then 81 export TMPDIR="$dir" 82 fi 83 # Execute mktemp with proper arguments 84 # the -t behaviour of mktemp is the default for tempfile 85 exec mktemp -t
Note:
See TracBrowser
for help on using the repository browser.