mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-09 03:05:33 +00:00
Change generate_errors.pl to call perl grep
Change the script generate_errors.pl to call the grep function in Perl instead of calling the external tool grep directly as this causes problems when ANSI escape sequences are included in the grep output string.
This commit is contained in:
parent
5e533f43ee
commit
4a91c1a0b5
|
@ -46,7 +46,14 @@ close(FORMAT_FILE);
|
|||
|
||||
$/ = $line_separator;
|
||||
|
||||
open(GREP, "grep \"define MBEDTLS_ERR_\" $include_dir/* |") || die("Failure when calling grep: $!");
|
||||
my @files = <$include_dir/*>;
|
||||
my @matches;
|
||||
foreach my $file (@files) {
|
||||
open(FILE, "$file");
|
||||
my @grep_res = grep(/define MBEDTLS_ERR_/, <FILE>);
|
||||
push(@matches, @grep_res);
|
||||
close FILE;
|
||||
}
|
||||
|
||||
my $ll_old_define = "";
|
||||
my $hl_old_define = "";
|
||||
|
@ -58,7 +65,8 @@ my $headers = "";
|
|||
|
||||
my %error_codes_seen;
|
||||
|
||||
while (my $line = <GREP>)
|
||||
|
||||
foreach my $line (@matches)
|
||||
{
|
||||
next if ($line =~ /compat-1.2.h/);
|
||||
my ($error_name, $error_code) = $line =~ /(MBEDTLS_ERR_\w+)\s+\-(0x\w+)/;
|
||||
|
|
Loading…
Reference in a new issue