bagder: curl-www latest.cgi,1.18,1.19

[email protected]
Newsgroups gmane.comp.web.curl.www.cvs
Message-ID <[email protected]>
Update of /cvsroot/curl/curl-www
In directory labb.contactor.se:/var/tmp/cvs-serv12678

Modified Files:
	latest.cgi 
Log Message:
show flags


Index: latest.cgi
===================================================================
RCS file: /cvsroot/curl/curl-www/latest.cgi,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- latest.cgi	26 Apr 2004 06:54:34 -0000	1.18
+++ latest.cgi	17 Sep 2004 08:40:19 -0000	1.19
@@ -78,6 +78,54 @@
     return sort { return int(rand(4)-2); } @_;
 }
 
+sub flag {
+    my ($country)=@_;
+    my $tld;
+
+    if($country =~ /Australia/) {
+        $tld="au";
+    }
+    elsif($country =~ /Austria/) {
+        $tld="at";
+    }
+    elsif($country =~ /Denmark/) {
+        $tld="dk";
+    }
+    elsif($country =~ /Estonia/) {
+        $tld="ee";
+    }
+    elsif($country =~ /France/) {
+        $tld="fr";
+    }
+    elsif($country =~ /Germany/) {
+        $tld="de";
+    }
+    elsif($country =~ /Greece/) {
+        $tld="gr";
+    }
+    elsif($country =~ /Hong Kong/) {
+        $tld="hk";
+    }
+    elsif($country =~ /Russia/) {
+        $tld="ru";
+    }
+    elsif($country =~ /Sweden/) {
+        $tld="se";
+    }
+    elsif($country =~ /Thailand/) {
+        $tld="th";
+    }
+    elsif($country =~ /US/) {
+        $tld="us";
+    }
+
+    if($tld) {
+        return "<img src=\"/pix/flags/$tld.png\" alt=\"$tld\">";
+    }
+
+    return "&nbsp;";
+}
+
 sub time_ago {
     my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
         $atime,$mtime,$ctime,$blksize,$blocks)
@@ -149,7 +197,7 @@
         "(verified ".&time_ago.")\n";
         
         print "<table><tr>";
-        for(('Where', 'Proto', 'Host', 'File')) {
+        for(('Flag', 'Where', 'Proto', 'Host', 'File')) {
             print "<th>$_</th>";
         }
         print "</tr>\n";
@@ -157,9 +205,13 @@
         my $i=0;
         for(sort {$where{$a} cmp $where{$b}} @dl) {
             my $url=$_;
+
+            my $flag = flag($where{$url});
+
             $i++;
-            printf "<tr class=\"%s\"><td><b>%s</b></td><td>%s</td><td>%s</td><td><a href=\"%s\">%s</a></td></tr>\n",
+            printf "<tr class=\"%s\"><td>%s</td><td><b>%s</b></td><td>%s</td><td>%s</td><td><a href=\"%s\">%s</a></td></tr>\n",
             $i&1?"odd":"even",
+            $flag,
             $where{$url},
             $proto{$url},
             $host{$url},

_______________________________________________
http://cool.haxx.se/mailman/listinfo/curl-www-commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.