Making the Most of Andrew

In this article, Terry Gliedt completes our tour through the Andrew project with details on using and customizing AUIS applications.
Initialization Files

At startup AUIS applications look for several initialization files. There are two classes of these, global or machine-wide files found in /usr/andrew/lib and personal files, found in your home directory. Each application can have its own initialization file. For example, ez would check for files in this order:

~/.ezinit
/usr/andrew/lib/global.ezinit
~/.atkinit
/usr/andrew/lib/global.atkinit

If the .ezinit file is found, the global.ezinit is not read. Similarly, if .atkinit is found, the global.atkinit file is not read. This ordering means that when you create an initialization file, you should make it refer to the files that it masks by using an “include” statement. So, if you are going to make a .ezinit file, you would want to include the global.ezinit by:

include /usr/andrew/lib/global.ezinit
include $HOME/.atkinit

and your ~/.atkinit should probably include /usr/andrew/lib/global.atkinit.

If you don't include the global file, you will not get important default settings. Note, though, that not all programs have global initialization files. When something is defined more than once, the last definition stays in effect.

While I used ez in this example, this works exactly the same for typescript or any other AUIS application. Typescript would read ~/.typescriptinit, or if that file did not exist, it would read /usr/andrew/lib/global.typescriptinit instead. All applications look for ~/.atkinit and /usr/andrew/lib/global.atkinit. These files are described in more detail with the command auishelp initfiles.

Controlling Menus

In AUIS applications menus are simply a means to call a procedure (method) for an object. AUIS has hundreds of these defined and they provide enormous functionality. To define a menu, edit one of the initialization files described previously (a personal initialization file is probably best) and add lines like these:

addmenu filter-filter-region-thru-command
"Misc,Flow~20"  textview \
        filter inherit "flowtogether"
addmenu textview-lowercase-word         "Misc,Lower~21"
textview
addmenu textview-uppercase-word         "Misc,Upper~22"
textview
addmenu filter-filter-region            "Misc,Filter
Prompt~25" textview

The entries shown add items like Flow and Lower to the Misc menu card. The order of these items is determined by the numbers (20, 21, etc.). When you select a item like Lower, the procedure textview-lowercase-word will be called and the selected area will be folded to lower case.

Knowing the procedure names is important to create menu cards. There is no fixed list of all the procedures that are in AUIS because the AUIS objects are dynamically loaded. To help you find out what is available, select Describe Proc Table on the Misc menu card. This will open a window which displays a list of all the procedures and a short description of purpose for each.

A more complex example is shown when the procedure filter-filter-region-thru-command is called when the Flow item is selected. In this case the procedure calls the filter flowtogether. Flowtogether is a simple filter which combines lines together to remove excess whitespace and create data in paragraphs. I use this filter in messages when I want to quote part of some mail and make it nicer looking.

Most of the menus you see in the Linux distribution were added using addmenu in the various initialization files. You can add your own menu cards by adding addmenu commands in your private initialization files. More details on adding menu cards can be found with the command auishelp initfiles.

Filetypes

If I issue the command ez test.d, the data in this file will be an AUIS text document, but if I edit the file test.document, it will be just simply ASCII data. The difference obviously has something to do with the extension of the file. Linux, like all conventional Unix systems, really has no innate “knowledge” of what is in a file, but we all have expectations for what's in the file test.c. It's just a matter of convention. AUIS has its own conventions and these are controlled in the file /usr/andrew/lib/global.filetypes which has entries like these:

addfiletype .Xdefaults     rawtext   "template=rawtext"
addfiletype .c          ctext     "template=c"
addfiletype .h          ctext     "template=h"
addfiletype .d          text      "template=default"
addfiletype .doc        text      "template=default"
addfiletype .help       text      "template=help"

Addfiletype commands allow you to map extensions to inset types so that new documents you create with a certain extension will get the proper inset type specified by the “template=” keyword.

Editing .Xdefaults will have the template rawtext (which will insure that copying an AUIS datastream results in a simple ASCII string and not some bold text) and editing .Xdefaults.old results in the default template (which allows you to copy and retain bold text) which is probably not what you want. The current AUIS distribution does not allow you to use wildcards in addfiletype commands, so you must explicitly map .Xdefaults and .Xdefaults.old individually. More details on filetypes can be found with the command auishelp initfiles.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix