#!/usr/bin/perl # # make-init-lua.pl # # create the init.lua file based on a template (stdin) # # (c) 2006, Luis E. Garcia Onatnon # # Wireshark - Network traffic analyzer # By Gerald Combs # Copyright 2004 Gerald Combs # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; my $WSROOT = shift; die "'$WSROOT' is not a directory" unless -d $WSROOT; my $wtap_encaps_table = ''; my $wtap_filetypes_table = ''; my $wtap_tsprecs_table = ''; my $wtap_commenttypes_table = ''; my $ft_types_table = ''; my $frametypes_table = ''; my $wtap_rec_types_table = ''; my $wtap_presence_flags_table = ''; my $bases_table = ''; my $encodings = ''; my $expert_pi = ''; my $expert_pi_tbl = ''; my $expert_pi_severity = ''; my $expert_pi_group = ''; my $menu_groups = ''; my %replacements = %{{ WTAP_ENCAPS => \$wtap_encaps_table, WTAP_FILETYPES => \$wtap_filetypes_table, WTAP_TSPRECS => \$wtap_tsprecs_table, WTAP_COMMENTTYPES => \$wtap_commenttypes_table, FT_TYPES => \$ft_types_table, FT_FRAME_TYPES => \$frametypes_table, WTAP_REC_TYPES => \$wtap_rec_types_table, WTAP_PRESENCE_FLAGS => \$wtap_presence_flags_table, BASES => \$bases_table, ENCODINGS => \$encodings, EXPERT => \$expert_pi, EXPERT_TABLE => \$expert_pi_tbl, MENU_GROUPS => \$menu_groups, }}; # # load template # my $template = ''; my $template_filename = shift; open TEMPLATE, "< $template_filename" or die "could not open '$template_filename': $!"; $template .= $_ while(