bagder: curl-www/libcurl/c Makefile, 1.46, 1.47 _example-templ.html, NONE, 1.1 _example.html, 1.13, 1.14 mkexam.pl, NONE, 1.1
[email protected] Tue, 08 Sep 2009 22:39:22 +0000
| Newsgroups | gmane.comp.web.curl.www.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/curl/curl-www/libcurl/c
In directory labb:/tmp/cvs-serv27902
Modified Files:
Makefile _example.html
Added Files:
_example-templ.html mkexam.pl
Log Message:
use 'enscript' to generate fine-looking static HTML versions of the
example files, ditching LXR
--- NEW FILE: _example-templ.html ---
#include "_doctype.html"
<HTML>
<HEAD> <TITLE>libcurl - %cfile%</TITLE>
#include "css.t"
</HEAD>
#define LIBCURL_EXAMPLE
#define DOCS_INDEX
#define CURL_URL libcurl/c/%htmlfile%
#include "_menu.html"
#include "setup.t"
WHERE3(libcurl, "/libcurl/", C API index, "/libcurl/c/", Example Source Codes)
TITLE(%cfile%)
<p>
#include "%rawfile%"
<p>
You'll also find all examples in the distribution archive, in the
<b>docs/examples directory</b>.
#include "_footer.html"
</BODY>
</HTML>
Index: Makefile
===================================================================
RCS file: /cvsroot/curl/curl-www/libcurl/c/Makefile,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- Makefile 18 May 2009 06:38:38 -0000 1.46
+++ Makefile 8 Sep 2009 22:39:20 -0000 1.47
@@ -11,14 +11,15 @@
NOW=$(shell gnudate +'-D__TODAY__=%B %d, %Y')
ACTION=@echo preprocessing $@; \
- rm -f $@; \
cpp -I.. -I. -I$(CURL) -WWW -Uunix -P -H -C -V -LL "$(NOW)" $< $@; \
- chmod a-w+r $@
TXT2HTML= txt2html --extract --hrule 10
MAN2HTML= roffit --bare --mandir=$(MANROOT)
TXT2PLAIN = txt2plain.pl
+# generated by mkexam.pl, assignes the EXAMPLES variable
+include Makefile.exhtml
+
PAGES = index.html example.html curl_easy_init.html \
curl_easy_cleanup.html curl_easy_setopt.html curl_easy_perform.html \
curl_version.html curl_version_info.html curl_getenv.html \
@@ -39,7 +40,7 @@
curl_multi_timeout.html curl_multi_setopt.html \
curl_easy_escape.html curl_easy_unescape.html curl_multi_assign.html \
curl_formget.html curl_easy_pause.html curl_easy_recv.html \
- curl_easy_send.html curl_multi_socket_action.html
+ curl_easy_send.html curl_multi_socket_action.html $(EXAMPLES)
all: $(PAGES)
@@ -50,7 +51,7 @@
index.html: _index.html $(MAINPARTS)
$(ACTION)
-example.html: _example.html $(MAINPARTS) tinytest.html tinytest2.html curlgtk.html
+example.html: _example.html $(MAINPARTS)
$(ACTION)
allfuncs.html: _allfuncs.html $(MAINPARTS)
@@ -203,15 +204,6 @@
curl_slist_free_all.t: $(MANROOT)/curl_slist_free_all.3
$(MAN2HTML) < $< >$@
-tinytest.html: tinytest.c
- $(TXT2PLAIN) < $< > $@
-
-tinytest2.html: tinytest2.c
- $(TXT2PLAIN) < $< > $@
-
-curlgtk.html: curlgtk.c
- $(TXT2PLAIN) < $< > $@
-
libcurl-multi.html: _libcurl-multi.html $(MAINPARTS) libcurl-multi.t
$(ACTION)
libcurl-multi.t: $(MANROOT)/libcurl-multi.3
@@ -334,5 +326,7 @@
curl_multi_assign.t: $(MANROOT)/curl_multi_assign.3
$(MAN2HTML) < $< >$@
+include Makefile.examples
+
full: all
--- NEW FILE: mkexam.pl ---
#!/usr/bin/perl
my $template="_example-templ.html";
my $dir="../../cvssource/docs/examples";
opendir(DIR, $dir) || die "can't opendir $dir: $!";
my @samps = grep { /\.c\z/ && -f "$dir/$_" } readdir(DIR);
closedir DIR;
my @mak;
my @htmlfiles;
for my $f (@samps) {
my $base = $f;
$base =~ s/(.*)\.c/$1/;
my $cfile = "$base.c";
my $encfile = "$base.et";
my $rawfile = "$base.t";
my $htmlfile = "$base.html";
my $cmd = sprintf("enscript %s -w html -o - --color -Ec -q ",
"$dir/$cfile");
open(OUT, ">$rawfile");
open(F, "<$template") ||
next;
while(<F>) {
s/%cfile%/$cfile/g;
s/%htmlfile%/$htmlfile/g;
s/%rawfile%/$encfile/g;
print OUT $_;
}
close(OUT);
close(F);
# now run enscript and extract the PRE part
#
open(ET, ">$encfile");
open(CMD, "$cmd|");
my $show=0;
while(<CMD>) {
if($_ =~ /^<PRE/) {
$show = 1;
}
if($show) {
if($_ eq "\n") {
print ET " \n";
}
else {
print ET $_;
}
if($_ =~ /^<\/PRE/) {
$show = 0;
}
}
}
close(ET);
close(CMD);
push @htmlfiles, $htmlfile;
push @mak, "$htmlfile: $rawfile \$(MAINPARTS)\n\t\$(ACTION)\n\n";
push @mak, "$rawfile: $dir/$cfile\n\tperl mkexam.pl\n\n";
}
open(MAK, ">Makefile.exhtml");
print MAK "EXAMPLES = ";
for my $f(@htmlfiles) {
print MAK "$f ";
}
print MAK "\n";
close(MAK);
open(MAK, ">Makefile.examples");
print MAK @mak;
close(MAK);
Index: _example.html
===================================================================
RCS file: /cvsroot/curl/curl-www/libcurl/c/_example.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- _example.html 24 Aug 2005 08:13:44 -0000 1.13
+++ _example.html 8 Sep 2009 22:39:20 -0000 1.14
@@ -27,92 +27,91 @@
<p>
<b>simple HTTP</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/simple.c">simple.c</a>
+href="simple.html">simple.c</a>
shows how to get a remote web page in only five libcurl function calls.
<p>
-<b>simple HTTPS</b><br> <a href="http://curl.haxx.se/lxr/source/docs/examples/https.c">https.c</a> gets a single HTTPS page, while <a
-href="http://curl.haxx.se/lxr/source/docs/examples/simplessl.c">simplessl.c</a>
-shows how to get a remote https page and a set of various SSL-controlling
-options.
+<b>simple HTTPS</b><br> <a href="https.html">https.c</a> gets a single HTTPS
+page, while <a href="simplessl.html">simplessl.c</a> shows how to get a remote
+https page and a set of various SSL-controlling options.
<p>
<b>get HTTP with headers separate</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/sepheaders.c">sepheader.c</a>
+href="sepheaders.html">sepheader.c</a>
gets a web page and stores the response-headers in a separate file.
<p>
<b>simple FTP</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/ftpget.c">ftpget.c</a>
+href="ftpget.html">ftpget.c</a>
proves that getting a FTP file is just as simple.
<p>
<b>FTP upload</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/ftpupload.c">ftpupload.c</a>
+href="ftpupload.html">ftpupload.c</a>
uploads a local file to a remote FTP server. It also renames the file after
succcessful transfer.
<p>
<b>get a remote file in memory only</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/getinmemory.c">getinmemory.c</a>
+href="getinmemory.html">getinmemory.c</a>
describes how you can use the callback system to fetch documents into a ram
buffer with no file writing necessary.
<p>
<b>HTTP PUT</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/httpput.c">httpput.c</a>
+href="httpput.html">httpput.c</a>
makes PUTs a local file to a HTTP server.
<p>
<b>HTTP form POST</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/postit2.c">postit2.c</a>
+href="postit2.html">postit2.c</a>
shows how to build a RFC1867-style form post and send it to a HTTP
server.
<p>
<b>persistant transfers</b><br><a
-href="http://curl.haxx.se/lxr/source/docs/examples/persistant.c">persistant.c</a>
+href="persistant.html">persistant.c</a>
shows that just getting files in a sequential manner will make it use
persistant connections if the remote server supports it.
<p>
<b>multithreaded URL fetches</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/multithread.c">multithread.c</a>
+href="multithread.html">multithread.c</a>
starts a number of threads and retrieves one URL in each thread. This requires
a working thread library.
<p>
<b>URL fetch with GTK progress bar</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/curlgtk.c">curlgtk.c</a>
+href="curlgtk.html">curlgtk.c</a>
uses GTK and the libcurl progress callback to show a GUI progress bar while
downloading.
<p>
<b>fopen() URL</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/fopen.c">fopen.c</a> shows
+href="fopen.html">fopen.c</a> shows
how you could write an fopen()-style emulation layer to easily make your
program read URLs instead of local files.
<p>
<b>nonblocking multipart formpost</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/multi-post.c">multi-post.c</a>
+href="multi-post.html">multi-post.c</a>
makes a multipart formpost using the multi interface, which makes it a
non-blocking operation.
<p>
<b>debug callback</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/debug.c">debug.c</a> shows
+href="debug.html">debug.c</a> shows
how you can use the debug callback to get a full trace of all protocol data
being sent/received (and more).
<p>
<b>HTML parsing</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/htmltitle.cc">htmltitle.cc</a>
+href="htmltitle.cc">htmltitle.cc</a>
shows how to use libxml to parse HTML retrieved with libcurl.
<p>
<b>Using CURLOPT_SSL_CTX_FUNCTION</b><br> <a
-href="http://curl.haxx.se/lxr/source/docs/examples/curlx.c">curlx.c</a> uses
+href="curlx.html">curlx.c</a> uses
<a
href="/libcurl/c/curl_easy_setopt.html#CURLOPTSSLCTXFUNCTION">CURLOPT_SSL_CTX_FUNCTION</a>
to set a custom callback to deal with an OpenSSL SSL_CTX * at SSL handshake
@@ -123,8 +122,8 @@
<a href="http://www.vivtek.com/wftk/doc/code/wftk/action/ACTION_http.html">SOAP example by vivtek.com</a>
<p>
- You'll also find these examples in the distribution archive, in the <a
- href="http://curl.haxx.se/lxr/source/docs/examples/">docs/examples directory</a>.
+ You'll also find these examples in the distribution archive, in the
+ <b>docs/examples directory</b>.
#include "_footer.html"