* fix problematic use of tolower() when calculating the version
[ntk/apt.git] / apt-pkg / contrib / strutl.cc
index cdd8882..3b7a67d 100644 (file)
@@ -331,23 +331,27 @@ string TimeToStr(unsigned long Sec)
    {
       if (Sec > 60*60*24)
       {
-        sprintf(S,"%lid %lih%limin%lis",Sec/60/60/24,(Sec/60/60) % 24,(Sec/60) % 60,Sec % 60);
+        //d means days, h means hours, min means minutes, s means seconds
+        sprintf(S,_("%lid %lih %limin %lis"),Sec/60/60/24,(Sec/60/60) % 24,(Sec/60) % 60,Sec % 60);
         break;
       }
       
       if (Sec > 60*60)
       {
-        sprintf(S,"%lih%limin%lis",Sec/60/60,(Sec/60) % 60,Sec % 60);
+        //h means hours, min means minutes, s means seconds
+        sprintf(S,_("%lih %limin %lis"),Sec/60/60,(Sec/60) % 60,Sec % 60);
         break;
       }
       
       if (Sec > 60)
       {
-        sprintf(S,"%limin%lis",Sec/60,Sec % 60);
+        //min means minutes, s means seconds
+        sprintf(S,_("%limin %lis"),Sec/60,Sec % 60);
         break;
       }
-      
-      sprintf(S,"%lis",Sec);
+
+      //s means seconds
+      sprintf(S,_("%lis"),Sec);
       break;
    }
    
@@ -1070,6 +1074,17 @@ char *safe_snprintf(char *Buffer,char *End,const char *Format,...)
 }
                                                                        /*}}}*/
 
+// tolower_ascii - tolower() function that ignores the locale          /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+int tolower_ascii(int c)
+{
+   if (c >= 'A' and c <= 'Z')
+      return c + 32;
+   return c;
+}
+                                                                       /*}}}*/
+
 // CheckDomainList - See if Host is in a , seperate list               /*{{{*/
 // ---------------------------------------------------------------------
 /* The domain list is a comma seperate list of domains that are suffix