File: cmd.tcl

package info (click to toggle)
tcllib 1.14-dfsg-3%2Bdeb7u1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 33,036 kB
  • sloc: tcl: 148,302; ansic: 14,067; sh: 10,320; xml: 1,766; yacc: 753; pascal: 551; makefile: 129; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (53 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download
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
# -*- tcl -*-
# Implementation of 'note'.

# Available variables
# * argv  - Cmdline arguments
# * base  - Location of sak.tcl = Top directory of Tcllib distribution
# * cbase - Location of all files relevant to this command.
# * sbase - Location of all files supporting the SAK.

package require sak::util
package require sak::note

set raw  0
set log  0
set stem {}
set tclv {}

if {![llength $argv]} {
    sak::note::show
    return
}
if {[llength $argv] == 1} {
    set f [lindex $argv 0]
    if {![file exists $f] ||
	![file isfile $f] ||
	![file readable $f]
    } {
	sak::note::usage
    }
    set c [open $f]
    set d [string trimright [read $c]]
    close $c

    foreach line [split $d \n] {
	if {[llength $line] < 3} {
	    puts stdout "\tBad line: '$line'"
	    exit 1
	}
	foreach {m p} $line break
	set notes [lrange $line 2 end]
	sak::note::run $m $p $notes
    }
    return
} elseif {[llength $argv] < 3} {
    sak::note::usage
}
foreach {m p} $argv break
set notes [lrange $argv 2 end]

sak::note::run $m $p $notes

##
# ###