summaryrefslogtreecommitdiff
path: root/Build/source/utils/gzip/sample/ztouch
blob: e408e2bc50bdd5c24ec823ad29a198125159508b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#! /usr/local/bin/perl
# Set the time stamp of a gzip'ed file from that stored in the file.
# usage: ztouch files...

foreach $file (@ARGV) {
    open (FILE, $file);
    read (FILE, $_, 8);
    ($magic, $method, $flags, $time) = unpack ("A2C2V", $_);
    if ($magic eq "\037\213") {
	utime ($time, $time, $file);
    }
    else {
	warn "$file is not compressed with gzip!\n";
    }
}