File: chrcformat_05-07

package info (click to toggle)
mailfilter 0.8.6-3
  • links: PTS
  • area: main
  • in suites: buster
  • size: 3,316 kB
  • sloc: cpp: 2,452; sh: 1,393; ansic: 1,259; lex: 570; yacc: 468; makefile: 169; perl: 72
file content (41 lines) | stat: -rwxr-xr-x 959 bytes parent folder | download | duplicates (8)
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
#!/usr/bin/perl
#
# chrcformat_05-07:
# Change the format of the mailfilterrc from version 0.5 to 0.7
#
# Usage:
# $ mv ~/.mailfilterrc ~/.mailfilterrc.05
# $ chmod u+x chrcformat_05-07
# $ cat ~/.mailfilterrc.05 | chrcformat_05-07 > ~/.mailfilterrc
#
# This is a perl-skript. Depending on your system you may have
# to adjust the first line.
#
# ---------------------
# Licensed under GPL v2
# ---------------------
#
# 13.11.2003
# Til Schubbe <t.schubbe@gmx.de>
#

$mf_number_keywords =
	' VERBOSE PORT MAXSIZE_DENY MAXSIZE_ALLOW ' .
	'MAXLENGTH TIMEOUT HIGHSCORE ';

while (<>) {
  $l++;
  chomp;
  if (/^(#|\s*$)/) {		# skip comment or empty line
    print "$_\n";
  } elsif (/^(([A-Z_]+)(\s+[+-]?[0-9]+)?\s*(=|<>)\s*)(.*)/) {
    $keyword = $2;
    if ($mf_number_keywords =~ m/ $keyword /) {
      print "$_\n";		# let numbers unquoted
    } else {
      print "$1\"$5\"\n";	# quote the regex
    }
  } else {
    die "error in line $l: '$_'\n";
  }
}