TMovementOfUser = object
private
...
procedure setTypeMovement(appvalue: string);
...
public
...
function getTypeMovement: string;
...
end;
TMovementOfUser = object
private
...
procedure setTypeMovement(appvalue: string);
function getTypeMovement: string;
...
public
property TypeMovement: string read getTypeMovement write setTypeMovement;
end;
property TypeMovement: string read FTypeMovement write FTypeMovement;
last --time-format iso username
TMovementOfUser = object
Infatti.Quello lo so, stò solo cercando un modo con last che mi restituisca la data in formato numerico e non testuale.
Ti dice che gli stai passando fiori quando vuole patate.
last username
cosa ti restituisce?
Stilgar
Perchè object e non una classe?CitazioneTMovementOfUser = object[/quote
Comodità
ComoditàOvvero?
Inoltre non potete cambiare il formato della data dell'output. Non esiste un parametro al commando Last per far questo. http://linux.about.com/library/cmd/blcmdl1_last.htm (http://linux.about.com/library/cmd/blcmdl1_last.htm)CitazioneComoditàOvvero?
già provato ma il risultato è
last --time-format iso
last: invalid option -- '-'
Usage: last [-num | -n num] [-f file] [-t YYYYMMDDHHMMSS] [-R] [-adioxFw] [username..] [tty..]
PS:
Linux è open source ... e i comandi gnu altrettanto ... butto lì l'idea del porting dell'api da zero ;)
type
TUtmp = packed record
ut_type: short; (* Type of record *)
ut_pid: pid_t; (* PID of login process *)
ut_line: array [0..UT_LINESIZE - 1] of char; (* Device name of tty - "/dev/" *)
ut_id: array [0..4 - 1] of char; (* Terminal name suffix,
or inittab(5) ID *)
ut_user: array [0..UT_NAMESIZE - 1] of char; (* Username *)
ut_host: array [0..UT_HOSTSIZE] of char; (* Hostname for remote login, or
kernel version for run-level
messages *)
ut_exit: exit_status; (* Exit status of a process
marked as DEAD_PROCESS; not
used by Linux init( *)
(* The ut_session and ut_tv fields must be the same size when
compiled 32- and 64-bit. This allows data files and shared
memory to be shared between 32- and 64-bit applications. *)
{$if __WORDSIZE == 64 and defined __WORDSIZE_COMPAT32}
ut_session: int32_t; (* Session ID (getsid(2)),
used for windowing *)
ut_tv: record
tv_sec: int32_t; (* Seconds *)
tv_usec: int32_t; (* Microseconds *)
end; (* Time entry was made *)
{$else}
ut_session: long; (* Session ID *)
ut_tv: timeval; (* Time entry was made *)
{$endif}
ut_addr_v6: array[0..3 - 1] of int32_t; (* Internet address of remote
host; IPv4 address uses
just ut_addr_v6[0] *)
__unused: array [0..20 - 1] of char; (* Reserved for future use *)
end;
Program testu;
uses utmp,unixutil;
Const UTMPFile = '/var/run/utmp';
var
EndOfUsers : Boolean;
m,d,y,hh,mm,ss : Word;
begin
Set_utmp_file(UTMPFile);
Writeln ('Number of utmp entries : ',number_of_utmp_entries);
set_search_parameters (Include ,All_login_types);
Read_logged_users;
Writeln ('Number of logged users : ',Number_Of_logged_users);
While More_USers do
With Get_Next_user do
begin
Writeln ('Logtype : ',login_type_names[type_of_login]);
Writeln ('Pid : ',Pid);
Writeln ('Device : ',Device);
Writeln ('TTYname : ',TTy_Name);
EpochToLocal(login_time,y,m,d,hh,mm,ss);
Writeln ('Login Time : ',y,'/',m,'/',d,' ',hh,':',mm,':',ss);
Writeln ('User Name : ',user_name);
Writeln ('Host name : ',host_name);
Write ('IP address : ',Ip_address[1],'.',Ip_address[2]);
Writeln ('.',ip_address[3],'.',ip_address[4]);
end;
end.
BINGO:Codice: [Seleziona]Program testu;
uses utmp,unixutil;
Const UTMPFile = '/var/run/utmp';
var
EndOfUsers : Boolean;
m,d,y,hh,mm,ss : Word;
begin
Set_utmp_file(UTMPFile);
Writeln ('Number of utmp entries : ',number_of_utmp_entries);
set_search_parameters (Include ,All_login_types);
Read_logged_users;
Writeln ('Number of logged users : ',Number_Of_logged_users);
While More_USers do
With Get_Next_user do
begin
Writeln ('Logtype : ',login_type_names[type_of_login]);
Writeln ('Pid : ',Pid);
Writeln ('Device : ',Device);
Writeln ('TTYname : ',TTy_Name);
EpochToLocal(login_time,y,m,d,hh,mm,ss);
Writeln ('Login Time : ',y,'/',m,'/',d,' ',hh,':',mm,':',ss);
Writeln ('User Name : ',user_name);
Writeln ('Host name : ',host_name);
Write ('IP address : ',Ip_address[1],'.',Ip_address[2]);
Writeln ('.',ip_address[3],'.',ip_address[4]);
end;
end.
va bene xinyman?
Abbastanza "poco testo"?
Stilgar
francesco@netbook-mint ~/Documenti/Lazarus/test2utmp $ sudo ./project1
[sudo] password for francesco:
Number of utmp entries : 10
Number of logged users : 2
Logtype : Boot time
Pid : 0
Device :
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
Logtype : Run level
Pid : 0
Device :
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
Logtype : Login process
Pid : 0
Device : ty4
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
Logtype : Login process
Pid : 0
Device : ty5
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
Logtype : Login process
Pid : 0
Device : ty2
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
Logtype : Login process
Pid : 0
Device : ty3
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
Logtype : Login process
Pid : 0
Device : ty6
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
Logtype : Login process
Pid : 0
Device : ty1
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
Logtype : User process
Pid : 0
Device : ty8
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
Logtype : User process
Pid : 0
Device : ts/2
TTYname :
Login Time : 1970/1/1 2:0:0
User Name :
Host name :
IP address : 0.0.0.0
EpochToLocal(login_time,y,m,d,hh,mm,ss); Writeln ('Login Time : ',y,'/',m,'/',d,' ',hh,':',mm,':',ss);
già provato ma il risultato è
last --time-format iso
last: invalid option -- '-'
Usage: last [-num | -n num] [-f file] [-t YYYYMMDDHHMMSS] [-R] [-adioxFw] [username..] [tty..]
prima di consigliartelo l'ho provato...
man last
ti da qualche aiuto?
in alternativa puoi usare -t
mi sa tanto che tocca fare un approccio alla Stilgar, ovvero:Lo credo pure io, ma non ho voglia di farmi uno sbattone, ora vedo che fare...
vedere cosa fanno i sorgenti di passwd