A magic file contains an ordered set of file-typing rules, which ClearCase and ClearCase LT use to determine a list of file types for an existing file system object or for one that is about to be created.
On UNIX and Linux systems, file-typing is performed in the following situations:
When you create a new element with mkelem, but do not specify an element type (with –eltype), the element's name is file typed. (If you are converting a view-private file to an element with mkelem –ci or mkelem –nco, the file's contents are also used in the file-typing.) The resulting file type list is compared with the VOB's set of element types (which includes both element types in the VOB and element types in the administrative VOB hierarchy associated with the VOB). The first file type that matches an element type is chosen as the element type; if no file type matches any existing element type, an error occurs.
The file browsers have a graphical mode, in which each file system object is displayed as an icon. The icon is selected first by file-typing the object, and then using one of its file types to select a bitmap from the ones listed in an icon file. (See the cc.icon reference page.)
If MAGIC_PATH is not set, this default search path is used:
(UNIX and Linux) home-directory/.magic:${ccase-home-dir:–/opt/rational
/clearcase}/config/magic
(Windows) home-directory\.magic;ccase-home-dir\config\magic
Examples
Assign the file types source_file and text_file to files whose file name extension is .c or .h.
source_file text_file : -name "*.c" | -name "*.h" ;
Assign the file types cplspls_source and text_file to printable files whose file name extension is .cxx or .c++.
cplspls_source text_file : -printable & (-name "*.cxx" | -name "*.c++") ;