# $status(5)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

$status - Macro command execution status

## SYNOPSIS

$status boolean

boolean `TRUE` (1) | `FALSE` (0)

## DESCRIPTION

$status contains the return status of the last command executed (`TRUE` or `FALSE`). $status is generally used with the !force directives in macros.

## NOTES

This variable can not be set, any attempt to set it will result in an error.

## EXAMPLE

The following example shows how the variable is used within a macro construct, it converts all tab characters to their SPACE equivalent.

    ;
    ; tabs-to-spaces.
    ; Convert all of the tabs to spaces.
    define-macro tabs-to-spaces
        ; Remember line
        set-variable #l0 $window-line
        beginning-of-buffer
        !force search-forward "\t"
        !while $status
            set-variable #l1 $window-acol
            backward-delete-char
            &sub #l1 $window-acol insert-space
            !force search-forward "\t"
        !done
        goto-line #l0
        screen-update
        ml-write "[Converted tabs]"
    !emacro

In this case $status monitors the search-forward command which is searching for a tab character. The command returns a status value of `TRUE` if a tab is found, otherwise `FALSE`.

The !force statement prevents the macro from terminating when a `FALSE` condition is detected, if omitted the macro would terminate with an error as soon as the `FALSE` status is encountered. The definition of tabs-to-spaces(3) can be found in format.emf.

## SEE ALSO

execute-file(2), !force(4), $result(5), tabs-to-spaces(3).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>