]> git.zerfleddert.de Git - micropolis/blame - src/tclx/tclsrc/forfile.tcl
Makefile: Micropolis build fixes for recent macOS
[micropolis] / src / tclx / tclsrc / forfile.tcl
CommitLineData
6a5fa4e0
MG
1#
2# forfile.tcl --
3#
4# Proc to execute code on every line of a file.
5#------------------------------------------------------------------------------
6# Copyright 1992 Karl Lehenbauer and Mark Diekhans.
7#
8# Permission to use, copy, modify, and distribute this software and its
9# documentation for any purpose and without fee is hereby granted, provided
10# that the above copyright notice appear in all copies. Karl Lehenbauer and
11# Mark Diekhans make no representations about the suitability of this
12# software for any purpose. It is provided "as is" without express or
13# implied warranty.
14#------------------------------------------------------------------------------
15# $Id: forfile.tcl,v 2.0 1992/10/16 04:51:58 markd Rel $
16#------------------------------------------------------------------------------
17#
18
19#@package: TclX-forfile for_file
20
21proc for_file {var filename code} {
22 upvar $var line
23 set fp [open $filename r]
24 while {[gets $fp line] >= 0} {
25 uplevel $code
26 }
27 close $fp
28}
29
Impressum, Datenschutz