in reply to directory printing
Alternatively, change print "Content-type: text/html\n\n"; to print "Content-type: text/plain\n\n";