The `first' command

A command that has very close connections with the macro's is the command `first'. Its syntax is:

	first pattern
in which the pattern should be acceptable to the local file system. This statement returns no value. After this command has been given the various files that match this pattern can be obtained with the successive use of the variable $nextfile. This variable returns the logical values true and false depending on whether a new file was found. The information about a file can then be obtained with the variables $nextatt, $nextdate, $nextname and $nextsize (see p. [*]). This is shown in the following example:
    home
    first $1
    while $nextfile
    set i = ( $nextname // "			  " ) << 12
    set j = ( "		" // $nextsize ) >> 7
    "$i  $nextatt  $j  $nextdate\n"
    endwhile
This macro expects one argument. This argument is used as a pattern in a `first' command. After this each file that is found in the successive use of $nextfile has its name, attributes, size and date put in the current buffer in a nice format. This formatting works in a rather simple manner. In the variable i the name is concatenated with a string of 12 blanks. After this only the leftmost 12 characters are taken from this string. The command "$i $j $k $nextdate\n" puts all variables and some intermediate blanks as text in the current buffer and the \n indicates that a newline should be started after this.