Name

atmacros — Macro processor for text files.

Synopsis

atmacros [ -d INTEGER | --debug INTEGER ] [ -h [true]|false | --help [true]|false ] [ -H [true]|false | --help-long [true]|false ] [ -v [true]|false | --verbose [true]|false ] [ --version [true]|false ]

Description

The atmacros is a macro processor (similar in nature to m4) used to process text files. This script uses the Java class: "com.ccg.macros.at.All" out of the com.ccg.macros package to perform its work.

In general, @macro() processing works as follows:

  • ASCII text is directed into the @macro() engine.

  • The @macro()s recognized within the ASCII stream are expanded, all other text passes through unmodified.

Here is simple text file which defines two @macro()s and then copies all of the HTML, PHP and plain text files from the web sub-directory to the build sub-directory:

#
# Define some new macros
#
@define("cyear","2009")
@define("copyright","Copyright (C) @cyear() - networksecuritytoolkit.org")
#
# Now apply macros to a bunch of files
#
@atCopyToDir("web/*.html","web/*.php","web/*.txt","build")

If we saved the above to a file name: "process.at", we could then run it through the @macro()s engine using the following command line invocation:

[root@probe ~]# atmacros < process.at
#
# Define some new macros
#


#
# Now apply macros to a bunch of files
#

[root@probe ~]# 

All of the files copied will have any @macro()s expaned. For example, if the original file: "web/readme.txt" had the following contents:

During @cyear(), we decided to create the "atmacros" script.

@copyright()

The generated file: "build/readme.txt" would have the following contents:

During 2009, we decided to create the "atmacros" script.

Copyright (C) 2009 - networksecuritytoolkit.org

Options

The following command line options are available:

[-d INTEGER] | [--debug INTEGER]

When trouble shooting, it is often useful to include debug output statements within your files being processed. For example, you could add a statement like the following: "@debug(4,"Reached Kismet Section")". This debug statement would normally be ignored (produce no output). However, if you specify a debug level of 4 or higher, the debug statement would echo the output to the standard error device. The minimum value permitted is -1. The maximum value permitted is 9.

[-h [true]|false] | [--help [true]|false]

When this option is specified, atmacros will display a short one line description of atmacros, followed by a short description of each of the supported command line options. After displaying this information atmacros will terminate.

[-H [true]|false] | [--help-long [true]|false]

This option will attempt to pull up additional atmacros documentation within a text based web browser. You can force which browser we use setting the environment variable TEXTBROWSER, otherwise, we will search for some common ones.

[-v [true]|false] | [--verbose [true]|false]

When you set this option to true, atmacros will produce additional output. This is typically used for diagnostic purposes to help track down when things go wrong.

[--version [true]|false]

If this option is specified, the version number of the script is displayed.

Files

/usr/share/atmacros

Directory containing resource files used by atmacros.

Environment

TEXTBROWSER

This controls what text based browser is used to display help information about the script. If not set, we will search your system for available text-based browsers (Ex: elinks, lynx ...).

See Also

atmacros(1), Network Security Toolkit, @macros() Project Page, @macros() API