#!/usr/bin/awk -f
match($0, /(.+): +([^:]+)/, a) {
       fn = a[1];
       type = a[2];
       if (type == "empty" || type == "directory")
               print  "File is " type ", ignored: " fn;
       else
       {
               if (type ~ /HTML/)      type = "h";
               if (type ~ /text/)      type = "0";
               if (type ~ /GIF/)       type = "g";
               if (type ~ /image/)     type = "I";
               if (length(type)>1)     type = "9";
               cmd = "ssh [email protected] ' cat > gopher/" fn " ' < " fn;
               print "processing " fn "...";
               if (system(cmd) == 0)
                       print "File accessible through gopher://sdf.lonestar.org/" type "/users/weiwu/" fn;
               else
                       print "Error in executing: " cmd;
       }
}