summaryrefslogtreecommitdiffstats
path: root/client/__init__.py
blob: 04924ec0cc399de89b5969187c744965dfe8b59c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# Copyright 2017 Cisco Systems, Inc.  All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
nv">$buf = ''; my %seen = (); sub out { print $buf; $buf = ''; %seen = (); } while (<>) { if (/^(disable )?([a-z_0-9]+)\(/) { open GREP, '-|', 'git', 'grep', '-lw', "trace_$2" or die "run git grep: $!"; my $fname; while ($fname = <GREP>) { chomp $fname; next if $seen{$fname} || $fname eq 'trace-events'; $seen{$fname} = 1; $buf = "# $fname\n" . $buf; } unless (close GREP) { die "close git grep: $!" if $!; next; } } elsif (/^# ([^ ]*\.[ch])$/) { out; next; } elsif (!/^#|^$/) { warn "unintelligible line"; } $buf .= $_; } out;