#include <sys/param.h>
#include <sys/stat.h>
#include <string.h>

#include <test_open.c>

void
test_abor_long(char *url)
{
	char path[MAXPATHLEN];
	char buf[11];
	FTPFILE *ftpfile;

	test_login(url);

	snprintf(path, sizeof(path), "%s/libfget_test/long.txt",
		 ftpurl.fu_path);

	test_open_aux(path, O_RDONLY, &ftpfile, 1);

	if (ftp_read(ftpfile, buf, sizeof(buf) - 1) == -1)
	{
		perror("ftp_read()");
		exit(1);
	}

	buf[sizeof(buf)] = '\0';
	if (strcmp(buf, "0123456789") != 0)
	{
		fprintf(stderr, "file contents do not match expected value\n");
		fprintf(stderr, "read \"%s\", should be \"0123456789\"\n",
			buf);
		exit(2);
	}

	ftp_set_options(ftp,
		FTP_OPT_USE_ABOR,	(unsigned short)1,
		0);

	if (ftp_close(ftpfile) == -1)
	{
		perror("ftp_close()");
		exit(1);
	}

	if (ftp_quit(ftp, 0) == -1)
	{
		perror("ftp_quit()");
		exit(1);
	}
}




syntax highlighted by Code2HTML, v. 0.9.1