curl-library
C-Wrappers using libcurl
Date: Thu, 28 Jun 2007 12:07:06 +0200
Hi everyone!
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
out ;)
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.
Use-case:
f = fopen("http://curl.haxx.se/download.html", "r");
fread(buf, 1, n, f);
fclose(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
?C=N;O=D
?C=M;O=A
?C=S;O=A
/pub/linux/
Historic/
SillySounds/
crypto/
people/
ports/
projects/
testing/
uemacs/
v1.0/
v1.1/
[...]
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
public domain).
Greets,
Ignaz
P.S.: The Makefile is really crappy - you will have to adjust it, sorry.
- application/x-gzip attachment: ac.tar.gz