#!/usr/local/bin/perl
;#
;# Copyright (c) 1996, Ikuo Nakagawa.
;# All rights reserved.
;#
;# $Id: mkdirinfo,v 1.2 1997/05/22 08:39:27 ikuo Exp $
;#
;# mkdirinfo - generate directory information.
;#

;# IMPORTANT: change to the package directory
$prefix = '/usr/local/lib/ftpmirror';
unshift(@INC, $prefix);

;# modules
use Getopt::Std;
require "dirinfo.pl";
require "log.pl";

;# prototypes - for perl5.003 or later
;# sub usage();

;# store he basename of current program name
($program) =~ ($0 =~ m#([^/]+)$#);

;# print usage and exit
sub usage {
 die("Usage: $program [-rd] directory [directory...]\n");
}

;# parsing options and do real work
&getopts("rd") || &usage;
$opt_r = 0 if !defined($opt_r);
$opt_d = 0 if !defined($opt_d);

;#
log::mask("DEBUG") if $opt_d;

;# ARGV are directories to make dirinfo
for $dir (@ARGV) {
 # first, we go to the working directory
 chdir($dir) || do { warn("chdir($dir): $!"), next };
 dirinfo::update_dirinfo($dir);
}
