
# command line parameter handling
# if there was no parameter, "-v time" will be used
$arg = "";
if ($#ARGV > 0)
{
  foreach (@ARGV) {
    $arg = $arg . "  $_";
  }
}
else
{
  $arg = "-v time";
}

# my log file directory
$log_dir = ".";

# make timestamp string
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
$timestamp = sprintf ("%4d%02d%02d_%02d%02d%02d", $year+1900,$mon+1,$mday,$hour,$min,$sec);


# run adb logcat
exec("adb logcat $arg | tee $log_dir/logcat_$timestamp.txt");


