Ignore:
Timestamp:
2004-03-04T15:47:20+13:00 (20 years ago)
Author:
mdewsnip
Message:

Updated to use gsprintf in preparation for adding the French/Spanish/Russian translations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/pluginfo.pl

    r5882 r6921  
    6363        'args' => $arguments };
    6464
    65 
    66 sub lookup_string
     65sub gsprintf
    6766{
    68     return &gsprintf::lookup_string($language, shift(@_));
     67    return &gsprintf::gsprintf(@_);
    6968}
    70 
    71 
    72 sub print_txt_usage
    73 {
    74     local $language = shift(@_);
    75 
    76     local $programname = $options->{'name'};
    77     local $programargs = $options->{'args'};
    78 
    79     # Find the length of the longest option string
    80     local $descoffset = 0;
    81     if (defined($programargs)) {
    82     $descoffset = &PrintUsage::find_longest_option_string($programargs);
    83     }
    84 
    85     # Produce the usage information using the data structure above
    86     print STDERR $programname . ": " . &lookup_string($options->{'desc'}) . "\n\n";
    87     print STDERR " " . &lookup_string("{common.usage}") . ": $programname";
    88     print STDERR " " . &lookup_string("{pluginfo.params}") . "\n\n";
    89 
    90     # Display the program options, if there are some
    91     if (defined($programargs)) {
    92     # Calculate the column offset of the option descriptions
    93     local $optiondescoffset = $descoffset + 2;  # 2 spaces between options & descriptions
    94 
    95     print STDERR " " . &lookup_string("{common.options}") . ":\n";
    96 
    97     # Display the program options
    98     &PrintUsage::print_options_txt($language, $programargs, $optiondescoffset);
    99     }
    100 }
    101 
    10269
    10370
     
    11279             q^language/.*/^, \$language))
    11380    {
    114     &print_txt_usage($language);
     81    &PrintUsage::print_txt_usage($language, $options, "{pluginfo.params}", 1);
    11582    die "\n";
    11683    }
     
    11885    my $plugin = shift (@ARGV);
    11986    if (!defined $plugin || $plugin eq "") {
    120     print STDERR &lookup_string("{pluginfo.no_plugin_name}") . "\n\n";
    121     &print_txt_usage($language);
     87    &gsprintf(STDERR, "{pluginfo.no_plugin_name}\n\n");
     88    &PrintUsage::print_txt_usage($language, $options, "{pluginfo.params}", 1);
    12289    die "\n";
    12390    }
     
    136103    }
    137104    else {
    138     print STDERR "\n$plugin " . &lookup_string("{pluginfo.info}") . ":\n\n";
    139     print STDERR &lookup_string("{pluginfo.passing_options}") . "\n\n";
    140     print STDERR &lookup_string("{pluginfo.option_types}") . ":\n\n";
    141     print STDERR &lookup_string("{pluginfo.specific_options}") . "\n\n";
    142     print STDERR &lookup_string("{pluginfo.general_options}") . "\n\n";
     105    &gsprintf(STDERR, "\n$plugin {pluginfo.info}:\n\n");
     106    &gsprintf(STDERR, "{pluginfo.passing_options}\n\n");
     107    &gsprintf(STDERR, "{pluginfo.option_types}:\n\n");
     108    &gsprintf(STDERR, "{pluginfo.specific_options}\n\n");
     109    &gsprintf(STDERR, "{pluginfo.general_options}\n\n");
    143110
    144111    $plugobj->print_txt_usage($language);
     
    155122    $pid = open(STDIN, "-|"); # this does a fork... see man perlipc(1)
    156123    if (!defined $pid) {
    157     print STDERR "pluginfo.pl - can't fork: $!";
     124    &gsprintf(STDERR, "pluginfo.pl - can't fork: $!");
    158125    } else {
    159126    if ($pid != 0) { # parent (ie forking) process. child gets 0
Note: See TracChangeset for help on using the changeset viewer.