| THE META-HTML LANGUAGE REFERENCE MANUAL

Page Operators | [TOC] | Stream Operators

## Section Intro: File Operators

Synopsis:

There are several types of commands in Meta-HTML for dealing with files.

Some of these commands operate directly on an open files, while others operate on streams, which may be connected to files or network data.

The functions allow you to `include` the contents of, open, create, read, or write various data sources, or to replace the contents of page with another file.

Commands:

cgi-exec directory-contents | get-file-properties include | require

Variables:

mhtml::require-directories | mhtml::require-loaded |  |

More Information:

Commands such as `get-file-properties` may return additional information on some systems; this is documented with each function where that is the case.

Also see Stream Operators.

### Function Documentation

`<cgi-exec PATHNAME [ARG1] ... [ARGN] [OUTPUT=VARNAME] [ERRORS=VARNAME]>` | Simple

Execute the system function named by PATH, perhaps passing it arguments ARG1 ... ARGN.

If OUTPUT=VARNAME is supplied, then VARNAME receives the output of the command. Otherwise, the resultant output is placed in the page.

If ERRORS=VARNAME is supplied, then VARNAME receives the error output of the command. Otherwise, the resultant output is placed in `SYSTEM-ERROR-OUTPUT`.

`<directory-contents PATH [PACKAGE-NAME] [MATCHING=PATTERN]>` | Simple

Returns a newline separated list of association lists for the files matching PATTERN.

When PACKAGE-NAME is supplied, each variable in PACKAGE-NAME is the name of a file in PATH, and the value of each variable is the association list for that file.

`<get-file-properties PATH>` | Simple

Return an association-list containing operating system information about the file or directory named by PATH. PATH must be given fully; it is not relative to Web space in any way.

If the file exists and is accessible, the members of the returned association-list which are guaranteed to be present are:

Member | Value | Description

NAME | welcome.mhtml | The name of the file or directory, without any of the path information.

FULL-NAME | /www/site/docs/welcome.mhtml | The name of the file or directory, with full path information. This should be identical to PATH as received by `get-file-properties`.

SIZE | 2188 | The size of the file in bytes.

TYPE | FILE | The type of the file. This will either be `FILE` or `DIRECTORY`.

In addition to the above fields, the following fields appear on Unix based systems.

CREATED | 6 29 96 10 3 24 | The date on which this file was created. The value is an array, with ordered values being: month, day, year, hours, minutes, and seconds.

WRITTEN | 6 29 96 10 3 24 | The date on which this file was last written. The value is an array, with ordered values being: month, day, year, hours, minutes, and seconds.

READ | 6 30 96 19 27 51 | The date on which this file was last read. The value is an array, with ordered values being: month, day, year, hours, minutes, and seconds.

CREATOR | bfox | The system identifier of the user who created this file.

`<include FILENAME [ALT=CODE] [VERBATIM]>` | Simple

Insert the contents of the file named by FILENAME into the document at the point where the `include` form was read. If the positional argument VERBATIM is given, then the contents of the file are not executed, only inserted. Otherwise, execution resumes at the point where the file was inserted.

FILENAME can be given as an absolute pathname, or a relative pathname. If the path is relative, it is considered to be relative to the location of the document which contains the `include` form. If the path given is not relative, it is appended to the directory found in MHTML::INCLUDE-PREFIX.

If the named file could not be found on the server, and an ALT value is given, then that value is placed into the page instead.

`<require STEM>` | Simple

`require` tries hard to locate the source or library file specified by STEM, and then loads that file if it hasn't already been loaded.

If the variable `mhtml::require-directories` is present, then it is an array of directory names (without trailing slashes) relative to Web space that should be searched through, in the order that they appear in the array.

`require` understands the following extensions:

- .mhtml, or .src: A Meta-HTML source file.

- .lib: A Meta-HTML library file.

`require` loads the newest version of the file that it finds, and records the complete pathname of the loaded file in the array variable `mhtml::require-loaded`.

Edit Section
Function Index
Variable Index

The META-HTML Reference Manual V1.4 Copyright © 1995, 1996, Brian J. Fox, 1996, 1997 Universal Access Inc.
Found a bug? Send mail to bug-manual@metahtml.com