mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 12:59:21 +08:00
b2476bc523
On Linux, __progname and program_invocation_short_name are just different exported names of the same string. Do the same in Cygwin. This requires to tweak the mkglobals_h so as not to touch the EXPORT_ALIAS expression. Also, use the base variable program_invocation_short_name throughout. __progname is just the export for getopt. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
30 lines
631 B
Perl
Executable File
30 lines
631 B
Perl
Executable File
#!/usr/bin/perl
|
|
my @argv = @ARGV;
|
|
$_ = join('', <>);
|
|
s/\s+\n/\n/sog;
|
|
s/\n[^\n]*!globals.h[^\n]*\n/\n/sog;
|
|
s%/\*.*?\*/%%sog;
|
|
s/EXPORT_ALIAS.*\n//so;
|
|
s/(enum\s.*?{.*?})/munge($1)/soge;
|
|
s/^(\s*)([a-zA-Z_])/$1extern $2/mog;
|
|
s/extern (extern|enum)/$1/sog;
|
|
s/\n\s*extern static[^\n]*\n/\n/sog;
|
|
s/\s+=.*?;/;/sog;
|
|
s/^\n+//sog;
|
|
s/#include "winsup\.h"\n//so;
|
|
s/-NL-/\n/sog;
|
|
s/-EQ-/=/sog;
|
|
s/\n{2,}/\n/sog;
|
|
print <<PRELUDE,$_;
|
|
/* $target - Autogenerated from @argv. Look there for comments. */
|
|
|
|
#pragma once
|
|
PRELUDE
|
|
close $target_fd;
|
|
sub munge($) {
|
|
my $val = shift;
|
|
$val =~ s/\n/-NL-/sog;
|
|
$val =~ s/=/-EQ-/sog;
|
|
return $val;
|
|
}
|