Running gnatname (GNAT User’s Guide for Native Platforms)

#### 3.3.4.2 Running `gnatname` ¶

The usual form of the `gnatname` command is:

    $ gnatname [ switches ]  naming_pattern  [ naming_patterns ]
        [--and [ switches ]  naming_pattern  [ naming_patterns ]]

All of the arguments are optional. If invoked without any arguments, `gnatname` will display its usage.

When used with at least one naming pattern, `gnatname` attempts to find all the compilation units in files that follow at least one of the naming patterns. To find these compilation units, `gnatname` uses the GNAT compiler in syntax-check-only mode on all regular files.

One or several ‘Naming Patterns’ may be given as arguments to `gnatname`. Each Naming Pattern is enclosed between double quotes (or single quotes on Windows). A Naming Pattern is a regular expression similar to the wildcard patterns used in file names by the Unix shells or the DOS prompt.

You may call `gnatname` with several sections of directories/patterns. Sections are separated by the switch `--and`. In each section, you must include at least one pattern. If you don’t specify a directory a section, the current directory (or the project directory if `-P` is used) is used. The options other that the directory switches and the patterns apply globally even if they are in different sections.

Examples of Naming Patterns are:

    "*.[12].ada"
    "*.ad[sb]*"
    "body_*"    "spec_*"

For a more complete description of the syntax of Naming Patterns, see the second kind of regular expressions described in `g-regexp.ads` (the ‘Glob’ regular expressions).

When invoked without the switch `-P`, `gnatname` will create a configuration pragmas file `gnat.adc` in the current working directory, with pragmas `Source_File_Name` for each file that contains a valid Ada unit.