source: box/trunk/bin/bbackupquery/makedocumentation.pl.in @ 2058

Revision 2058, 941 bytes checked in by chris, 4 years ago (diff)

Fix warnings on HPPA due to assigning static strings to non-const
char *. Thanks to Reinhard Tartler and the Debian project buildds.

  • Property svn:eol-style set to native
Line 
1#!@PERL@
2use strict;
3
4print "Creating built-in documentation for bbackupquery...\n";
5
6open DOC,"documentation.txt" or die "Can't open documentation.txt file";
7my $section;
8my %help;
9my @in_order;
10
11while(<DOC>)
12{
13        if(m/\A>\s+(\w+)/)
14        {
15                $section = $1;
16                m/\A>\s+(.+)\Z/;
17                $help{$section} = $1."\n";
18                push @in_order,$section;
19        }
20        elsif(m/\A</)
21        {
22                $section = '';
23        }
24        elsif($section ne '')
25        {
26                $help{$section} .= $_;
27        }
28}
29
30close DOC;
31
32open OUT,">autogen_Documentation.cpp" or die "Can't open output file for writing";
33
34print OUT <<__E;
35//
36// Automatically generated file, do not edit.
37//
38
39#include "Box.h"
40
41#include "MemLeakFindOn.h"
42
43const char *help_commands[] =
44{
45__E
46
47for(@in_order)
48{
49        print OUT qq:\t"$_",\n:;
50}
51
52print OUT <<__E;
53        0
54};
55
56const char *help_text[] =
57{
58__E
59
60for(@in_order)
61{
62        my $t = $help{$_};
63        $t =~ s/\t/    /g;
64        $t =~ s/\n/\\n/g;
65        $t =~ s/"/\\"/g;
66        print OUT qq:\t"$t",\n:;       
67}
68
69print OUT <<__E;
70        0
71};
72
73__E
74
75close OUT;
Note: See TracBrowser for help on using the repository browser.