readfile(1fmli)


readfile, longline -- read file, get longest line

Synopsis

   readfile file
   

longline [file]

Description

The readfile function reads file and copies it to stdout. No translation of NEWLINE is done. It keeps track of the longest line it reads and if there is a subsequent call to longline, the length of that line, including the NEWLINE character, is returned.

The readfile function primarily checks the system's locale. If it is not set to C (default), it tries to read file from dirname/$LANG. If no file can be found under dirname/$LANG, file will be read from dirname.

The longline function returns the length, including the NEWLINE character, of the longest line in file. If file is not specified, it uses the file named in the last call to readfile.

Examples

Here is a typical use of readfile and longline in a text frame definition file:
      .
      .
      .
   text="`readfile myfile`"
   columns=`longline`
      .
      .
      .

Diagnostics

If file does not exist, readfile will return FALSE (that is, the expression will have an error return).

longline returns 0 if a readfile has not previously been issued.

Notices

More than one descriptor can call readfile in the same frame definition file. In text frames, if one of those calls is made from the text descriptor, then a subsequent use of longline will always get the longest line of the file read by the readfile associated with the text descriptor, even if it was not the most recent use of readfile.

References

cat(1)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004