Subversion Repositories OpenARM Single-board Computer

Rev

Rev 318 | Rev 322 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 318 Rev 319
Line 1... Line 1...
1
#!/usr/bin/perl -w
1
#!/usr/bin/perl -w
2
use strict;
2
use strict;
3
# $Id: inventory.pl 318 2008-12-29 10:58:58Z agaran $
3
# $Id: inventory.pl 319 2008-12-29 11:08:59Z agaran $
4
# Thu, 13 Nov 2008 21:06:23 +0100
4
# Thu, 13 Nov 2008 21:06:23 +0100
5
# Maciej 'agaran' Pijanka <agaran@pld-linux.org>
5
# Maciej 'agaran' Pijanka <agaran@pld-linux.org>
6
# for OpenARM SBC Project
6
# for OpenARM SBC Project
7
# license: gpl v3
7
# license: gpl v3
8
 
8
 
Line 62... Line 62...
62
	printf "Help for %s\n----------------------------------------\n", basename($0);
62
	printf "Help for %s\n----------------------------------------\n", basename($0);
63
	unless (defined($_[1]) && length($_[1]) != 0) {
63
	unless (defined($_[1]) && length($_[1]) != 0) {
64
		print "Basic help\n\t--showrc|showconf shows current configuration\n".
64
		print "Basic help\n\t--showrc|showconf shows current configuration\n".
65
			"\t--docdir|-d <dir> tells script where information.txt files should be searched\n".
65
			"\t--docdir|-d <dir> tells script where information.txt files should be searched\n".
66
			"\t--define <something>=<somethingelseornot> defines some configration value\n".
66
			"\t--define <something>=<somethingelseornot> defines some configration value\n".
67
			"\t--verbose|-v [level] sets verbosity level\nOrder of options DOES matter\n";
67
			"\t--verbose|-v [level] sets verbosity level\nOrder of options DOES matter\n".
-
 
68
			"\t--bomdir|-b <dir> tells script where boms should be searched\n";
-
 
69
 
-
 
70
		print "\t\e[0;31mThis Help Is created especially for \e[0;33mJelle\e[0;29m\n".
-
 
71
			"\tThis script search all directories below specified ones to find interesting files\n";
68
		return;
72
		return;
69
	} 
73
	} 
70
	if ($_[1] =~ /^foo$/) {
74
	if ($_[1] =~ /^foo$/) {
71
		print "Noo, there is no foo's here\n";
75
		print "Noo, there is no foo's here\n";
72
	} else {
76
	} else {
Line 362... Line 366...
362
	return 0;
366
	return 0;
363
}
367
}
364
 
368
 
365
Getopt::Long::Configure("bundling");
369
Getopt::Long::Configure("bundling");
366
 
370
 
-
 
371
if (scalar @ARGV == 0) {
-
 
372
	Help_Show();
-
 
373
	exit;
-
 
374
}
-
 
375
 
367
my $result = Getopt::Long::GetOptions (
376
my $result = Getopt::Long::GetOptions (
368
	"showrc|showconf" => sub { $show_conf = 1 },
377
	"showrc|showconf" => sub { $show_conf = 1 },
369
	"docdir|d=s" => sub { $Config{docdir} = $_[1]; },
378
	"docdir|d=s" => sub { $Config{docdir} = $_[1]; },
370
	# not sure if bomdir or SCH dir
379
	# not sure if bomdir or SCH dir
371
	"bomdir|b=s" => sub { $Config{$_[0]} = $_[1]; },  # $_[0] contain basename of option, so in few cases could be (ab)used
380
	"bomdir|b=s" => sub { $Config{$_[0]} = $_[1]; },  # $_[0] contain basename of option, so in few cases could be (ab)used
Line 441... Line 450...
441
	printf PARTMAP "%-35s|%s\n", shortstring($Inv[$id]{Description},35), join (', ', @{$BomData{$id}{RefDes}});
450
	printf PARTMAP "%-35s|%s\n", shortstring($Inv[$id]{Description},35), join (', ', @{$BomData{$id}{RefDes}});
442
	$cost += $icost;
451
	$cost += $icost;
443
#	%BomData{ById}{$id}{RefDes}
452
#	%BomData{ById}{$id}{RefDes}
444
	$n ++;
453
	$n ++;
445
}
454
}
446
printf BOMOUT "|%s|\n| %-118s|\n|%s|\n", ("-" x 119), sprintf ("Total cost: %.3f", $cost), ("-" x 119); 
455
printf BOMOUT "|%s|\n| %-118s|\n|%s|\n", ("-" x 119), sprintf ("Total cost: %.3f, generated at %s", $cost, scalar localtime(time())), ("-" x 119); 
447
 
456
 
448
close BOMOUT;
457
close BOMOUT;
449
close PARTMAP;
458
close PARTMAP;