text
stringlengths
0
234
for I in 1 .. Argument_Count loop
if Argument (I) (1) = '-' then
if Last_Option = I then
null; -- Argument for a previous option
else
Last_Option := I;
if Argument (I)'Length = 1 then
Help;
return;
end if;
for J in 2 .. Argument (I)'Last loop
case Argument (I) (J) is
when 'D' =>
Add_Directories := False;
when 'r' =>
Recursive := True;
when '0' =>
Compression_Method := DCF.Zip.Compress.Store;
when '1' =>
Compression_Method := DCF.Zip.Compress.Deflate_1;
when '9' =>
Compression_Method := DCF.Zip.Compress.Deflate_3;
when 'q' =>
Quiet := True;
when 'j' =>
Junk_Directories := True;
when 'z' =>
if I = Argument_Count then
Help;
return;
end if;
Comment := SU.To_Unbounded_String (Argument (I + 1));
Last_Option := I + 1;
when others =>
Help;
return;
end case;
end loop;
end if;
end if;
end loop;
if Argument_Count = Last_Option then
Help;
return;
end if;
declare
Archive : constant String := Argument (Last_Option + 1);
begin
if Dirs.Exists (Archive) then
Put_Line ("Archive file '" & Archive & "' already exists");
return;
end if;
if not Quiet then
Put_Line ("Archive: " & Archive);
end if;
declare
Archive_Stream : aliased DCF.Streams.File_Zipstream
:= DCF.Streams.Create (Archive);
Info : DCF.Zip.Create.Zip_Create_Info;
procedure Add_File (Path : String) is
Name : constant String := Maybe_Trash_Dir (Path);
begin
if not Dirs.Exists (Path) then
Put_Line ("warning: " & Name & " does not exist");
return;
end if;
declare
use all type Dirs.File_Kind;
File_Is_Directory : constant Boolean := Dirs.Kind (Path) = Directory;
begin
if not File_Is_Directory then
if not Quiet then
Put_Line (" adding: " & Name);
end if;
declare
File_Stream : aliased DCF.Streams.File_Zipstream
:= DCF.Streams.Open (Path);
begin
DCF.Streams.Set_Name (File_Stream, Name);
DCF.Streams.Set_Time (File_Stream,
DCF.Streams.Calendar.Convert (Dirs.Modification_Time (Path)));
DCF.Zip.Create.Add_Stream (Info, File_Stream);
Function Definition: function Convert is new Ada.Unchecked_Conversion
Function Body: (System.Address,
Float_Star);
function Convert is new Ada.Unchecked_Conversion