49 lines
1.9 KiB
HTML
49 lines
1.9 KiB
HTML
<html>
|
|
<head>
|
|
<!-- This file has been generated by unroff 1.0, 03/21/96 19:29:47. -->
|
|
<!-- Do not edit! -->
|
|
<link rev="made" href="mailto:net@informatik.uni-bremen.de">
|
|
<title>unroff Programmer's Manual, section 14.</title>
|
|
</head><body>
|
|
<h2><a name="section14">14.</a> <tt> </tt>File Insertions
|
|
</h2>
|
|
<p>
|
|
 <tt> </tt> <tt> </tt> <tt> </tt>The primitive
|
|
<i>file-insertions
|
|
</i>is a general-purpose utility for inserting strings into files
|
|
at specified locations in a fast and robust way.<tt> </tt>
|
|
One application is to resolve forward references of any kind among
|
|
a group of files when all files have been processed.<tt> </tt>
|
|
In this case, the insertions would be executed by an
|
|
<i>exit
|
|
</i>event handler.<tt> </tt>
|
|
<h2>
|
|
<a name=".file-insertions">(file-insertions <i>insertions</i>)</a></h2>
|
|
<p>
|
|
 <tt> </tt> <tt> </tt> <tt> </tt><i>insertions
|
|
</i>is a list specifying the parameters for the file insertions.<tt> </tt>
|
|
Each element of the list is itself a list consisting
|
|
of a file name (a string),
|
|
a file offset (an integer between zero and the size of the file),
|
|
and a string to be inserted in the given file at the given offset.<tt> </tt>
|
|
<i>file-insertions
|
|
</i>sorts the list to ensure that each file is only processed once
|
|
and that the offsets for each file are in increasing order.<tt> </tt>
|
|
Then each file is copied to a temporary file
|
|
<dl><dt><dd>
|
|
<pre>
|
|
<i>filename</i>.new
|
|
</pre>
|
|
</dl>
|
|
(where
|
|
<i>filename
|
|
</i>is the original file name), and the specified insertions are
|
|
carried out as the file is copied.<tt> </tt>
|
|
When processing of a file is finished, the temporary file is
|
|
renamed to its original name.<tt> </tt>
|
|
If there exist links to a file, a warning is displayed and the
|
|
insertion is skipped.<tt> </tt>
|
|
<p><hr>
|
|
Markup created by <em>unroff</em> 1.0, <tt> </tt> <tt> </tt>March 21, 1996, <tt> </tt> <tt> </tt>net@informatik.uni-bremen.de</body>
|
|
</html>
|