diff options
| author | Kris Kennaway <kris@FreeBSD.org> | 1999-05-28 13:23:27 +0000 |
|---|---|---|
| committer | Kris Kennaway <kris@FreeBSD.org> | 1999-05-28 13:23:27 +0000 |
| commit | 8a9cbccd6f708b709de55e3f68d8f6a8bf21908b (patch) | |
| tree | 60dffc5d1fe250117a868d3a273db9eb3a83b8e8 /gnu | |
| parent | 4011dfccd24eb067e51b8fb4c27e574528a93258 (diff) | |
Notes
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/usr.bin/gzip/algorithm.doc | 2 | ||||
| -rw-r--r-- | gnu/usr.bin/gzip/gzexe | 40 | ||||
| -rw-r--r-- | gnu/usr.bin/gzip/gzip.c | 10 | ||||
| -rw-r--r-- | gnu/usr.bin/gzip/zdiff | 3 | ||||
| -rw-r--r-- | gnu/usr.bin/gzip/zforce | 3 | ||||
| -rw-r--r-- | gnu/usr.bin/gzip/zgrep | 4 | ||||
| -rw-r--r-- | gnu/usr.bin/gzip/zmore | 3 | ||||
| -rw-r--r-- | gnu/usr.bin/gzip/zmore.1 | 4 | ||||
| -rw-r--r-- | gnu/usr.bin/gzip/znew | 3 |
9 files changed, 46 insertions, 26 deletions
diff --git a/gnu/usr.bin/gzip/algorithm.doc b/gnu/usr.bin/gzip/algorithm.doc index 24f7619ab6970..596faac18ab3a 100644 --- a/gnu/usr.bin/gzip/algorithm.doc +++ b/gnu/usr.bin/gzip/algorithm.doc @@ -48,7 +48,7 @@ match, thus speeding up the whole process. If compression ratio is more important than speed, zip attempts a complete second search even if the first match is already long enough. -The lazy match evaluation is no performed for the fastest compression +The lazy match evaluation is not performed for the fastest compression modes (speed options -1 to -3). For these fast modes, new strings are inserted in the hash table only when no match was found, or when the match is not too long. This degrades the compression ratio diff --git a/gnu/usr.bin/gzip/gzexe b/gnu/usr.bin/gzip/gzexe index 27b697b21c9e3..b6107261fe351 100644 --- a/gnu/usr.bin/gzip/gzexe +++ b/gnu/usr.bin/gzip/gzexe @@ -11,6 +11,8 @@ # WARNING: the first line of this file must be either : or #!/bin/sh # The : is required for some old versions of csh. # On Ultrix, /bin/sh is too buggy, change the first line to: #!/bin/sh5 +# +# $Id$ x=`basename $0` if test $# = 0; then @@ -20,7 +22,7 @@ if test $# = 0; then exit 1 fi -tmp=gz$$ +tmp=`/usr/bin/mktemp gzXXXXXXXXXX` || exit 1 trap "rm -f $tmp; exit 1" 1 2 3 5 10 13 15 decomp=0 @@ -31,12 +33,14 @@ if test "x$1" = "x-d"; then shift fi -echo hi > zfoo1$$ -echo hi > zfoo2$$ -if test -z "`(${CPMOD-cpmod} zfoo1$$ zfoo2$$) 2>&1`"; then +zfoo1=`/usr/bin/mktemp zfoo1XXXXXXXXXX` || exit 1 +zfoo2=`/usr/bin/mktemp zfoo2XXXXXXXXXX` || exit 1 +echo hi > $zfoo1 +echo hi > $zfoo2 +if test -z "`(${CPMOD-cpmod} $zfoo1 $zfoo2) 2>&1`"; then cpmod=${CPMOD-cpmod} fi -rm -f zfoo[12]$$ +rm -f $zfoo1 $zfoo2 tail="" IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" @@ -74,7 +78,7 @@ for i do continue fi case "`basename $i`" in - sh | gzip | tail | chmod | ln | sleep | rm) + sh | gzip | tail | chmod | ln | sleep | rm | mktemp) echo "${x}: $i would depend on itself"; continue ;; esac if test -z "$cpmod"; then @@ -89,21 +93,25 @@ for i do if test $decomp -eq 0; then sed 1q $0 > $tmp sed "s|^if tail|if $tail|" >> $tmp <<'EOF' -skip=18 -if tail +$skip $0 | gzip -cd > /tmp/gztmp$$; then - chmod 700 /tmp/gztmp$$ +skip=22 +gztmp=`/usr/bin/mktemp /tmp/gztmpXXXXXXXXXX` || exit 1 +if tail +$skip $0 | gzip -cd > $gztmp; then + chmod 700 $gztmp prog="`echo $0 | sed 's|^.*/||'`" - if /bin/ln /tmp/gztmp$$ "/tmp/$prog" 2>/dev/null; then - trap '/bin/rm -f /tmp/gztmp$$ "/tmp/$prog"; exit $res' 0 - (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$ "/tmp/$prog") 2>/dev/null & + progtmp=`/usr/bin/mktemp /tmp/${prog}XXXXXXXXXX` || exit 1 + if /bin/ln $gztmp $progtmp 2>/dev/null; then + trap '/bin/rm -f $gztmp $progtmp; exit $res' 0 + (/bin/sleep 5; /bin/rm -f $gztmp $progtmp) 2>/dev/null & /tmp/"$prog" ${1+"$@"}; res=$? else - trap '/bin/rm -f /tmp/gztmp$$; exit $res' 0 - (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$) 2>/dev/null & - /tmp/gztmp$$ ${1+"$@"}; res=$? + trap '/bin/rm -f $gztmp exit $res' 0 + (/bin/sleep 5; /bin/rm -f $gztmp) 2>/dev/null & + $gztmp ${1+"$@"}; res=$? fi else - echo Cannot decompress $0; exit 1 + echo Cannot decompress $0 + rm -f $gztmp + exit 1 fi; exit $res EOF gzip -cv9 "$i" >> $tmp || { diff --git a/gnu/usr.bin/gzip/gzip.c b/gnu/usr.bin/gzip/gzip.c index 7a666baba17e3..08803e3c13954 100644 --- a/gnu/usr.bin/gzip/gzip.c +++ b/gnu/usr.bin/gzip/gzip.c @@ -45,7 +45,7 @@ static char *license_msg[] = { */ #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.7 1997/03/15 22:43:58 guido Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.4 1998/11/22 20:03:21 deraadt Exp $"; #endif #include <ctype.h> @@ -521,7 +521,13 @@ int main (argc, argv) if (*optarg == '.') optarg++; #endif z_len = strlen(optarg); - strcpy(z_suffix, optarg); + if (z_len > sizeof(z_suffix)-1) { + fprintf(stderr, "%s: -S suffix too long\n", progname); + usage(); + do_exit(ERROR); + } + strncpy(z_suffix, optarg, sizeof z_suffix-1); + z_suffix[sizeof z_suffix-1] = '\0'; break; case 't': test = decompress = to_stdout = 1; diff --git a/gnu/usr.bin/gzip/zdiff b/gnu/usr.bin/gzip/zdiff index 84e65d329efba..a8ba5fe6324c8 100644 --- a/gnu/usr.bin/gzip/zdiff +++ b/gnu/usr.bin/gzip/zdiff @@ -8,8 +8,9 @@ # If two files are specified, then they are uncompressed (if # necessary) and fed to cmp or diff. The exit status from cmp # or diff is preserved. +# +# $Id$ -PATH="/usr/local/bin:$PATH"; export PATH prog=`echo $0 | sed 's|.*/||'` case "$prog" in *cmp) comp=${CMP-cmp} ;; diff --git a/gnu/usr.bin/gzip/zforce b/gnu/usr.bin/gzip/zforce index 17258a4855f94..808b0d0f9c4fb 100644 --- a/gnu/usr.bin/gzip/zforce +++ b/gnu/usr.bin/gzip/zforce @@ -4,8 +4,9 @@ # # This can be useful for files with names truncated after a file transfer. # 12345678901234 is renamed to 12345678901.gz +# +# $Id$ -PATH="/usr/local/bin:$PATH"; export PATH x=`basename $0` if test $# = 0; then echo "force a '.gz' extension on all gzip files" diff --git a/gnu/usr.bin/gzip/zgrep b/gnu/usr.bin/gzip/zgrep index bcc10cc1dba2c..32a27457de0c0 100644 --- a/gnu/usr.bin/gzip/zgrep +++ b/gnu/usr.bin/gzip/zgrep @@ -2,8 +2,8 @@ # zgrep -- a wrapper around a grep program that decompresses files as needed # Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca> - -PATH="/usr/local/bin:$PATH"; export PATH +# +# $Id$ prog=`echo $0 | sed 's|.*/||'` case "$prog" in diff --git a/gnu/usr.bin/gzip/zmore b/gnu/usr.bin/gzip/zmore index ca933c7118212..2590423333c2e 100644 --- a/gnu/usr.bin/gzip/zmore +++ b/gnu/usr.bin/gzip/zmore @@ -1,6 +1,7 @@ #!/bin/sh +# +# $Id$ -PATH="/usr/local/bin:$PATH"; export PATH if test "`echo -n a`" = "-n a"; then # looks like a SysV system: n1=''; n2='\c' diff --git a/gnu/usr.bin/gzip/zmore.1 b/gnu/usr.bin/gzip/zmore.1 index f7f1843de01a2..3c9d928cfd992 100644 --- a/gnu/usr.bin/gzip/zmore.1 +++ b/gnu/usr.bin/gzip/zmore.1 @@ -1,3 +1,5 @@ +.\" $Id$ +.\" .TH ZMORE 1 .SH NAME zmore \- file perusal filter for crt viewing of compressed text @@ -27,7 +29,7 @@ another screenful is displayed. Other possibilities are enumerated later. .PP .I Zmore looks in the file -.I /etc/termcap +.I /usr/share/misc/termcap to determine terminal characteristics, and to determine the default window size. On a terminal capable of displaying 24 lines, diff --git a/gnu/usr.bin/gzip/znew b/gnu/usr.bin/gzip/znew index 5c832e826ac25..53226c31ca876 100644 --- a/gnu/usr.bin/gzip/znew +++ b/gnu/usr.bin/gzip/znew @@ -1,6 +1,7 @@ #!/bin/sh +# +# $Id$ -PATH="/usr/local/bin:$PATH"; export PATH check=0 pipe=0 opt= |
