Author: jfs
Date: Mon Jan 23 21:06:06 2017
New Revision: 11328

URL: http://svn.debian.org/wsvn/?sc=1&rev=11328
Log:

Consistent use of debugging statements in the program.

Modified:
    man-cgi/man.cgi

Modified: man-cgi/man.cgi
URL: http://svn.debian.org/wsvn/man-cgi/man.cgi?rev=11328&op=diff
==============================================================================
--- man-cgi/man.cgi     (original)
+++ man-cgi/man.cgi     Mon Jan 23 21:06:06 2017
@@ -621,7 +621,7 @@
            return 0; 
     }
 
-    print "X LANG $language and ENC $encoding\n x" if $debug;
+    print "DEBUG: LANG $language and ENC $encoding\n x" if $debug;
     $charset = '';     
     if ( $encoding && $encoding =~ /^[\w\_]+\.([\w\-]+)$/) {
 # Find out our charset
@@ -725,7 +725,7 @@
     }
 
 
-    print "X $manpath - $locale - $manPath{$manpath} x\n" if $debug;
+    print "DEBUG: $manpath - $locale - $manPath{$manpath} x\n" if $debug;
     if ($manpath) {
        if ($manPath{$manpath}) {
            unshift(@manargs, ('-M', $manPath{$manpath}));
@@ -745,16 +745,16 @@
     }
 
     if ( $section ) { 
-           print "X $command{'man'} @manargs -- $section $name x\n" if $debug;
+           print "DEBUG: $command{'man'} @manargs -- $section $name x\n" if 
$debug;
 #die "Section $section is tainted\n" if is_tainted($section);
            printenv() if $debug > 1;
-           print "X Calling $command{'man'} ".join(" ",@manargs)." for $name 
($section)\n" if $debug;
+           print "DEBUG: Calling $command{'man'} ".join(" ",@manargs)." for 
$name ($section)\n" if $debug;
            &proc(*MAN, $command{'man'}, @manargs, "--", $section, $name) ||
                    &mydie ("$0: open of $command{'man'} command failed: $!\n");
     } else {
-           print "X $command{'man'} @manargs -- $name x\n" if $debug;
+           print "DEBUG: $command{'man'} @manargs -- $name x\n" if $debug;
            printenv() if $debug > 1;
-           print "X Calling $command{'man'} ".join(" ",@manargs)." for $name 
(no section)\n" if $debug;
+           print "DEBUG: Calling $command{'man'} ".join(" ",@manargs)." for 
$name (no section)\n" if $debug;
            &proc(*MAN, $command{'man'}, @manargs, "--", $name) ||
                    &mydie ("$0: open of $command{'man'} command failed: $!\n");
     }
@@ -854,7 +854,7 @@
     close(MAN);
     print qq{</PRE>\n<a name="end">\n<hr noshade>\n};
     if ($outputlines == 0 ) {
-       print "X $command{'man'} @manargs -- $section $name x\n" if $debug;
+       print "DEBUG: $command{'man'} @manargs -- $section $name x\n" if $debug;
 # Set locale to 'en' if we are not given a locale
        $locale = "en" if !$locale;
        print "Sorry, no data found for `$html_name" .
@@ -1067,10 +1067,10 @@
 sub available_translations ($$) {
 # Print translations available for a given manual page
     local($name, $section) = @_;
-    print "X Checking available translations (name: $name, section: 
$section)\n" if $debug;
+    print "DEBUG: Checking available translations (name: $name, section: 
$section)\n" if $debug;
     return if $section eq '';
     local ($locald, $path, $found);
-    print "X Looking for available translations\n" if $debug;
+    print "DEBUG: Looking for available translations\n" if $debug;
     $found = 0 ;
     foreach $path (split(/:/, $manPath{$manpath}) ) {
 # Remove the current locale from the path if there is one
@@ -1081,12 +1081,15 @@
        }
 
        foreach $locald ( keys %locales ) {
+               print "DEBUG: Looking for available translations in 
$path/$locald/man$section/$name.$section or 
$path/$locald/man$section/$name.$section.gz\n" if $debug;
+               my $localename=$locald;
+               $locald="" if $locald eq "en" and $locale ne '' ; # Do not add 
directory if looking for the English version and English was not the original 
locale
                if ( -e "$path/$locald/man$section/$name.$section" or -e 
"$path/$locald/man$section/$name.$section.gz" ) {
                        if  ( ! $found ) {
                                print "Also available in: ";
                                $found = 1;
                        }
-                       print qq{[<A 
HREF="$BASE?query=$name&sektion=$section&apropos=0&manpath=$manpath&locale=$locald">$locales{$locald}</A>]
 };
+                       print qq{[<A 
HREF="$BASE?query=$name&sektion=$section&apropos=0&manpath=$manpath&locale=$localename">$locales{$localename}</A>]
 };
                }
        }
     }

Reply via email to