Exemple #1
0
void transfer_begin_nohup(int argc, char **argv)
{
	nohup_start_time = time(0);

	ftp_set_signal(SIGHUP, SIG_IGN); /* ignore signals */
	ftp_set_signal(SIGINT, SIG_IGN);
	ftp_set_signal(SIGQUIT, SIG_IGN);
	ftp_set_signal(SIGTSTP, SIG_IGN);
	ftp_set_signal(SIGTERM, term_handler);
	dup2(fileno(logfp), fileno(stdout));
	dup2(fileno(logfp), fileno(stderr));
#if 0 && (defined(HAVE_SETPROCTITLE) || defined(linux))
	if(gvUseEnvString)
		setproctitle("%s, nohup, %s", ftp->url->hostname, nohup_logfile);
#endif

	printf(_("Connected to %s as user %s\n"),
		   ftp->url->hostname,
		   ftp->url->username);
	if(argv)
		printf(_("Transfer started %s\n"), ctime(&nohup_start_time));
	else
		printf(_("Transfer received SIGHUP %s\n"), ctime(&nohup_start_time));
	nohup_command = argv ? args_cat(argc, argv, 0) : 0;
	if(argv)
		printf(_("Command: '%s'\n"), nohup_command);
	printf("pid: %u\n\n", getpid());
}
Exemple #2
0
void cmd_rhelp(int argc, char **argv)
{
	char *e;

	e = args_cat(argc, argv, 1);
	ftp_help(e);
	free(e);
}
Exemple #3
0
void cmd_shell(int argc, char **argv)
{
	char *e = 0;

	if(argc > 1)
		e = args_cat(argc, argv, 1);
	invoke_shell(e);
	free(e);
}
Exemple #4
0
void cmd_nlist(int argc, char **argv)
{
	OPT_HELP_NEW(_("Simple file list."), "nlist [options] [file]", NULL);
	need_connected();
	need_loggedin();

	if(argc == optind + 1)
		ftp_list("NLST", 0, stdout);
	else {
		char *args;

		args = args_cat(argc, argv, optind);
		ftp_list("NLST", args, stdout);
		free(args);
	}
}
Exemple #5
0
void cmd_site(int argc, char **argv)
{
	char *e;

	minargs_nohelp(1);
	need_connected();

	if(ftp->ssh_pid) {
		printf("SITE commands not available in SSH connections\n");
		return;
	}

	e = args_cat(argc, argv, 1);
	ftp_set_tmp_verbosity(vbCommand);
	ftp_cmd("SITE %s", e);
	free(e);
}
Exemple #6
0
void cmd_nlist(int argc, char **argv)
{
	OPT_HELP("Simple file list.  Usage:\n"
			 "  nlist [options] [file]\n"
			 "Options:\n"
			 "  -h, --help    show this help\n");
	need_connected();
	need_loggedin();

	if(argc == optind + 1)
		ftp_list("NLST", 0, stdout);
	else {
		char *args;

		args = args_cat(argc, argv, optind);
		ftp_list("NLST", args, stdout);
		free(args);
	}
}
Exemple #7
0
void cmd_quote(int argc, char **argv)
{
	char *e;

	OPT_HELP_NEW(_("Send arbitrary FTP command."), "quote [options] <commands>", NULL);

	minargs(optind);
	need_connected();

#ifdef HAVE_LIBSSH
	if(ftp->session) {
		printf("Command not available in SSH connection\n");
		return;
	}
#endif

	e = args_cat(argc, argv, optind);
	ftp_set_tmp_verbosity(vbDebug);
	ftp_cmd("%s", e);
	free(e);
}
Exemple #8
0
void cmd_quote(int argc, char **argv)
{
	char *e;

	OPT_HELP("Send arbitrary FTP command.  Usage:\n"
			 "  quote [options] <commands>\n"
			 "Options:\n"
			 "  -h, --help    show this help\n");

	minargs(optind);
	need_connected();

	if(ftp->ssh_pid) {
		printf("Command not available in SSH connection\n");
		return;
	}

	e = args_cat(argc, argv, optind);
	ftp_set_tmp_verbosity(vbDebug);
	ftp_cmd("%s", e);
	free(e);
}