Programación en Ada/Unidades predefinidas/Ada.Command Line
Apariencia
Ada.Command_Line es un paquete predefinido para la consulta de la línea de comandos para los sistemas operativos que lo soportan, que son la mayoría. También permite establecer el código de error de terminación del programa.
Ejemplo
[editar]withAda.Text_IO;withAda.Command_Line;useAda.Command_Line;-- Imprime los argumentos pasados por línea de comandosprocedureImprimir_ArgumentosisbeginAda.Text_IO.Put_Line ("Imprimiendo argumentos pasados a "& Command_Name & '.');forIin1 .. Argument_CountloopAda.Text_IO.Put_Line ("Argumento nº"& Integer'Image (I) &": "& Argument (I));endloop; Set_Exit_Status (Success);exceptionwhenothers=> Set_Exit_Status (Failure);endImprimir_Argumentos;
Especificación
[editar]Según el manual de referencia de Ada (el estándar), la especificación de este paquete ha de ser la siguiente:
packageAda.Command_LineispragmaPreelaborate(Command_Line);functionArgument_CountreturnNatural;functionArgument (Number :inPositive)returnString;functionCommand_NamereturnString;typeExit_Statusisimplementation-defined integer type; Success :constantExit_Status; Failure :constantExit_Status;procedureSet_Exit_Status (Code :inExit_Status);private...-- not specified by the languageendAda.Command_Line;