53 "Usage: plpftp [OPTIONS]... [FTPCOMMAND]\n"
55 "If FTPCOMMAND is given, connect; run FTPCOMMAND and\n"
56 "terminate afterwards. If no FTPCOMMAND is given, start up\n"
57 "in interactive mode. For help on supported FTPCOMMANDs,\n"
58 "use `?' or `help' as FTPCOMMAND.\n"
60 "Supported options:\n"
62 " -h, --help Display this text.\n"
63 " -V, --version Print version and exit.\n"
64 " -p, --port=[HOST:]PORT Connect to port PORT on host HOST.\n"
65 " Default for HOST is 127.0.0.1\n"
66 " Default for PORT is "
71 cerr <<
_(
"Try `plpftp --help' for more information") << endl;
74static struct option
opts[] = {
75 {
"help", no_argument,
nullptr,
'h'},
76 {
"version", no_argument,
nullptr,
'V'},
77 {
"port", required_argument,
nullptr,
'p'},
78 {NULL, 0,
nullptr, 0 }
82 cout <<
_(
"PLPFTP Version ") << VERSION;
83 cout <<
_(
" Copyright (C) 1999 Philip Proudman") << endl;
84 cout <<
_(
" Additions Copyright (C) 1999-2002 Fritz Elfert <felfert@to.com>") << endl;
85 cout <<
_(
" & (C) 1999 Matt Gumbley <matt@gumbley.demon.co.uk>") << endl;
86 cout <<
_(
" & (C) 2006-2025 Reuben Thomas <rrt@sc3d.org>") << endl;
87 cout <<
_(
"PLPFTP comes with ABSOLUTELY NO WARRANTY.") << endl;
88 cout <<
_(
"This is free software, and you are welcome to redistribute it") << endl;
89 cout <<
_(
"under GPL conditions; see the COPYING file in the distribution.") << endl;
91 cout <<
_(
"FTP like interface started. Type \"?\" for help.") << endl;
94int main(
int argc,
char **argv) {
96 string host =
"127.0.0.1";
99 setlocale (LC_ALL,
"");
103 int c = getopt_long(argc, argv,
"hVp:",
opts, NULL);
111 cout <<
_(
"plpftp Version ") << VERSION << endl;
118 cout <<
_(
"Invalid port definition.") << endl;
124 if (optind == argc) {
131 cerr <<
"plpftp: " <<
error << endl;
136 cerr <<
"plpftp: " <<
error << endl;
141 cerr <<
"plpftp: " <<
error << endl;
144 vector<char *> args(argv + optind, argv + argc);
145 return ftp.
session(*rfsv, *rpcs, *clipboard, args);
Wrapper class featuring range-checking and string representation of enumerated values.
int session(RFSV &rfsv, RPCS &rpcs, rclip &clipboard, std::vector< char * > argv)
static RFSV * connect(const std::string &host, int port, Enum< ConnectionError > *error)
static RPCS * connect(const std::string &host, int port, Enum< ConnectionError > *error)
static rclip * connect(const std::string &host, int port, Enum< ConnectionError > *error=nullptr)
bool parse_port(const std::string &arg, std::string *host, int *port)
int lookup_default_port()
int main(int argc, char **argv)
static struct option opts[]
#define textdomain(Domain)
static void error(int line)