#!/usr/bin/perl
# 
# Create directory in Akai S3000 file system
# Copyright (c) 1997, Hiroyuki Ohsaki.
# All rights reserved.
# 
# $Id: akaimkdir,v 1.2 1998/06/30 01:35:23 oosaki Exp ohsaki $
# 

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

use Synth::AkaiDisk;
use Getopt::Std;
use File::Basename;
use integer;
use strict;

sub usage {
    my $prog = basename($0);
    die <<EOF
usage: $prog [-f file] [-p partition] dir...
 -f file  specify Akai disk image (default \$AKAI_DISK)
 -p part  read from part-th partition (default 1)
EOF
}

getopts('f:p:') || usage;

my $file = $::opt_f || $ENV{AKAI_DISK} || '/dev/mo';
my $part = $::opt_p || 1;

my $disk = new Synth::AkaiDisk($file, $part, 1) || die "new: $file: $!\n";

my $dir;
for $dir (@ARGV) {
    $disk->mkdir($dir) || die "mkdir: $dir: $!\n";
}

__END__

=head1 NAME

akaimkdir - create a new directory on HDD in Akai S3000 format

=head1 SYNOPSIS

  akaimkdir [-f file] [-p partition] dir...

=head1 DESCRIPTION

This manual page documents B<akaimkdir>.  This program creates a new
directory in HDD of Akai S1000/S3000 format as like the I<mkdir(1)>
command in UNIX systems.

The notation of the directory name, I<dir>, in B<akaimkdir> is almost
equivalent to that of conventional UNIX systems.  See L<akailist(1)>
for more detail.

=head1 OPTIONS

=over 4

=item C<-f> file

Specify the regular file of Akai disk image or the block device file
of Akai HDD/CD-ROM.  Usually, this should be the block device of HDD
or CD-ROM such as F</dev/sda>.  If this option is omitted, the
environment variable I<AKAI_DISK> is used as the default device.  If
I<AKAI_DISK> is not defined, F</dev/mo> is assumed.

=item C<-p> partition

Specify the partition number for which B<akaimkdir> works.  The first
partition is 1.  By default, the first partition is used.

=back

=head1 EXAMPLES

This section shows several example usage of B<akaimkdir>.

=over 4

=item - Make a new directory named F</FOO> in the second partition.

  akaimkdir -p1 /foo

=back

=head1 SEE ALSO

akaitools(1), akaiformat(1), akailist(1), akaimkdir(1), akairead(1),
akaiwrite(1), epslist(1), epsread(1), eps2akai(1), wav2akai(1),
any2akai(1), akaiconv(1) 

=head1 AUTHOR

Hiroyuki Ohsaki <ohsaki@lsnl.jp>

=cut

