File: config_h2.awk

package info (click to toggle)
ntop 3%3A5.0.1%2Bdfsg1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 15,720 kB
  • ctags: 11,480
  • sloc: ansic: 79,804; sh: 21,658; python: 1,948; awk: 1,504; perl: 971; makefile: 745; php: 123; xml: 71; sql: 13; sed: 11
file content (74 lines) | stat: -rwxr-xr-x 2,203 bytes parent folder | download | duplicates (4)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#/* #undef CFG_BIG_ENDIAN */
#
#/* Configuration file directory */
##define CFG_CONFIGFILE_DIR "/usr/share/ntop"
#
BEGIN {
    WHOAMIFROM=ARGV[1]
    ARGV[1]=""

    print "  /*                                                       B E G I N"
    print "   *"
    print "   * Autogenerated from " WHOAMIFROM " and inserted into webInterface.c "
    print "   *      " strftime()
    print "   *"
    print "   */"
    print ""

    while (getline < "stoplist" > 0) {
        stopentry[$1]="y"
    }
    firstz="y"
}

{
    if ($1 in stopentry) { next } 

    if (substr($1, 1, 1) == "z") { 
      $1 = substr($1, 2)
      if(firstz == "y") {
        firstz="n"
        print "  /* Move the following lines */"
      }
    }

    if ($2 == "*") {
        print "  printFeatureConfigInfo(textPrintFlag, \"" $1 "\","
        print "#ifdef " $1
        print "                         \"yes\""
        print "#else"
        print "                         \"no\""
        print "#endif"
        print "                         );"
    } else if (substr($2, 1, 1) == "\"") {
        print "#ifdef " $1
        print "  printFeatureConfigInfo(textPrintFlag, \"" $1 "\", " $2 ");"
        print "#else"
        print "  printFeatureConfigInfo(textPrintFlag, \"" $1 "\", \"undefined\");"
        print "#endif"
    } else if (substr($2, 1, 1) == "#") {
        print "#ifdef " $1
        print "  printFeatureConfigNum(textPrintFlag, \"" $1 "\", " substr($2, 2) ");"
        print "#else"
        print "  printFeatureConfigInfo(textPrintFlag, \"" $1 "\", \"undefined\");"
        print "#endif"
    } else if ($2 == "NULL") {
        print "  printFeatureConfigInfo(textPrintFlag, \"" $1 "\", \"(null)\");"
    } else {
        print "#ifdef " $1
        print "  printFeatureConfigInfo(textPrintFlag, \"" $1 "\", " $2 ");"
        print "#else"
        print "  printFeatureConfigInfo(textPrintFlag, \"" $1 "\", \"undefined\");"
        print "#endif"
    }
    print ""
}

END {
    print "  /*                                                       E N D"
    print "   *"
    print "   * Autogenerated from " WHOAMIFROM " and inserted into webInterface.c "
    print "   *"
    print "   */"
    print ""
}