summaryrefslogtreecommitdiffstats
path: root/tdeabc/vcardparser/checkvcard.pl
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-02-15 21:57:54 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-02-15 21:57:54 -0600
commited99a30644c19b0a3cf0d2147243532df4daa16b (patch)
tree7f3f2850e59824fdf100a642367a82b1e7f0204f /tdeabc/vcardparser/checkvcard.pl
parente5f2d46e9caf6942f365f1b454087dda71a340f7 (diff)
downloadtdelibs-ed99a30644c19b0a3cf0d2147243532df4daa16b.tar.gz
tdelibs-ed99a30644c19b0a3cf0d2147243532df4daa16b.zip
Rename additional header files to avoid conflicts with KDE4
Diffstat (limited to 'tdeabc/vcardparser/checkvcard.pl')
-rwxr-xr-xtdeabc/vcardparser/checkvcard.pl75
1 files changed, 75 insertions, 0 deletions
diff --git a/tdeabc/vcardparser/checkvcard.pl b/tdeabc/vcardparser/checkvcard.pl
new file mode 100755
index 000000000..67160ea4a
--- /dev/null
+++ b/tdeabc/vcardparser/checkvcard.pl
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+if ( @ARGV != 1 ) {
+ print STDERR "Missing arg: filename\n";
+ exit 1;
+}
+
+$file = $ARGV[0];
+
+if ( !open( IN, "$file" ) ) {
+ print STDERR "Unable to open '$file'\n";
+ exit 1;
+}
+
+while( <IN> ) {
+ if (/^VERSION:(.*)$/ ) {
+ $version = $1;
+ if ( $version eq "2.1" ) { $options = "--vcard21"; }
+ }
+}
+
+close IN;
+
+$ref = "$file.ref";
+
+if ( !open( REF, "$ref" ) ) {
+ print STDERR "Unable to open $ref\n";
+ exit 1;
+}
+
+while( <REF> ) {
+ push @ref, $_;
+}
+
+close REF;
+
+if ( !open( READ, "./testread $file $options 2> /dev/null |" ) ) {
+ print STDERR "Unable to open testread\n";
+ exit 1;
+}
+
+print "Checking '$file':\n";
+
+$gotsomething = 0;
+$error = 0;
+$i = 0;
+while( <READ> ) {
+ $gotsomething = 1;
+ $out = $_;
+ $ref = @ref[$i++];
+
+ if ( $out ne $ref ) {
+ if ( $ref =~ /^UID/ && $out =~ /^UID/ ) { next; }
+ $error++;
+ print " Expected : $ref";
+ print " Parser output : $out";
+ }
+}
+
+close READ;
+
+if ( $gotsomething == 0 ) {
+ print "\n FAILED: testread didn't output anything\n";
+ system "touch FAILED";
+ exit 1;
+}
+if ( $error > 0 ) {
+ print "\n FAILED: $error errors found.\n";
+ system "touch FAILED";
+ exit 1;
+} else {
+ print " OK\n";
+}
+
+exit 0;