diff options
author | Fritz Elfert <felfert@to.com> | 2000-08-27 23:29:33 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2000-08-27 23:29:33 +0000 |
commit | d4b796119af628da552a64367557e31198c3f960 (patch) | |
tree | 80a28912868fabf80623b0b48ba4534f3a629988 /plpftp/main.cc | |
parent | 457d55eb8081e27bd50ccb0c58e91412cd5c6d7f (diff) | |
download | plptools-d4b796119af628da552a64367557e31198c3f960.tar.gz plptools-d4b796119af628da552a64367557e31198c3f960.tar.bz2 plptools-d4b796119af628da552a64367557e31198c3f960.zip |
Programs now use an entry in /etc/services (if exists) for the TCP port.
Diffstat (limited to 'plpftp/main.cc')
-rw-r--r-- | plpftp/main.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/plpftp/main.cc b/plpftp/main.cc index cbd88f6..2d5140a 100644 --- a/plpftp/main.cc +++ b/plpftp/main.cc @@ -71,19 +71,24 @@ main(int argc, char **argv) rpcs *r; ftp f; int status = 0; + int sockNum = DPORT; sigset_t sigset; - // Command line parameter processing - int sockNum = DPORT; sigemptyset(&sigset); sigaddset(&sigset, SIGPIPE); sigprocmask(SIG_BLOCK, &sigset, 0L); + struct servent *se = getservbyname("psion", "tcp"); + endservent(); + if (se != 0L) + sockNum = ntohs(se->s_port); + + // Command line parameter processing if ((argc > 2) && !strcmp(argv[1], "-p")) { sockNum = atoi(argv[2]); argc -= 2; - for (int i=1; i<argc; i++) - argv[i] = argv[i+2]; + for (int i = 1; i < argc; i++) + argv[i] = argv[i + 2]; } if (argc < 2) |