Removed lines and list as synonyms of list in MARC extractron.
[ir-tcl-moved-to-github.git] / display.tcl
1 # $Id: display.tcl,v 1.2 1995-08-28 12:21:21 adam Exp $
2 #
3 # Record display
4 proc display {zset no} {
5     set type [$zset type $no]
6     if {$type == "SD"} {
7         set err [lindex [$zset diag $no] 1]
8         set add [lindex [$zset diag $no] 2]
9         if {$add != {}} {
10             set add " :${add}"
11         }
12         puts "Error ${err}${add}"
13         return
14     }
15     if {$type != "DB"} {
16         return
17     }
18     set rtype [$zset recordType $no]
19     if {$rtype == "SUTRS"} {
20         puts [join [$zset getSutrs $no]]
21         return
22     } 
23     if {[catch {set r [$zset getMarc $no line * * *]}]} {
24         puts "Unknown record type: $rtype"
25         return
26     }
27     foreach line $r {
28         set tag [lindex $line 0]
29         set indicator [lindex $line 1]
30         set fields [lindex $line 2]
31         puts -nonewline "$tag "
32         if {$indicator != ""} {
33             puts -nonewline $indicator
34         }
35         foreach field $fields {
36             set id [lindex $field 0]
37             set data [lindex $field 1]
38             if {$id != ""} {
39                 puts -nonewline " \$$id "
40             }
41             puts -nonewline $data
42         }
43         puts ""
44     }
45 }
46