* SUMMARY : getting finger style information
@ 2000-07-05 14:31 Hasan Atasoy
0 siblings, 0 replies; only message in thread
From: Hasan Atasoy @ 2000-07-05 14:31 UTC (permalink / raw)
To: tru64-unix-managers
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="--------------InterScan_NT_MIME_Boundary", Size: 2027 bytes --]
This is a multipart message in MIME format
--------------InterScan_NT_MIME_Boundary
Content-Type: text/plain; charset=iso-8859-9
Content-Transfer-Encoding: 7bit
****** Message from InterScan E-Mail VirusWall NT ******
** No virus found in attached file noname.htm
Bu mailin virus taramasi test programi ile yapilmistir.
***************** End of message ***************
--------------InterScan_NT_MIME_Boundary
Content-Type: text/plain;
charset="iso-8859-9"
Content-Transfer-Encoding: quoted-printable
answer is from Bob Vickers /* thanks a lot for the c code that is =FD =
want
hundred percentage */
#include <time.h>
#include <lastlog.h>
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#define MAXUID 65535
#define MAXSHELL 20
#define USLENGTH 10
#define LASTLOG_FILE "/var/adm/lastlog"
main(int argc, char *argv[])
{
=09
time_t logtime;
struct lastlog llrec;
struct passwd *pw;
uid_t uid;
FILE *llfile;
=09
struct userinfo {
char name[USLENGTH+1];
char shell[MAXSHELL+1];
};
struct userinfo ui[MAXUID];
=09
setpwent();
=09
while (pw=3Dgetpwent()) {
uid=3Dpw->pw_uid;
if (uid >=3D MAXUID ) {
fprintf(stderr, "lastlog: MAXUID=3D%d is too small",
MAXUID);
sprintf(ui[uid].name, "%ld", (long)uid );
}
else strncpy(ui[uid].name, pw->pw_name, USLENGTH);
strncpy( ui[uid].shell, pw->pw_shell, MAXSHELL);
}
=09
=09
llfile=3Dfopen(LASTLOG_FILE, "rb");
for (uid=3D0;;uid++) {
if (fread(&llrec, sizeof llrec, 1, llfile) !=3D 1) break;
if (ui[uid].name[0] =3D=3D NULL) continue; /* unassigned UID
*/
logtime=3Dllrec.ll_time;
printf("%-10.10s %-19s%11ld ", ui[uid].name, ui[uid].shell,
logtime); =20
if (logtime =3D=3D 0 )
printf("never logged on\n");
else
printf("%s", ctime(&logtime));
}
}
Hasan Atasoy=20
Unix System Admin.
Ihlas Finans Kurumu
Sistem =DDleti=FEim M=FCd=FCrl=FCg=FC
29 Ekim C. No:23 34530=20
Y.bosna/Istanbul-Turkey
++90.212.454 1362 tel. =20
* hatasoy@ifk.com.tr
--------------InterScan_NT_MIME_Boundary--
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-07-05 14:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-07-05 14:31 SUMMARY : getting finger style information Hasan Atasoy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox