1#!/usr/bin/perl
2# Copyright 2006-2008 The FLWOR Foundation.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16use strict;
17use warnings;
18
19my %hdr;
20
21my $inc_path = "/usr/include";
22
23sub process_file {
24    my $fname = shift;
25    if ($hdr {$fname}) {
26        return;
27    }
28    $hdr {$fname} = 1;
29    print ("$fname\n");
30    my $result = open (my $fh, "$inc_path/$fname");
31    if (! $result) {
32        warn ("Could not find $fname");
33        return;
34    }
35    while (<$fh>) {
36        if (m@^[#]include [<"](boost/[^">]*)[>"]@) {
37            process_file ($1);
38        }
39    }
40    close $fh;
41}
42
43while (my $fname = shift) {
44    process_file ($fname);
45}
46