Changeset 31898

Show
Ignore:
Timestamp:
17.08.2017 16:15:10 (3 months ago)
Author:
ak19
Message:

With Kathy's commit 31896 doing away with the need for the recently introduced gsprintf_multiline() by moving the regex replacements of backslash-n (and backslash-t) with newline and tab into gsprint::lookup_string, can now shift WebDownload? calls to gsprintf_multine to use regular gsprintf. Putting back the original gsprintf method as gsprintf_multiline is no longer needed.

Location:
main/trunk/greenstone2/perllib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/downloaders/WebDownload.pm

    r31880 r31898  
    203203     
    204204    if ($self->{'proxy_on'}) { # if proxying set, the settings may be wrong 
    205         &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.proxied_connect_failed_info}\n"); 
     205        &gsprintf::gsprintf(STDERR, "{WebDownload.proxied_connect_failed_info}\n"); 
    206206         
    207207        if($self->{'http_proxy_host'} && defined $self->{'http_proxy_port'}) { 
    208         &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.http_proxy_settings}\n", $self->{'http_proxy_host'}, $self->{'http_proxy_port'}); 
     208        &gsprintf::gsprintf(STDERR, "{WebDownload.http_proxy_settings}\n", $self->{'http_proxy_host'}, $self->{'http_proxy_port'}); 
    209209        } 
    210210        if($self->{'https_proxy_host'} && defined $self->{'https_proxy_port'}) { 
    211         &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.https_proxy_settings}\n", $self->{'https_proxy_host'}, $self->{'https_proxy_port'}); 
     211        &gsprintf::gsprintf(STDERR, "{WebDownload.https_proxy_settings}\n", $self->{'https_proxy_host'}, $self->{'https_proxy_port'}); 
    212212        } 
    213213        if($self->{'ftp_proxy_host'} && defined $self->{'ftp_proxy_port'}) { 
    214         &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.ftp_proxy_settings}\n", $self->{'ftp_proxy_host'}, $self->{'ftp_proxy_port'}); 
     214        &gsprintf::gsprintf(STDERR, "{WebDownload.ftp_proxy_settings}\n", $self->{'ftp_proxy_host'}, $self->{'ftp_proxy_port'}); 
    215215        } 
    216216    } else { # else no proxy set, the user may need proxy settings 
    217         &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.proxyless_connect_failed_info}\n"); 
     217        &gsprintf::gsprintf(STDERR, "{WebDownload.proxyless_connect_failed_info}\n"); 
    218218    } 
    219219     
     
    221221    # but the site had no valid certificate and no_check_certificate wasn't turned on 
    222222    # suggest to the user to try turning it on 
    223     &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.connect_failed_info}\n"); 
     223    &gsprintf::gsprintf(STDERR, "{WebDownload.connect_failed_info}\n"); 
    224224     
    225225    print STDERR "<<Finished>>\n"; 
  • main/trunk/greenstone2/perllib/gsprintf.pm

    r31896 r31898  
    7171sub gsprintf 
    7272{ 
    73     my ($handle, $text_string, @text_arguments) = @_;     
    74     _gsprintf($handle, $text_string, 0, @text_arguments); 
    75 } 
    76  
    77 sub gsprintf_multiline 
    78 { 
    7973    my ($handle, $text_string, @text_arguments) = @_; 
    80     _gsprintf($handle, $text_string, 1, @text_arguments); 
    81 } 
    82  
    83 sub _gsprintf 
    84 { 
    85     my ($handle, $text_string, $multiline, @text_arguments) = @_; 
    8674 
    8775    # Return unless the required arguments were supplied 
     
    9381    # Resolve the string arguments using sprintf, then write out to the handle 
    9482    my $text_string_resolved = sprintf($text_string, @text_arguments); 
    95  
    96     if($multiline) { # replace newlines 
    97     $text_string_resolved =~ s@\\n@\n@g; 
    98     } 
    9983     
    10084    if ($freetext_xml_mode) {