| # activate a pre-defined configuration |
| my $config_h = "../include/polarssl/config.h"; |
| open my $fh, '<', $config_h or die "Failed to read $config_h: $!\n"; |
| while( my $line = <$fh> ) { |
| $state = 'skip' if $line =~ /} name SECTION: System support/; |
| elsif( $state eq 'skip' ) { |
| $state = 'post' if $line =~/} name SECTION: PolarSSL modules/; |
| die "Failed to parse $config_h\n" if( $state ne 'post' ); |
| open my $fh, '<', $file_name or die "Failed to read $file_name: $!\n"; |
| my ($pre, $mid, $post) = @_; |
| open my $fh, '>', $config_h or die "Failed to write $config_h: $!\n"; |
| my $custom_file_name = $ARGV[0]; |
| my ($pre, $post) = read_default(); |
| my $mine = read_custom( $custom_file_name ); |
| write_custom( $pre, $mine, $post ); |