Initial revision
[libcurl.git] / src / mkhelp.pl
blob842a42f59423284f270fd36356f5db033b910ee3
1 #!/usr/local/bin/perl
3 # Yeah, I know, probably 1000 other persons already wrote a script like
4 # this, but I'll tell ya:
6 # THEY DON'T FIT ME :-)
8 # Get readme file as parameter:
9 $README = $ARGV[0];
11 if($README eq "") {
12 print "usage: mkreadme.pl <README>\n";
13 exit;
17 push @out, " _ _ ____ _ \n";
18 push @out, " Project ___| | | | _ \\| | \n";
19 push @out, " / __| | | | |_) | | \n";
20 push @out, " | (__| |_| | _ <| |___ \n";
21 push @out, " \\___|\\___/|_| \\_\\_____|\n";
23 $head=0;
24 loop:
25 while (<STDIN>) {
26 $line = $_;
28 # this kind should be removed first:
29 $line =~ s/_\b//g;
31 # then this:
32 $line =~ s/\b.//g;
34 if($line =~ /^curl/i) {
35 # cut off the page headers
36 $head=1;
37 next loop;
40 if($line =~ /^[ \t]*\n/) {
41 $wline++;
42 # we only make one empty line max
43 next loop;
45 if($wline) {
46 $wline = 0;
47 if(!$head) {
48 push @out, "\n";
50 $head =0;
52 push @out, $line;
54 push @out, "\n"; # just an extra newline
56 open(READ, "<$README") ||
57 die "couldn't read the README infile";
59 while(<READ>) {
60 push @out, $_;
62 close(READ);
65 print "/* NEVER EVER edit this manually, fix the mkhelp script instead! */\n"
67 print "#include <stdio.h>\n";
68 print "void hugehelp(void)\n";
69 print "{\n";
70 print "puts (\n";
72 for(@out) {
73 chop;
75 $new = $_;
77 $new =~ s/\\/\\\\/g;
78 $new =~ s/\"/\\\"/g;
80 printf("\"%s\\n\"\n", $new);
84 print " ) ;\n}\n"