MHonArc Resources: DEFINEVAR

MHonArc Resource List | TOC

# DEFINEVAR

## Syntax

Envariable

  N/A

Element

  `<DEFINEVAR>
  ` variable-name
  value ...
  `</DEFINEVAR>
  `

Command-line Option

  `-definevar` variable-specification-list

## Description

DEFINEVAR is used for creating user-defined resource variables. DEFINEVAR can be defined on the command-line or in the resource file.

On the command-line, the option is called `-definevar` The following argument after `-definevar` is treated as a variable specification list. The specification list is a string containing name/value pairs with the following format:

NAME`=`VALUE

Multiple name/value pairs are separated by whitespace. If VALUE contains whitespace, then it must be surrounded by quotes to prevent the command shell from treating the string as multiple arguments. Multiple `-definevar` options can be specified on the command-line. This can help reduce the ugliness of specify mutliple variable definitions with a single option.

NOTE | If you intend to include resource variables as part of the VALUE, you may need to escape the '$' characters (and possible other characters) to prevent interpolation by the command shell. See your command shell documentation for more information.

In a resource file the <DEFINEVAR> element may occur mutliple times to define multiple variables. The first line of the <DEFINEVAR> element is the name of the variables. All subsequent lines represent the content of the variable. If you do not want the last newline of a <DEFINEVAR> element content to be part of the defined variable content, then specify the `chop` attribute.

## Default Setting

N/A

## Resource Variables

N/A

## Examples

The following is a simple example of defining a variable to represent the base text for the title of an archive:

    <DefineVar chop>
    MAIN-TITLE
    Comp.lang.perl.misc
    </DefineVar>

Now, the variable can be refernced as follows:

    <TTitle chop>
    $MAIN-TITLE$ (thread)
    </TTitle>

If you wanted to use the same resource file for multiple arcvhives it may better to define `$MAIN-TITLE$` on the command-line as follows:

        % mhonarc -definevar MAIN-TITLE='mhonarc mailing list' ...

## Version

2.0

## See Also