File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env perl
2
+
3
+ use strict;
4
+ use warnings;
5
+
6
+ use POSIX;
7
+
8
+ print <<"END_HEADER" ;
9
+ # DO NOT EDIT THIS FILE.
10
+ #
11
+ # This file is generated automatically from
12
+ # $0
13
+ #
14
+ # Any changes made here will be lost.
15
+ #
16
+ END_HEADER
17
+
18
+ my @errno_values ;
19
+
20
+ my $max_errno_name_len = 0;
21
+ foreach my $name (sort grep { / ^E[A-Z]+$ / } keys %POSIX ::) {
22
+ my $code = POSIX-> can($name );
23
+
24
+ next unless $code ;
25
+
26
+ my $value = eval { $code -> () };
27
+
28
+ next unless defined $value ;
29
+
30
+ push @errno_values , [ $name , $value ];
31
+
32
+ if (length ($name ) > $max_errno_name_len ) {
33
+ $max_errno_name_len = length ($name );
34
+ }
35
+ }
36
+
37
+ my $format = " .macro_const POSIX_%-${max_errno_name_len} s %d \n " ;
38
+
39
+ foreach my $pair (@errno_values ) {
40
+ my ( $name , $value ) = @$pair ;
41
+
42
+ printf $format , $name , $value ;
43
+ }
You can’t perform that action at this time.
0 commit comments