C-Wrappers using libcurl
Date: Thu, 28 Jun 2007 12:07:06 +0200
I have hacked together some sort of proof-of-concept code that wraps
around some standard C (and POSIX) functions allowing for URLs to be
opened instead of files.
It uses libcurl so I thought maybe you would be interested in trying it
The concept is that the functions like fopen, opendir etc. accept URLs as
parameters and if it is non-local (i.e. not a valid URL or a file:// URL)
then libcurl is used to retrieve the contents.
f = fopen("http://curl.haxx.se/download.html", "r");
fread(buf, 1, n, f);
I have also written a function for dirent that parses HTML (using libxml2)
and returns all the hyperlinks (see the test-program acls):
$ ./acls http://www.kernel.org/pub/linux/kernel/
ac_get_and_create: read 2162 bytes
Anyhow I don't have time to work on it for now but if someone here likes
the idea and wants to use it - feel free to do so (the attached code is
P.S.: The Makefile is really crappy - you will have to adjust it, sorry.
- application/x-gzip attachment: ac.tar.gz