chiark
/
gitweb
/
~mdw
/
xfonts-traditional
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4235eb1
)
option parsing
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 7 Jan 2012 17:09:48 +0000
(17:09 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 7 Jan 2012 17:09:48 +0000
(17:09 +0000)
utility
patch
|
blob
|
blame
|
history
diff --git
a/utility
b/utility
index 26ed2433c8374cf651feb91af0e13b8bd986f684..8cff135ab8b689fd99e3a538b17c7a526031100c 100755
(executable)
--- a/
utility
+++ b/
utility
@@
-2,8
+2,12
@@
use strict;
use POSIX;
use IO::File;
use strict;
use POSIX;
use IO::File;
+use Getopt::Long;
-our @rulespath=('.');
+our $package='xfonts-traditional';
+our $sharedir="/usr/share/$package";
+our @rulespath;
+our $mode;
sub loadrules ($) {
my ($key) = @_;
sub loadrules ($) {
my ($key) = @_;
@@
-79,9
+83,34
@@
sub processbdf ($$) {
die unless $state eq 'idle';
}
die unless $state eq 'idle';
}
-processbdf((new IO::File '<&STDIN'),
- (new IO::File '>&STDOUT'));
+our (@options)=(
+ 'R|rules-include=s@' => \@rulespath,
+ 'share-dir=s' => \$sharedir,
+ );
+sub define_mode ($$) {
+ my ($optname,$f) = @_;
+ push @options, $optname, sub {
+ die "only one mode may be specified\n" if defined $mode;
+ $mode=$f;
+ };
+}
+
+define_mode('bdf-filter', sub {
+ die if @ARGV;
+
+ processbdf((new IO::File '<&STDIN'),
+ (new IO::File '>&STDOUT'));
+});
+
+Getopt::Long::Configure(qw(bundling));
+GetOptions(@options) or exit 127;
+
+push @rulespath, "$sharedir/rules" unless @rulespath;
+
+die "need a mode\n" unless $mode;
+
+$mode->();
# 70 zcat /usr/share/fonts/X11/misc/6x13.pcf.gz |pcf2bdf >in.bdf
# 71 ./utility <in.bdf >out.bdf
# 70 zcat /usr/share/fonts/X11/misc/6x13.pcf.gz |pcf2bdf >in.bdf
# 71 ./utility <in.bdf >out.bdf