■
コメントいただいたUnrestricted_Access試したー
with GNAT.AWK; with Ada.Text_Io; with Ada.Command_Line; procedure Get_Shell is Computers : GNAT.AWK.Session_Type; procedure Dump_Shell is begin Ada.Text_Io.Put_Line( GNAT.AWK.Field(7,Computers) ); end Dump_Shell; begin if Ada.Command_Line.Argument_Count < 1 then Ada.Text_Io.Put_Line("usage: get_shell name"); else declare User_Name : String := Ada.Command_Line.Argument(1); begin GNAT.AWK.Set_Field_Separators(":",Computers); GNAT.AWK.Add_File("/etc/passwd",Computers); GNAT.AWK.Register(1, User_Name ,Dump_Shell'Unrestricted_Access,Computers); GNAT.AWK.Parse( Session => Computers ); end; end if; end;
おー。無事動きましたー。しかしどういう実装になってるんですかなー。ていうか、GNAT.AWKがコールバックにデータ渡してくれないのがどうかしてると思うがー。