File: sc_epgn.tcl

package info (click to toggle)
scid 1%3A4.7.4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,340 kB
  • sloc: tcl: 92,411; cpp: 38,013; sh: 1,697; python: 277; javascript: 201; makefile: 89; perl: 86
file content (32 lines) | stat: -rw-r--r-- 977 bytes parent folder | download | duplicates (5)
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
#!/bin/sh

# sc_epgn: prints the PGN representation of selected games in a
#   Scid database, with no comments, variations or nonstandard tags,
#   making it useful for email correspondence chess since you don't
#   want to send your opponent your notes and analysis.

# The "\" at the end of the comment line below is necessary! It means
#   that the "exec" line is a comment to Tcl but not to /bin/sh.
# The next line restarts using tkscid, the Scid Tcl interpreter: \
exec tkscid "$0" "$@"

if {$argc < 2} { 
    puts "Usage: sc_epgn database game-number(s)"
    puts "Example: sc_epgn  mybase  1 2 3"
    exit 1
}

set baseName [ lindex $argv 0 ]
if [catch { sc_base open $baseName }] {
    puts "Error: could not open database"
    exit 1
}

foreach i [lrange $argv 1 end] {
    if [catch { sc_game load $i }] {
        puts -nonewline "Error: could not load game number "
        puts $i
        exit 1
    }
    puts [sc_game pgn -tags 0 -comments 0 -var 0 -width 70]
}