From 1c3cb74b82d461c113fcce109e8d3bb9b902b791 Mon Sep 17 00:00:00 2001 From: acli Date: Fri, 13 Feb 2004 01:20:03 +0000 Subject: [PATCH] Display something useful if the user doesn't specify -f --- misc/translator/text-extract2.pl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/misc/translator/text-extract2.pl b/misc/translator/text-extract2.pl index ee79eb02bc..4b7858aa8a 100755 --- a/misc/translator/text-extract2.pl +++ b/misc/translator/text-extract2.pl @@ -265,12 +265,23 @@ EOF exit($exitcode); } +############################################################################### + +sub usage_error (;$) { + print STDERR "$_[0]\n" if @_; + print STDERR "Try `$0 --help' for more information.\n"; + exit(-1); +} + +############################################################################### + GetOptions( 'f|file=s' => \$input, 'debug-dump-only' => \$debug_dump_only_p, 'pedantic-warnings' => sub { $pedantic_p = 1 }, 'help' => sub { usage(0) }, -) || exit(-1); +) || usage_error; +usage_error('Missing mandatory option -f') unless defined $input; open(INPUT, "<$input") || die "$0: $input: $!\n"; if ($debug_dump_only_p) { -- 2.39.5