#include "opennet.h"
#include "compat.h"

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>


int main(int argc, char **argv) {
	NETFILE *fp;
	char buf[1024];
	ssize_t fread_ret;
	int x;

	fp = fopen_net(argv[1], "r");

	SPOTVAR_I(ftell_net(fp));
	fgets_net(buf, sizeof(buf), fp);
	SPOTVAR_I(ftell_net(fp));
	printf("-- %s", buf);

	fclose_net(fp);

	fp = fopen_net(argv[1], "r");
	SPOTVAR_I(ftell_net(fp));
	fread_ret = fread_net(buf, sizeof(buf[0]), 1, fp);
	fseek_net(fp, 0, SEEK_END);
	printf("len=%i\n", flength_net(fp));
	buf[1] = '\0';

	printf("two=%s\n", buf);

	fclose_net(fp);

	return(0);
}
