File: sysconftoolcheck.in

package info (click to toggle)
sysconftool 0.21-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 496 kB
  • sloc: sh: 508; perl: 356; makefile: 172
file content (52 lines) | stat: -rw-r--r-- 765 bytes parent folder | download | duplicates (3)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! @PERL@
# Copyright 2000 Double Precision, Inc.  See COPYING for
# distribution information.

my $linenum=0;

my $foundver=0;

my $filename=shift @ARGV;

open (F, $filename) || die "$filename: $!\n";

while (<F>)
{
    ++$linenum;
    if (/^\#\#VERSION:/)
    {
	$foundver=1;
	last;
    }

    last if $linenum > 20;
}

die "Did not find a ##VERSION header.\n" unless $foundver;

while (<F>)
{
    ++$linenum;
    next unless /^\#/;

    my $foundtag=0;

    $foundtag=1 if /^\#\#NAME:/;

    while (<F>)
    {
	++$linenum;

	if ( /^\#\#NAME:/ )
	{
	    die "Line $linenum: second ##NAME tags, without a setting.\n"
		if $foundtag;
	    $foundtag=1;
	}

	last unless /^#/;
    }

    print "Warning - line $linenum - did not see a ##NAME.\n"
	unless $foundtag;
}