#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/uio.h>
#include <err.h>
#include "../lpi.h"

#define BUF1_LEN 5
#define BUF2_LEN 10
#define BUF3_LEN 3

int
main(void)
{
    struct iovec iovec[3];
    int fd, r;

    fd = open("log", O_RDONLY);
    if (fd == -1)
        err(EXIT_FAILURE, "open");

    char buf1[BUF1_LEN];
    char buf2[BUF2_LEN];
    char buf3[BUF3_LEN];
    /*
    iovec[0].iov_base = buf1;
    iovec[0].iov_len = BUF1_LEN;

    iovec[1].iov_base = buf2;
    iovec[1].iov_len = BUF2_LEN;

    iovec[2].iov_base = buf3;
    iovec[2].iov_len = BUF3_LEN;

    if ((r = readv(fd, iovec, 3)) == -1)
        err(EXIT_FAILURE, "readv");

    safePrint(buf1, BUF1_LEN);
    putchar('\n');
    safePrint(buf2, BUF2_LEN);
    putchar('\n');
    safePrint(buf3, BUF3_LEN);
    putchar('\n');
    */

    printf("buf1=%p\n", buf1);
    printf("buf2=%p\n", buf2);
    printf("buf3=%p\n", buf3);

    exit(EXIT_SUCCESS);
}
