* Re: gnat and user
[not found] <01bebdae$bd385f60$1511a8c0@fermion.extern.uni-ulm.de>
@ 1999-06-23 0:00 ` jerry
0 siblings, 0 replies; only message in thread
From: jerry @ 1999-06-23 0:00 UTC (permalink / raw)
argavargf <hallo@hallo.org> wrote:
: is there a package for gnat (linux) including a procedure or function which
: returns the user name?
Florist (the POSIX binding) should include this. Meanwhile, you can do
this yourself by calling the appropriate C library function, like:
-- display the name of the user logged in
with Ada.Text_IO; use Ada.Text_IO;
with Interfaces.C.Strings; use Interfaces.C.Strings;
procedure Display_Me is
function User_Name return String is
function Getlogin return chars_ptr;
pragma Import (C, Getlogin, "getlogin");
Name : chars_ptr;
begin
Name := Getlogin;
if Name = Null_Ptr then
return "";
else
return Value (Name);
end if;
end User_Name;
begin
Put_Line (User_Name);
end Display_Me;
But check the difference between getlogin and cuserid to make sure you
get the name you actually need.
--
-- Jerry van Dijk | Leiden, Holland
-- Team Ada | jdijk@acm.org
-- see http://stad.dsl.nl/~jvandyk
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-06-23 0:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <01bebdae$bd385f60$1511a8c0@fermion.extern.uni-ulm.de>
1999-06-23 0:00 ` gnat and user jerry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox