static
The default Storage-Class Specifier for global variables which makes the variable available only to functions within the current file. You can also define a static variable within a function. The variable is initialized at compilation time and retains it value between calls.
Example
The following example shows a static variable, logon_done, used as a boolean flag to execute the logon procedure once only. logon_done retains its value between each call to Action(). Once it is set to 1, it never again attempts to log on to the server.
#define MAX_RETRIES 5 static int logon_done = 0; int retry; // Attempt to logon MAX_TRIES
if (!logon_done) {// logon to server here and break out of loop if successful
for (retry=0; retry<MAX_RETRIES; retry++)
lr_output_message ("Retry number %d", retry);
logon_done = 1;
}Example: Output:
Action.c(12): Retry number 0
Action.c(12): Retry number 1
Action.c(12): Retry number 2
Action.c(12): Retry number 3
Action.c(12): Retry number 4

