File: fallback.pl

package info (click to toggle)
fbi 2.14-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,052 kB
  • sloc: ansic: 24,426; sh: 138; perl: 16; makefile: 9
file content (32 lines) | stat: -rwxr-xr-x 503 bytes parent folder | download | duplicates (2)
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
31
32
#!/usr/bin/perl -w
#
# build header file from
#
use strict;

my $in  = shift;
my $out = shift;

open(IN, "<", $in) or die "open (read): $in";
open(OUT, ">", $out) or die "open (write): $out";

while (my $line = <IN>) {
	chomp $line;

	# ignore comments
	next if $line =~ /^!/;
#	next if $line =~ /^\s*$/;

	# quote stuff
	$line =~ s/\\/\\\\/g;
	$line =~ s/\"/\\\"/g;

	# continued line?
	if ($line =~ s/\\\\$//) {
		printf OUT "\"%s\"\n",$line;
		next;
	}

	# write out
	printf OUT "\"%s\",\n",$line;
}