xref: /386bsd/usr/local/man/man1/elmalias.1 (revision a2142627)
. ds ct " .\} . ds ct \\(co .\}
ELMALIAS 1L "Elm Version 2.4" "USENET Community Trust"
NAME
elmalias - expand and display Elm address aliases
SYNOPSIS
elmalias [ -adenrsuvV ] [ -f format ] [ name ... ] $lib/prlong [ options ... ] < \f2file
DESCRIPTION
Elmalias allows you to examine information about aliases. The alias databases are consulted for each name on the command line, and the alias value is displayed, one value per line of output. If name is not a known alias, then it is displayed unchanged. If no name is given on the command line then all alias values in the databases are displayed. All of these actions are default behaviors that may be modified by command line options.

There are two possible alias databases, a user-specific alias file (usually in $HOME/.elm/aliases ) and a system-wide alias file (usually in $lib/aliases ). By default both files are searched, first the user-specific file and then the system-wide file. If an alias file does not exist then elmalias silently ignores it and continues on. The -s and -u command line options (discussed shortly) can restrict what files are files searched.

There are two types of aliases, Person aliases and Group aliases. A Person alias expands to an individual address and a Group alias contains a list of addresses, some of which may be aliases. By default, elmalias displays the defined value of an alias, regardless of type. The -e command line option (discussed shortly) fully expands out Group aliases.

The default output produced is just the ``Address'' information for each name on the command line. A number of command line options (discussed shortly) may be used to select different output information or specify a format of your choosing. The following information is maintained in the alias databases, and may be accessed by the elmalias utility:


 \(bu Alias (the alias name)
 \(bu Last Name
 \(bu Name (the user's full name)
 \(bu Comment (not displayed in mail headers)
 \(bu Address (the alias value)
 \(bu Type (Person, Group, or Unknown)

When the name specified on the command line is not a known alias, both the ``Alias'' and ``Address'' information will display as the name , the ``Type'' information will display as ``Unknown'', and all other items will be blank.

The available command line options are:




-a
Selects an alternative output format. The ``Alias'' information is displayed in addition to and preceding the usual ``Address'' information.


-d
Turns debugging on. Has no effect unless elmalias was compiled with debugging enabled.


-e
Tells elmalias to fully expand group aliases. This option can be used only when name s are given on the command line.


-f
The output produced will be in the specified format . Format specifications will be discussed shortly.


-n
Selects an alternative output format. The ``Name'' information, if it exists, is displayed in addition to and following the usual ``Address'' information. The ``Name'' will be enclosed in parenthesis.


-r
If a specified name does not correspond to a known alias then elmalias will display a message and exit with a nonzero status.


-s
Normally elmalias examines both the user-specific and system-wide alias files. This option requests that elmalias use the system-wide alias file, and unless the -u option is also specified the user-specific alias file will be ignored.


-u
Normally elmalias examines both the user-specific and system-wide alias files. This option requests that elmalias use the user-specific alias file, and unless the -s option is also specified the system-wide alias file will be ignored.





-v
Selects a verbose output format. Both the ``Alias'' and the ``Name'' information will be displayed in addition to the ``Address'' information. The ``Alias'' information will precede the ``Address'' information, and the ``Name'' information will be enclosed in parenthesis and follow it. If there is no ``Name'' information for this alias then that portion of the output will be ignored.


-V
Selects a very verbose, multi-line output format. Displays all available information on aliases.


The output produced by elmalias is fully customizable with the -f option. The format string uses a syntax similar to date(1) (System V version) and printf(3) . The following field descriptors may be used in format specifications:


 %a Alias (the alias name)
 %l Last Name
 %n Name (the user's full name)
 %c Comment (not displayed in mail headers)
 %v Address (the alias value)
 %t Type (Person, Group, or Unknown)

Field widths in a [-][m][.n] format (again, similar to printf(3) ) may also be used. For example, "%-20.20a" means print the ``Alias'' information left justified in a field twenty characters long, with the value truncated to twenty characters.

The following special character sequences are also recognized in format specifications:


 \\b A backspace.
 \\f A formfeed.
 \\n A newline.
 \\r A return.
 \\t A tab.
 \\c Literal character ``c''.

There is a very simplistic conditional evaluation mechanism that may be used in format specifications. The conditional text should be surrounded by question marks, and a single character that specifies the condition immediately follows the first question mark. The condition characters correspond to the ``%'' field specifier characters, and the condition is true if the corresponding alias information is defined and nonempty. For example, if you want to display the ``Name'' information surrounded by parenthesis, but omit it if the information is not available, you may use ``?n(%n)?'' in the format specification.

The command line switches that select an alternative format correspond to the following format specifiers.


 default "%v"
 -a "%-20.20a %v"
 -n "%v?n (%n)?"
 -v "%-20.20a %v?n (%n)?"
 -V "Alias:\\t\\t%a\\n\\
 Address:\\t%v\\n\\
 Type:\\t\\t%t\\n\\
 ?n Name:\\t\\t%n\\n?\\
 ?l Last Name:\\t%l\\n?\\
 ?c Comment:\\t%c\\n?"




The prlong utility formats long amounts of data, folding across multiple lines. It is useful to reformat output of elmalias . Prlong reads data from its standard input, one line at a time, and tries to place as much information as possible on each output line. A field seperator, by default a single space, seperates each input record in the output lines. Every output line is preceded by a leader field. By default the leader of the first output line is an empty string, and the leader for all subsequent output lines is a single tab. prlong will never split an input record. If an input record exceeds the maximum output line length, it will appear unmodified on an output line all by itself.

The following options may be used to modify the prlong behavior.

"-w width" 12
Constrains output lines to width columns in length (not counting an appended newline character). The default is 78 columns. The width calculation assumes that tabstops occur every eight spaces.
"-f string" 12
Seperates each input record with the indicated string when displayed to the output. The default is a single space.
"-1 string" 12
Specifies the leader string used for the first line of output. (This option is the digit ``one''.) The default is an empty string.
"-l string" 12
Specifies the leader string for all subsequent lines of output. (This option is a lower-case ``ell''.) The default is a single tab.
EXAMPLES

Consider an aliases.text file that contains:


 friends = List of Friends = tom, dick, harry
 tom = Tom Smith = sleepy!tom
 dick = Dick Jones = dopey!dick
 harry = = grumpy!harry

Below are shown some example commands and the output produced.

 $ elmalias friends
 tom,dick,harry
 $ elmalias mike
 mike
 $ elmalias -r mike
 elmalias: "mike" is not a known alias
 $ elmalias -n friends
 tom,dick,harry (List of Friends)
 $ elmalias -a friends
 friends tom,dick,harry
 $ elmalias -V friends
 Alias: friends
 Address: tom,dick,harry
 Type: Group
 Name: List of Friends
 Last Name: List of Friends
 $ elmalias -e friends
 tom@sleepy.acme.com
 dick@dopey.acme.com
 harry@grumpy.acme.com
 $ elmalias -ve friends
 tom tom@sleepy.acme.com (Tom Smith)
 dick dick@dopey.acme.com (Dick Jones)
 harry harry@grumpy.acme.com
 $ elmalias -f "alias %a is \\"%v\\" ?n(%n)?" -e friends
 alias tom is "tom@sleepy.acme.com" (Tom Smith)
 alias dick is "dick@dopey.acme.com" (Dick Jones)
 alias harry is "harry@grumpy.acme.com" 
 $ elmalias -en friends | /usr/lib/elm/prlong -w40
 tom@sleepy.acme.com (Tom Smith) 
 dick@dopey.acme.com (Dick Jones) 
 harry@grumpy.acme.com
 $ elmalias -en friends | /usr/lib/elm/prlong -1 "To: " -f ", " -w40
 To: tom@sleepy.acme.com (Tom Smith), 
 dick@dopey.acme.com (Dick Jones), 
 harry@grumpy.acme.com

The checkalias (1L) and listalias (1L) scripts distributed with the Elm package provide further examples of the elmalias and prlong utilities.

AUTHOR
Elm Development Group
SEE ALSO
checkalias(1L), elm(1L), listalias(1L), newalias(1L)
BUGS
There is no centralized, comprehensive interface to the Elm 2.4 alias system, so every program in the Elm suite that uses aliases implements its own interfaces. It's possible for inconsistencies to creep in between what elmalias says and what some Elm utility does. If you find an inconsistency please report it to us!

Boy, there sure are a lot of command line switches in this thing.

Note that the precedence of aliases is user file then system file. This means that a user can 'overload' an alias by having one defined in the system file also defined in theirs. This shouldn't turn out to be a problem, but is something for the system administrator to keep in mind when creating the system alias file.

BUG REPORTS TO
Syd Weinstein elm@DSI.COM (dsinc!elm)
COPYRIGHTS
\*(ctCopyright 1993 by The USENET Community Trust