### 5.1.150 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
`Syntax:`
  `status (` list_expression`,` int_expression `)`
`Type:`
  int
`Purpose:`
  the list should be a list L of links, the second argument a timeout in 1/10 seconds. Returns
  ``-2``
    select returns an error
  ``-1``
    all links are closed/at eof
  ``0``
    timeout
  ``>0``
    (at least) L[i] is ready
`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.

User manual for Singular version 4.4.1, 2025, generated by texi2html.