sethostent STAYOPEN |
由於gethostent()檢索信息的主機數據庫中的下一行,然後gethostent集(套)枚舉的主機項設置開始。這個函數應該被調用之前第一次調用gethostent。STAYOPEN參數是可選的,在大多數係統上未使用過的。
Nothing
試試下麵的例子:
#!/usr/bin/perl
#by www.gitbook.net
while( ($name, $aliases, $addrtype, $length, @addrs) = gethostent() ){
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Addr Type = $addrtype\n";
print "Length = $length\n";
print "Addrs = @addrs\n";
}
sethostent(1);
while( ($name, $aliases, $addrtype, $length, @addrs) = gethostent() ){
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Addr Type = $addrtype\n";
print "Length = $length\n";
print "Addrs = @addrs\n";
}
endhostent(); # Closes the database;