endservent |
讓你的係統不再期望使用getservent從服務文件讀取條目。
None
試試下麵的例子:
#!/usr/bin/perl
while(($name, $aliases, $port_number,
$protocol_name) = getservent()){
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Port Number = $port_number\n";
print "Protocol Name = $protocol_name\n";
}
setservent(); # Rewind the database;
while(($name, $aliases, $port_number,
$protocol_name) = getservent()){
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Port Number = $port_number\n";
print "Protocol Name = $protocol_name\n";
}
#by www.gitbook.net
endservent(); # Closes the database;