]> git.pld-linux.org Git - packages/suspend-utils.git/blame - wlcsv2c.pl
- disable plymouth support, API changed to the point patch needs full rewrite
[packages/suspend-utils.git] / wlcsv2c.pl
CommitLineData
bece211a
AM
1#!/usr/bin/perl
2# Rodolfo Garcia kix_at_kix.es
3# suspend database management v1.0
4
5use Switch;
6
7switch ($#ARGV) {
8 case 0 {
9 my $fin = $ARGV[0];
10 open(INF, "<$fin") or die "Could not open input file\n";
11 open(OUF, ">&STDOUT") or die "Could not open output file\n";
12 }
13 case 1 {
14 my $fin = $ARGV[0];
15 my $fout = $ARGV[1];
16 open(INF, "<$fin") or die "Could not open input file\n";
17 open(OUF, ">$fout") or die "Could not open output file\n";
18 }
19 else {
20 my $msg = $0 . " <input-file> [output-file]";
21 die $msg;
22 }
23}
24
25&print_c_header;
26
27my $sys_vendor = "";
28my $sys_product = "";
29my $sys_version = "";
30my $bios_version = "";
31my $flags = "";
32my $comments = "";
33
34while(<INF>) {
35 if (/"([^"]*)",\s*"([^"]*)",\s*"([^"]*)",\s*"([^"]*)",\s*([^,]*),\s*(.*)/) {
36 $sys_vendor = $1;
37 $sys_product = $2;
38 $sys_version = $3;
39 $bios_version = $4;
40 $flags = $5;
41 $comments = $6;
42
43 printf OUF "\t$comments\n";
44 printf OUF "\t{ \"" . $sys_vendor . "\",\t\"" . $sys_product . "\",\t\"" . $sys_version . "\",\t\"" . $bios_version . "\",\t" . $flags . " },\n";
45 }
46}
47
48&print_c_footer;
49
50close(INF);
51close(OUF);
52
53sub print_c_header
54{
55 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
56
57 printf OUF "/* whitelist.c\n";
58 printf OUF " * whitelist of machines that are known to work somehow\n";
59 printf OUF " * and all the workarounds\n";
60 printf OUF " * Script generated file, please do not edit by hand\n";
61 printf OUF " */\n";
62 printf OUF "\n";
63 printf OUF "\#include \"config.h\"\n";
64 printf OUF "\#include \<stdlib.h\>\n";
65 printf OUF "\#include \"whitelist.h\"\n";
66 printf OUF "\n";
67
68 printf OUF "char *whitelist_version = \"\$Id: whitelist.c ver. ";
69 printf OUF "%4d%02d%02d %02d:%02d:%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec;
70 printf OUF " automatic generation - kix - Exp \$\";\n";
71 printf OUF "\n";
72 printf OUF "struct machine_entry whitelist[] = {\n";
73}
74
75sub print_c_footer
76{
77 print OUF "\t{ NULL, NULL, NULL, NULL, 0 }\n";
78 print OUF "};\n";
79}
This page took 0.08326 seconds and 4 git commands to generate.