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;