All pastes #931549 Raw Edit

Someone

public text v1 · immutable
·published 2008-03-07 08:07 UTC
rendered paste body
with Ada.Strings; use Ada.Strings;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO;
with Ada.Command_line; use Ada.Command_Line;
with Ada.Characters.Handling; use Ada.Characters.Handling;

   function Create_Record return Boolean is

        type Allowed_Params is array(1..4) of String(1..2);

        AP_Array        :   Allowed_Params := ("-H","-F","-L","-O");

        Found           :   Boolean := FALSE;

    begin

        for i in 1..Argument_Count loop

            for j in AP_Array'Range loop

                if To_Upper(Argument(i)) = AP_Array(j) then

                    Found := TRUE;

                end if;

            end loop;

            if Found then

                Put_Line(Argument(i) & " is allowed.");
                
                -- Do stuff based on what parameter we've found

                Found := FALSE;

            else

                Put_Line(Argument(i) & " is not allowed");

                -- Do something with the unknown parameter we've found

            end if;

        end loop;
        
        -- just for testing
        return TRUE;

    end Create_Record;