* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
*/
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <getopt.h>
#include <syslog.h>
+#include <netdb.h>
#include "nfslib.h"
static void usage(const char *);
main(int argc, char **argv)
{
int count = 1, c, error, port, fd;
+ struct servent *ent;
- port = 2049;
-
- /* FIXME: Check for nfs in /etc/services */
+ ent = getservbyname ("nfs", "udp");
+ if (ent != NULL)
+ port = ntohs (ent->s_port);
+ else
+ port = 2049;
while ((c = getopt(argc, argv, "hp:P:")) != EOF) {
switch(c) {
(void) dup2(fd, 1);
(void) dup2(fd, 2);
}
- fd = sysconf(_SC_OPEN_MAX);
- while (--fd > 2)
- (void) close(fd);
+ closeall(3);
if ((error = nfssvc(port, count)) < 0) {
int e = errno;