Singular

Home Online Manual
Top
Back: sres
Forward: std
FastBack: Functions and system variables
FastForward: Control structures
Up: Functions
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.1.142 status

Syntax:
status ( link_expression, string_expression )
Type:
string
Syntax:
status ( link_expression, string_expression, string_expression )
Type:
int
Purpose:
returns the status of the link as asked for by the second argument. If a third argument is given, the result of the comparison to the status string is returned: (status(l,s1)==s2) is equivalent to status(l,s1,s2).
The following string expressions are allowed:
"name"
the name string given by the definition of the link (usually the filename)
"type"
returns "ASCII", "DBM" or "ssi"
"open"
returns "yes" or "no"
"openread"
returns "yes" or "no"
"openwrite"
returns "yes" or "no"
"read"
returns "ready" or "not ready"
"write"
returns "ready" or "not ready"
"mode"
returns (depending on the type of the link and its status) "","w","a","r" or "rw"
"exists"
returns "yes" or "no": existence of the filename for ASCII/ssi links
Example:
 
  link l=":w example.txt";
  status(l,"write");
==> not ready
  open(l);
  status(l,"write","ready");
==> 1
  close(l);
See link; open; read; write.