summaryrefslogtreecommitdiff
path: root/v4l/scripts/headers_convert.pl
blob: 800a453e18f2418307bfc60b96515ed9916d1091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl
#
# headers_install prepare the listed header files for use in
# user space and copy the files to their destination.
#

use strict;
use warnings;

foreach (@ARGV) {
	my $file = $_;
	my $tmpfile = $file . ".tmp";

	open(my $infile, '<', "$file")
		or die "$file: $!\n";
	open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n";
	while (my $line = <$infile>) {
		$line =~ s/([\s(])__user\s/$1/g;
		$line =~ s/([\s(])__force\s/$1/g;
		$line =~ s/([\s(])__iomem\s/$1/g;
		$line =~ s/\s__attribute_const__\s/ /g;
		$line =~ s/\s__attribute_const__$//g;
		$line =~ s/^#include <linux\/compiler.h>//;
		printf $outfile "%s", $line;
	}
	close $outfile;
	close $infile;
	system "mv $tmpfile $file";
}
exit 0;