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 << endl;
83 cout <<
_(
"FTP like interface started. Type \"?\" for help.") << endl;
87int main(
int argc,
char **argv) {
89 string host =
"127.0.0.1";
92 setlocale (LC_ALL,
"");
96 int c = getopt_long(argc, argv,
"hVp:",
opts, NULL);
104 cout <<
_(
"plpftp Version ") << VERSION << endl;
111 cout <<
_(
"Invalid port definition.") << endl;
117 if (optind == argc) {
124 cerr <<
"plpftp: " <<
error << endl;
129 cerr <<
"plpftp: " <<
error << endl;
134 cerr <<
"plpftp: " <<
error << endl;
137 vector<char *> args(argv + optind, argv + argc);
138 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)