#!/usr/local/bin/perl

# @(#)$Id: fixtime,v 1.1 1998/09/06 03:43:13 twitham Rel $

# Copyright (C) 1998 Tim Witham <twitham@pcocd2.intel.com>

# (see the files README and COPYING for more details)

# This is a simple maintenance script to copy access and modification
# timestamps of the .bin files to their respective .tab files so the
# new Makefile.data doesn't need to remake the .tab files.  wx200d
# version 0.7 or above correctly sets modification time of .tab equal
# or greater than .bin so this only needs run if you have files
# generated by version 0.6 or less.

$go = $ARGV[0] eq 'go';		# dry run by default; say go to really go

opendir(DIR, '.') || die;
for $bin (sort(grep(/\.bin/, readdir(DIR)))) {
    ($tab = $bin) =~ s/\.bin/.tab/;
    next unless -e $tab;
    ($a, $m) = (stat($bin))[8,9];
    utime($a, $m, $tab) || warn "$0: can't utime $tab: $!\n"
	if $go;
    ($A, $M) = (stat($tab))[8,9];
    print "$bin ($a, $m) -> $tab ($A, $M)\n";
}
print "NOTHING DONE!  say `$0 go'
to really update access & modtime of .tab files to be same as .bin files.\n"
    unless $go;
