1#!/usr/bin/perl 2# distribution boxbackup-0.11_trunk_2979 (svn version: 2979) 3# Box Backup, http://www.boxbackup.org/ 4# 5# Copyright (c) 2003-2010, Ben Summers and contributors. 6# All rights reserved. 7# 8# Note that this project uses mixed licensing. Any file with this license 9# attached, or where the code LICENSE-GPL appears on the first line, falls 10# under the "Box Backup GPL" license. See the file COPYING.txt for more 11# information about this license. 12# 13# --------------------------------------------------------------------- 14# This program is free software; you can redistribute it and/or 15# modify it under the terms of the GNU General Public License 16# as published by the Free Software Foundation; either version 2 17# of the License, or (at your option) any later version. 18# 19# This program is distributed in the hope that it will be useful, 20# but WITHOUT ANY WARRANTY; without even the implied warranty of 21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22# GNU General Public License for more details. 23# 24# You should have received a copy of the GNU General Public License 25# along with this program; if not, write to the Free Software 26# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 27# 28# [http://www.gnu.org/licenses/old-licenses/gpl-2.0.html#SEC4] 29# 30# As a special exception to the GPLv2, the Box Backup Project gives 31# permission to link any code falling under this license (the Box Backup 32# GPL) with any software that can be downloaded from 33# the OpenSSL website [http://www.openssl.org] under either the 34# "OpenSSL License" or the "Original SSLeay License", and to distribute 35# the linked executables under the terms of the "Box Backup GPL" license. 36# 37# As a special exception to the GPLv2, the Box Backup Project gives 38# permission to link any code falling under this license (the Box Backup 39# GPL) with any version of Microsoft's Volume Shadow Copy Service 7.2 SDK 40# or Microsoft Windows Software Development Kit (SDK), including 41# vssapi.lib, that can be downloaded from the Microsoft website 42# [*.microsoft.com], and to distribute the linked executables under the 43# terms of the "Box Backup GPL" license. 44use strict; 45 46print "Creating built-in documentation for bbackupquery...\n"; 47 48open DOC,"documentation.txt" or die "Can't open documentation.txt file"; 49my $section; 50my %help; 51my @in_order; 52 53while(<DOC>) 54{ 55 if(m/\A>\s+(\w+)/) 56 { 57 $section = $1; 58 m/\A>\s+(.+)\Z/; 59 $help{$section} = $1."\n"; 60 push @in_order,$section; 61 } 62 elsif(m/\A</) 63 { 64 $section = ''; 65 } 66 elsif($section ne '') 67 { 68 $help{$section} .= $_; 69 } 70} 71 72close DOC; 73 74open OUT,">autogen_Documentation.cpp" or die "Can't open output file for writing"; 75 76print OUT <<__E; 77// 78// Automatically generated file, do not edit. 79// 80 81#include "Box.h" 82 83#include "MemLeakFindOn.h" 84 85const char *help_commands[] = 86{ 87__E 88 89for(@in_order) 90{ 91 print OUT qq:\t"$_",\n:; 92} 93 94print OUT <<__E; 95 0 96}; 97 98const char *help_text[] = 99{ 100__E 101 102for(@in_order) 103{ 104 my $t = $help{$_}; 105 $t =~ s/\t/ /g; 106 $t =~ s/\n/\\n/g; 107 $t =~ s/"/\\"/g; 108 print OUT qq:\t"$t",\n:; 109} 110 111print OUT <<__E; 112 0 113}; 114 115__E 116 117close OUT; 118