#include <stdio.h>
#include <string.h>
#include <acrdef.h>

main()
{
   short l,l2,b;
   long cpu;
   char un[13],buf[1000];
   int ix;
   FILE *fp;
   struct acrdef *acr;
   struct acrdef2 *acr2;
   struct acrdef3 *acr3;
   fp = fopen("z.dat","rb");
   while(!feof(fp)) {
      fread(&buf[0],sizeof(char),12,fp);
      acr = (struct acrdef *)&buf[0];
      l = acr->acr$w_length;
      fread(&buf[12],sizeof(char),l-12,fp);
      if (acr->acr$v_type==ACR$K_PRCDEL) {
         ix = 12;
         while(ix<l) {
            acr = (struct acrdef *)&buf[ix];
            l2 = acr->acr$w_length;
            if(acr->acr$v_type==ACR$K_ID) {
               acr2 = (struct acrdef2 *)&buf[ix];
               b = buf[ix+acr2->acr$w_username];
               memcpy(un,&buf[ix+acr2->acr$w_username+1],b);
               un[b] = '\0';
            }
            if(acr->acr$v_type==ACR$K_RESOURCE) {
               acr3 = (struct acrdef3 *)&buf[ix];
               cpu = acr3->acr$l_cputime;
            }
            ix = ix+l2;
         }
         printf("un=%s cpu=%d\n",un,cpu);
      }
   }
   fclose(fp);
}
