int opennet_init(void);
int open_net(const char *pathname, int flags, mode_t mode);
off_t lseek_net(int filedes, off_t offset, int whence);
ssize_t read_net(int fd, void *buf, size_t count);
FILE *fopen_net(const char *path, const char *mode);
int fseek_net(FILE *stream, long offset, int whence);
#include <opennet.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv) {
FILE *fp = NULL;
char *filename = NULL, *fg_ret = NULL;
char buf[512] = {0};
filename = "http://www.rkeene.org/robots.txt";
fp = fopen_net(filename, "r");
if (fp == NULL) {
perror("fopen_net");
return(EXIT_FAILURE);
}
fg_ret = fgets(buf, sizeof(buf) - 1, fp);
if (fg_ret == NULL) {
perror("fgets");
return(EXIT_FAILURE);
}
printf("read: %s", buf);
return(EXIT_SUCCESS);
}