text
stringlengths
0
234
begin
null;
if N >= 10 then
Image_Natural (N / 10, S, L);
L := L + 1;
S (L) := Character'Val (48 + (N rem 10));
else
L := L + 1;
S (L) := Character'Val (48 + (N rem 10));
end if;
end Image_Natural;
begin
null;
Image_Natural (N, S, L);
return S (1 .. L);
end Image;
function Create_Display_Number return String is
use Ada.Directories;
New_Number : Natural := 0;
begin
if Exists ("/tmp") then
loop
if Exists ("/tmp/.X" & Image (New_Number) & "-lock") then
New_Number := New_Number + 1;
else
return Image (New_Number);
end if;
end loop;
else
return "0";
end if;
end Create_Display_Number;
-- Using GNAT.Directory_Operations, make given filesystem path compatible
-- with the current Operating System: Path ("to/file") => "to\file"(windows)
function Path (Original : String) return String is
use Os_Files;
Result : Path_Name :=
Os_Files.Format_Pathname
(Path => Path_Name (Original),
Style => System_Default);
begin
return String (Result);
end Path;
-- Using GNAT.Directory_Operations, make given filesystem path compatible
-- with the current Operating System:
-- Path ("${HOME}/to/file") => "C:\msys\home\user\to\file" (windows)
function Expand_Path (Original : String) return String is
use Os_Files;
Result : Path_Name :=
Os_Files.Format_Pathname
(Path =>
Os_Files.Expand_Path (Path => Path_Name (Original), Mode => Both),
Style => System_Default);
begin
return String (Result);
end Expand_Path;
-- Using GNAT.Directory_Operations and GNAT.OS_LIB, make given filesystem
-- path compatible with the current Operating System, returning the full
-- path: Full_Path ("../to/file") => "C:\dir\dir\to\file" (windows)
function Full_Path (Original : String) return String is
use Os;
begin
return Os.Normalize_Pathname (Path (Original));
end Full_Path;
User_Clientrc : String := Expand_Path ("${HOME}/.xinitrc");
System_Clientrc : String := Path ("/etc/X11/xinit/xinitrc");
User_Serverrc : String := Expand_Path ("${HOME}/.xserverrc");
System_Serverrc : String := Path ("/etc/X11/xinit/xserverrc");
Default_Client : String := "xterm";
Default_Server : String := Path ("/usr/bin/X");
Default_Client_Arguments_Access : Os.String_List_Access :=
Os.Argument_String_To_List ("");
Default_Server_Arguments_Access : Os.String_List_Access :=
Os.Argument_String_To_List ("");
Default_Client_Arguments : Os.String_List :=
(if
Default_Client_Arguments_Access /= null
then
Default_Client_Arguments_Access.all
else Empty_List_Access.all);
Default_Server_Arguments : Os.String_List :=
(if
Default_Server_Arguments_Access /= null
then