8.3.1 Command line handling.
You will have noticed that in Ada the concept of main() as a special entity does not exist. In Ada the start point of an application is whatever you tell the binder/linker it is. This main subprogram is usually a parameterless procedure, so where is argc and argv? The answer is that you get your parameters from a library package.
Library specification - package Ada.Command_Line.
As you can see you not only get your start-up parameters but also you can also set your exit status, the equivalent of C's exit() function.
The following example shows how to use the command line facilities, it simply writes out the name of the program and its arguments. Before completion it sets the exit status to Success to indicate that nothing untoward happened.
The following is an extract from create_database.adb which is a utility to populate the database files with example records. The resulting program can be used to create any individual file or all files depending on the boolean variables declared at the top.
Each command line argument is read and converted to lower case so that a case insensitive comparison can take place.
Copyright ©
1996 Simon Johnston &
Addison Wesley Longman