File : a-comlin-raven-cert.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . C O M M A N D _ L I N E --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
21 -- --
22 -- --
23 -- --
24 -- --
25 -- --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
30 -- --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
33 -- --
34 ------------------------------------------------------------------------------
35
36 -- RCI custom version
37
38 package Ada.Command_Line is
39 pragma Preelaborate;
40
41 function Command_Name return String;
42 -- If the external execution environment supports passing arguments to
43 -- a program, then Command_Name returns an implementation-defined value
44 -- corresponding to the name of the command invoking the program.
45 -- Otherwise Command_Name returns the null string.
46 --
47 -- in GNAT: Corresponds to argv [0] in C.
48
49 -- type Exit_Status is new Integer;
50
51 -- Success : constant Exit_Status;
52 -- Failure : constant Exit_Status;
53
54 -- procedure Set_Exit_Status (Code : Exit_Status);
55
56 ------------------------------------
57 -- Note on Interface Requirements --
58 ------------------------------------
59
60 -- Services in this package are not supported during the elaboration of an
61 -- auto-initialized Stand-Alone Library.
62
63 -- If the main program is in Ada, this package works as specified without
64 -- any other work than the normal steps of WITH'ing the package and then
65 -- calling the desired routines.
66
67 -- If the main program is not in Ada, then the information must be made
68 -- available for this package to work correctly. In particular, it is
69 -- required that the global variable "gnat_argc" contain the number of
70 -- arguments, and that the global variable "gnat_argv" points to an
71 -- array of null-terminated strings, the first entry being the command
72 -- name, and the remaining entries being the command arguments.
73
74 -- These correspond to the normal argc/argv variables passed to a C
75 -- main program, and the following is an example of a complete C main
76 -- program that stores the required information:
77
78 -- main(int argc, char **argv, char **envp)
79 -- {
80 -- extern int gnat_argc;
81 -- extern char **gnat_argv;
82 -- extern char **gnat_envp;
83 -- gnat_argc = argc;
84 -- gnat_argv = argv;
85 -- gnat_envp = envp;
86
87 -- adainit();
88 -- adamain();
89 -- adafinal();
90 -- }
91
92 -- The assignment statements ensure that the necessary information is
93 -- available for finding the command name and command line arguments.
94
95 end Ada.Command_Line;