22 struct calllog calllog;
23 struct calllog listing[20];
28 for (a=0; a<20; ++a) {
29 listing[a].CLfullname[0]=0;
35 if (aa<0L) aa=CALLLOG;
36 lseek(file,(aa*sizeof(struct calllog)),0);
37 a=read(file,(char *)&calllog,sizeof(struct calllog));
38 if (calllog.CLflags==CL_LOGIN) {
39 strcpy(listing[count].CLfullname,calllog.CLfullname);
40 listing[count].CLtime=calllog.CLtime;
41 listing[count].CLflags=calllog.CLflags;
47 for (a=19; a>=0; --a) {
48 tm=(struct tm *)localtime(&listing[a].CLtime);
49 tstring=(char *)asctime(tm);
50 printf("%30s %s",listing[a].CLfullname,tstring);
57 struct calllog calllog;
64 file=open("calllog.pos",O_RDONLY);
65 a=read(file,(char *)&pos,sizeof(int));
68 file=open("calllog",O_RDONLY);
70 if (!strcmp(argv[1],"-t")) last20(file,(long)pos);
71 else fprintf(stderr,"%s: usage: %s [-t]\n",argv[0],argv[0]);
76 lseek(file,(long)(pos*sizeof(struct calllog)),0);
77 for (a=0; a<CALLLOG; ++a) {
78 if ((a+pos)==CALLLOG) lseek(file,0L,0);
79 b=read(file,(char *)&calllog,sizeof(struct calllog));
80 if (calllog.CLflags!=0) {
82 if (calllog.CLflags&CL_CONNECT) strcpy(aaa,"Connect");
83 if (calllog.CLflags&CL_LOGIN) strcpy(aaa,"Login");
84 if (calllog.CLflags&CL_NEWUSER) strcpy(aaa,"New User");
85 if (calllog.CLflags&CL_BADPW) strcpy(aaa,"Bad PW Attempt");
86 if (calllog.CLflags&CL_TERMINATE) strcpy(aaa,"Terminate");
87 if (calllog.CLflags&CL_DROPCARR) strcpy(aaa,"Dropped Carrier");
88 if (calllog.CLflags&CL_SLEEPING) strcpy(aaa,"Sleeping");
89 if (calllog.CLflags&CL_PWCHANGE) strcpy(aaa,"Changed Passwd");
90 tm=(struct tm *)localtime(&calllog.CLtime);
91 tstring=(char *)asctime(tm);
92 printf("%30s %20s %s",calllog.CLfullname,aaa,tstring);