Beispiel #1
0
/* flushes output */
static int ps_flush(Socket *sockp)
{
#ifdef SECFTP
  return sec_fflush(sockp->data->sout);
#else
  return fflush(sockp->data->sout);
#endif
}
Beispiel #2
0
static int FILE_send_binary(FILE *in, FILE *out)
{
	size_t n;
	char *buf;
	time_t then = time(0) - 1;
	time_t now;

	ftp_set_close_handler();

	if(foo_hookf)
		foo_hookf(&ftp->ti);
	ftp->ti.begin = false;

	clearerr(in);
	clearerr(out);

	buf = (char *)xmalloc(FTP_BUFSIZ);
	while(!feof(in)) {
		n = fread(buf, sizeof(char), FTP_BUFSIZ, in);
		if(n <= 0)
			break;

		if(ftp_sigints() > 0)
			break;

		if(wait_for_output() != 0)
			break;
#ifdef SECFTP
		if(sec_write(fileno(out), buf, n) != n)
			break;
#else
		if(fwrite(buf, sizeof(char), n, out) != n)
			break;
#endif
		ftp->ti.size += n;
		if(foo_hookf) {
			now = time(0);
			if(now > then) {
				foo_hookf(&ftp->ti);
				then = now;
			}
		}
	}
#ifdef SECFTP
	sec_fflush(out);
#endif

	free(buf);

	return maybe_abort(in, out);
}
Beispiel #3
0
int
builtin_ls(FILE *out, const char *file)
{
    int flags;
    int ret;

    if(*file == '-') {
	flags = parse_flags(file);
	file = ".";
    } else
	flags = parse_flags("");

    ret = list_files(out, &file, 1, flags);
    sec_fflush(out);
    return ret;
}