Tutorial Developer Reference 1 Introduction 2 Interface 3 Scanner 4 Parser 5 Analyser 6 Tangle 7 Weave 8 Shell 9 Commands 10 Glossary 11 References SEARCH

9.12 Fixeols

The `fixeols` command takes two filename arguments: an input file and an output file. It reads in the input file and writes it to the output file changing all the end of line control character sequences to the local format. It can also take one filename argument, in which case it replaces the target file with its transformation.

    Syntax  : fixeols = "fixeols" s filename [s filename]
    Examples: fixeols imported.hak result.kln
              fixeols sloth.dat

The `fixeols` command works by parsing the input file into alternating runs of printable characters (ASCII 20 to ASCII 126) and runs of non-printable characters (all the others). It then parses each run of non-printable characters from left to right into subruns of non-printables not containing the same character twice. It then replaces each subrun with a native EOL. (Note: A native EOL can be inserted into a text file in a portable manner simply by writing "`\n`" to the text output stream). For example, if a native EOL is `X`, and `ABCD` are non-printable characters, and the file to be converted is

    thisABisABCDanABABexampleABCCCof the conversion.

then `fixeols` would produce

    thisXisXanXXexampleXXXof the conversion.

The `fixeols` command was devised to solve the problem created sometimes when text files are moved from one machine to another (e.g. with the Kermit program) using a binary transfer mode rather than a text transfer mode. If such a transfer is made, and the text file line termination conventions differ on the two machines, one can wind up with a set of text files with improperly terminated lines. This can cause problems on a number of fronts, but in particular affects regression testing which relies heavily on exact comparisons between files. The `fixeols` command provides a solution to this problem by providing a portable way to "purify" text files whose end of lines have become incorrect. The regression testing scripts all apply `fixeols` to their input and output files before each test.

Webmaster Copyright © Ross N. Williams 1992,1999. All rights reserved.