/* Read gnu finger userdata file */ /* sioan 1996*/ # include # include # include # include #include "packet.h" main (argc, argv) char *argv[]; int argc; { FILE *u ; FINGER_PACKET packet; char j=0; char time[50]; char tmp[50]; if (argc <2) {fprintf(stderr,"Usage: %s fingerdbasefile (/usr/gnu/etc/fingerdir/userdata)\n",argv[0]);exit(1);}; if (!(u = fopen (argv[1], "r"))) { perror (argv[1]); exit (1); } do { if ((read (fileno(u), &packet, sizeof (packet)) == sizeof (packet)) <1) j=2; printf (" %s %s %s %s %s %s %s", packet.name, packet.real_name, packet.host, packet.ttyname, packet.ttyloc, packet.what, ctime (&packet.login_time)); } while ((strcmp(packet.name,argv[2])) && j!=2); if (!strcmp(packet.name,argv[2])){ printf("%-10s",packet.name); strncpy(time,ctime (&packet.login_time),strlen(ctime (&packet.login_time))-1); time[strlen(ctime (&packet.login_time))-1]='\0'; printf ("%-20s", time ); } if (j==2) printf("%-30s Not Found",argv[2]); }