now it's like HP-UX-ready ;p
[public/netxms.git] / tools / nwmkimp.pl
CommitLineData
076a55c4
VK
1#!c:/apps/perl/bin/pelr -w
2
3###############################################################################
4#
5# Create import file for NLM based on i586-netware-nm.exe output
6#
7###############################################################################
8
9use strict;
10
11my $inFile = shift || die "Usage : nxmkimp.pl <input_file> <output_file>";
12my $outFile = shift || die "Usage : nxmkimp.pl <input_file> <output_file>";
13
14my $i;
3b1f0a0a 15my $j;
076a55c4
VK
16
17open(OUT, ">$outFile") || die "out: $!";
18
3b1f0a0a
VK
19my @sym_list = `i586-netware-nm $inFile | grep -e " [BGTRD] " | cut -d" " -f3`;
20my @exp_list;
21
22for ($i = 0, $j = 0; $i <= $#sym_list; $i++)
23{
24 chomp $sym_list[$i];
25 if ($sym_list[$i] =~ /^main$|^_init$|^_fini$|^__EH_FRAME.*|^g_.*|^I_.*/)
26 {
27 }
28 else
29 {
30 $exp_list[$j++] = $sym_list[$i];
31 }
32}
33
34for ($i = 0; $i < $#exp_list; $i++)
076a55c4 35{
3b1f0a0a 36 print OUT " $exp_list[$i],\n";
076a55c4 37}
3b1f0a0a 38print OUT " $exp_list[$i]\n";
076a55c4
VK
39
40close OUT;
41exit 0;