extern-squish

来自「Rsync 3.0.5 source code」· 代码 · 共 19 行

TXT
19
字号
#!/usr/bin/perl# This script finds extraneous "extern" variables in the *.c files.# Run it from inside the main rsync directory.use strict;my @files = glob('*.c');foreach my $fn (@files) {    open(IN, '<', $fn) or die;    undef $/; $_ = <IN>; $/ = "\n";    close IN;    my @externs = /^extern .*?([^[\s(*;&.]+)(?:\[.*?\])?;/mg;    foreach my $find (@externs) {	my @matches = /(?<!\sstruct )\b(\Q$find\E)\b/g;	print $fn, ': ', $find, "\n" if @matches == 1;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?