~ubuntu-branches/ubuntu/natty/ntop/natty

« back to all changes in this revision

Viewing changes to utils/faqtohtml.awk

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2005-01-30 21:59:13 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050130215913-xc3ke963bw49b3k4
Tags: 2:3.0-5
* Updated README.Debian file so users will understand what to do at
  install, closes: #291794, #287802.
* Updated ntop init script to give better output.
* Also changed log directory from /var/lib/ntop to /var/log/ntop,
  closes: #252352.
* Quoted the interface list to allow whitespace, closes: #267248.
* Added a couple of logcheck ignores, closes: #269321, #269319.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ntop - Burton M. Strauss III - Nov2002
 
2
BEGIN {
 
3
    print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"
 
4
    print "<html>"
 
5
    print "<head>"
 
6
    print "<!--meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" -->"
 
7
    print "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">"
 
8
    print "<meta http-equiv=\"Window-target\" content=\"_top\">"
 
9
    print "<meta name=\"description\" content=\"ntop (http://www.ntop.org) FAQ file.\">"
 
10
    print "<meta name=\"author\" content=\"ntop\">"
 
11
 
 
12
    while (getline < "version.c" > 0) {
 
13
        if($3 == "version") {
 
14
            gsub(/["; ]/, "", $5) 
 
15
            print "<meta name=\"generator\" content=\"ntop " $5 "\">"
 
16
        }
 
17
    }
 
18
 
 
19
    print "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">"
 
20
    print "     <title>ntop FAQ</title>"
 
21
    print "</head>"
 
22
    print "<body background=\"white_bg.gif\">"
 
23
    print "<h3>ntop FAQ...</h3>"
 
24
    print "<p>This is an unsophisticated, automated conversion of the source file, docs/FAQ into html."
 
25
    print "Please report problems to the ntop-dev mailing list."
 
26
    print "But remember, it's not about making it look good, it's about making the content available.</p>"
 
27
    print "<hr>"
 
28
    pastHeader="No"
 
29
    pclose="</p>"
 
30
    lines=0
 
31
    allDash=0
 
32
    allEquals=0
 
33
    header=0
 
34
    empty1=0
 
35
    empty2=0
 
36
    section=0
 
37
    q=0
 
38
    a=0
 
39
    text=0
 
40
    pre=0
 
41
    updated=0
 
42
    added=0
 
43
}
 
44
 
 
45
{
 
46
    lines++
 
47
    sub(/[\r\n]$/, "")
 
48
}
 
49
 
 
50
/^\-+$/ { 
 
51
    allDash++
 
52
    pastHeader="Yes"
 
53
    next
 
54
}
 
55
 
 
56
/^=+$/ { 
 
57
    allEquals++
 
58
    next
 
59
}
 
60
 
 
61
/^\-\-\-\-\-/ {
 
62
    gsub(/^\-*/, "", $0)
 
63
    gsub(/\-*$/, "", $0)
 
64
    print "<h2>" $0 "</h2>"
 
65
    next
 
66
}
 
67
 
 
68
pastHeader == "No" {
 
69
    header++
 
70
    next
 
71
}
 
72
 
 
73
$0 == "" {
 
74
    empty1++
 
75
    if (pclose != "") { print pclose }
 
76
    pclose=""
 
77
    next
 
78
}
 
79
 
 
80
/^ +$/ {
 
81
    empty2++
 
82
    if (pclose != "") { print pclose }
 
83
    pclose=""
 
84
    next
 
85
}
 
86
 
 
87
/^Section/ {
 
88
    section++
 
89
    if (pclose != "") { print pclose }
 
90
    pclose=""
 
91
    print "<h2>" $0 "</h2>"
 
92
    next
 
93
}
 
94
 
 
95
$1 == "(Added" {
 
96
    added++
 
97
    if (pclose != "") { print pclose }
 
98
    pclose=""
 
99
    print "<center><i>" $0 "</i></center>"
 
100
    next
 
101
}
 
102
 
 
103
$1 == "(Updated" {
 
104
    updated++
 
105
    if (pclose != "") { print pclose }
 
106
    pclose=""
 
107
    print "<center><i>" $0 "</i></center>"
 
108
    next
 
109
}
 
110
 
 
111
/^[Qq]\. / {
 
112
    q++
 
113
    if (pclose != "") { print pclose }
 
114
    print "<br>"
 
115
    print "<p>"
 
116
    pclose="</p>"
 
117
    print "<b>" $1 "</b>&nbsp;"
 
118
    $1 = ""
 
119
    print $0
 
120
    next
 
121
}
 
122
 
 
123
/^[Aa]\. / {
 
124
    a++
 
125
    if (pclose != "") { print pclose }
 
126
    print "<p>"
 
127
    pclose="</p>"
 
128
    print "<b>" $1 "</b>&nbsp;"
 
129
    $1 = ""
 
130
    print $0
 
131
    next
 
132
}
 
133
 
 
134
(substr($0, 1, 3) == "   " && substr($0, 4, 1) != " ") {
 
135
    text++
 
136
    if (pclose == "") {
 
137
        print "<p>"
 
138
        pclose="</p>"
 
139
    }
 
140
    print $0
 
141
    next
 
142
}
 
143
 
 
144
 
145
    pre++
 
146
    if (pclose != "</pre>") {
 
147
        print pclose
 
148
        print "<pre>"
 
149
        pclose="</pre>"
 
150
    }
 
151
    print $0
 
152
    next
 
153
}
 
154
 
 
155
END {
 
156
    if (pclose != "") { print pclose }
 
157
    printf("<!-- Total Lines........ %5d -->\n\n" \
 
158
           "<!-- (skipped) --s...... %5d -->\n" \
 
159
           "<!-- (skipped) ==s...... %5d -->\n" \
 
160
           "<!-- (skipped) header... %5d -->\n" \
 
161
           "<!-- empty (\"\")......... %5d -->\n" \
 
162
           "<!-- empty (//)......... %5d -->\n" \
 
163
           "<!-- Sections........... %5d -->\n" \
 
164
           "<!-- Q:................. %5d -->\n" \
 
165
           "<!-- A:................. %5d -->\n" \
 
166
           "<!-- Normal text........ %5d -->\n" \
 
167
           "<!-- Preformatted text.. %5d -->\n" \
 
168
           "<!-- Updated.xxmmmyyyy.. %5d -->\n" \
 
169
           "<!-- Added.xxmmmyyyy.... %5d -->\n" \
 
170
           "<!-- ...........TOTAL... %5d -->\n",
 
171
                lines,
 
172
                allDash,
 
173
                allEquals,
 
174
                header,
 
175
                empty1,
 
176
                empty2,
 
177
                section,
 
178
                q,
 
179
                a,
 
180
                text,
 
181
                pre,
 
182
                updated,
 
183
                added,
 
184
                (allDash + allEquals + header + empty1 + empty2 + section + q + a + text + pre + updated + added))
 
185
                
 
186
    print "</body>"
 
187
    print "</html>"
 
188
}
 
189
 
 
190
#Q. What is ntop?
 
191
#A. ntop is an open source network top - the official website can be found at
 
192
#   http://www.ntop.org/
 
193