xref: /minix3/external/bsd/nvi/dist/tcl_scripts/gnats.tcl (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc#	Id: gnats.tcl,v 8.2 1995/11/18 12:59:07 bostic Exp  (Berkeley) Date: 1995/11/18 12:59:07
2*84d9c625SLionel Sambuc#
3*84d9c625SLionel Sambucproc init {catFile} {
4*84d9c625SLionel Sambuc	global viScreenId
5*84d9c625SLionel Sambuc	global categories
6*84d9c625SLionel Sambuc	set categories {}
7*84d9c625SLionel Sambuc        set categoriesFile [open $catFile r]
8*84d9c625SLionel Sambuc	while {[gets $categoriesFile line] >= 0} {
9*84d9c625SLionel Sambuc		lappend categories $line
10*84d9c625SLionel Sambuc	}
11*84d9c625SLionel Sambuc	close $categoriesFile
12*84d9c625SLionel Sambuc	viMsg $viScreenId $categories
13*84d9c625SLionel Sambuc	viMapKey $viScreenId  next
14*84d9c625SLionel Sambuc}
15*84d9c625SLionel Sambuc
16*84d9c625SLionel Sambucproc next {} {
17*84d9c625SLionel Sambuc	global viScreenId
18*84d9c625SLionel Sambuc	set cursor [viGetCursor $viScreenId]
19*84d9c625SLionel Sambuc	set lineNum [lindex $cursor 0]
20*84d9c625SLionel Sambuc	set line [viGetLine $viScreenId $lineNum]
21*84d9c625SLionel Sambuc	viMsg $viScreenId [lindex $line 0]
22*84d9c625SLionel Sambuc	if {[lindex $line 0] == ">Confidential:"} {
23*84d9c625SLionel Sambuc		confNext $lineNum $line
24*84d9c625SLionel Sambuc	} elseif {[lindex $line 0] == ">Severity:"} {
25*84d9c625SLionel Sambuc		sevNext $lineNum $line
26*84d9c625SLionel Sambuc	} elseif {[lindex $line 0] == ">Priority:"} {
27*84d9c625SLionel Sambuc		priNext $lineNum $line
28*84d9c625SLionel Sambuc	} elseif {[lindex $line 0] == ">Class:"} {
29*84d9c625SLionel Sambuc		classNext $lineNum $line
30*84d9c625SLionel Sambuc	} elseif {[lindex $line 0] == ">Category:"} {
31*84d9c625SLionel Sambuc		catNext $lineNum $line
32*84d9c625SLionel Sambuc	}
33*84d9c625SLionel Sambuc}
34*84d9c625SLionel Sambuc
35*84d9c625SLionel Sambucproc confNext {lineNum line} {
36*84d9c625SLionel Sambuc	global viScreenId
37*84d9c625SLionel Sambuc	viMsg $viScreenId [lindex $line 1]
38*84d9c625SLionel Sambuc	if {[lindex $line 1] == "yes"} {
39*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Confidential: no"
40*84d9c625SLionel Sambuc	} else {
41*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Confidential: yes"
42*84d9c625SLionel Sambuc	}
43*84d9c625SLionel Sambuc}
44*84d9c625SLionel Sambuc
45*84d9c625SLionel Sambucproc sevNext {lineNum line} {
46*84d9c625SLionel Sambuc	global viScreenId
47*84d9c625SLionel Sambuc	viMsg $viScreenId [lindex $line 1]
48*84d9c625SLionel Sambuc	if {[lindex $line 1] == "non-critical"} {
49*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Severity: serious"
50*84d9c625SLionel Sambuc	} elseif {[lindex $line 1] == "serious"} {
51*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Severity: critical"
52*84d9c625SLionel Sambuc	} elseif {[lindex $line 1] == "critical"} {
53*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Severity: non-critical"
54*84d9c625SLionel Sambuc	}
55*84d9c625SLionel Sambuc}
56*84d9c625SLionel Sambuc
57*84d9c625SLionel Sambucproc priNext {lineNum line} {
58*84d9c625SLionel Sambuc	global viScreenId
59*84d9c625SLionel Sambuc	viMsg $viScreenId [lindex $line 1]
60*84d9c625SLionel Sambuc	if {[lindex $line 1] == "low"} {
61*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Priority: medium"
62*84d9c625SLionel Sambuc	} elseif {[lindex $line 1] == "medium"} {
63*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Priority: high"
64*84d9c625SLionel Sambuc	} elseif {[lindex $line 1] == "high"} {
65*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Priority: low"
66*84d9c625SLionel Sambuc	}
67*84d9c625SLionel Sambuc}
68*84d9c625SLionel Sambuc
69*84d9c625SLionel Sambucproc classNext {lineNum line} {
70*84d9c625SLionel Sambuc	global viScreenId
71*84d9c625SLionel Sambuc	viMsg $viScreenId [lindex $line 1]
72*84d9c625SLionel Sambuc	if {[lindex $line 1] == "sw-bug"} {
73*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Class: doc-bug"
74*84d9c625SLionel Sambuc	} elseif {[lindex $line 1] == "doc-bug"} {
75*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Class: change-request"
76*84d9c625SLionel Sambuc	} elseif {[lindex $line 1] == "change-request"} {
77*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Class: support"
78*84d9c625SLionel Sambuc	} elseif {[lindex $line 1] == "support"} {
79*84d9c625SLionel Sambuc		viSetLine $viScreenId $lineNum ">Class: sw-bug"
80*84d9c625SLionel Sambuc	}
81*84d9c625SLionel Sambuc}
82*84d9c625SLionel Sambuc
83*84d9c625SLionel Sambucproc catNext {lineNum line} {
84*84d9c625SLionel Sambuc	global viScreenId
85*84d9c625SLionel Sambuc	global categories
86*84d9c625SLionel Sambuc	viMsg $viScreenId [lindex $line 1]
87*84d9c625SLionel Sambuc	set curr [lsearch -exact $categories [lindex $line 1]]
88*84d9c625SLionel Sambuc	if {$curr == -1} {
89*84d9c625SLionel Sambuc		set curr 0
90*84d9c625SLionel Sambuc	}
91*84d9c625SLionel Sambuc	viMsg $viScreenId $curr
92*84d9c625SLionel Sambuc	viSetLine $viScreenId $lineNum ">Class: [lindex $categories $curr]"
93*84d9c625SLionel Sambuc}
94*84d9c625SLionel Sambuc
95*84d9c625SLionel Sambucinit abekas
96