File: test1.tcl

package info (click to toggle)
hfsutils 3.1-4
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,408 kB
  • ctags: 1,340
  • sloc: ansic: 12,976; tcl: 1,894; makefile: 595; sh: 152; perl: 29
file content (62 lines) | stat: -rw-r--r-- 827 bytes parent folder | download | duplicates (2)
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
54
55
56
57
58
59
60
61
62
#
# NAME:		test1
# DESCRIPTION:	fragment two files to excess
#
proc test1 {} {
    global curvol

    set block [block]

    mkvol

    puts "Creating files ..."

    set file1 "Foo"
    set file2 "Bar"

    hcreate $file1
    hcreate $file2

    puts "Fragmenting files ..."

    set count 0

    for {set i 0} {$i < 250} {incr i} {
	set len [string length "$i "]

	if {[expr $count + $len] > 79} {
	    puts ""
	    set count 0
	}

	puts -nonewline "$i "
	flush stdout
	incr count $len

	set file [$curvol open $file1]

	$file fork data
	$file seek 0 end
	$file write $block

	$file fork rsrc
	$file seek 0 end
	$file write $block

	$file close

	set file [$curvol open $file2]

	$file fork data
	$file seek 0 end
	$file write $block

	$file fork rsrc
	$file seek 0 end
	$file write $block

	$file close
    }

    puts ""
}