chiark / gitweb /
pacct file has moved
[chiark-utils.git] / cprogs / acctdump.c
index 98fab9c55d4f96d0d782500894c99a5c1f62b4d1..151e11d69a79ba667214c9f71d3dafc26edf76d6 100644 (file)
@@ -289,12 +289,11 @@ static void processfile(FILE *file, const char *filename) {
       printrecord(&as,filename);
     }
   } else {
-    long seekdist= -(long)sizeof(as);
     r= fseek(file,0,SEEK_END); if (r) { perror(filename); exit(8); }
     pos= ftell(file); if (pos==-1) { perror(filename); exit(8); }
     if (pos % sizeof(as)) { 
       fprintf(stderr, "%s: File size is not an integral number "
-             "of accounting records", filename);
+             "of accounting records\n", filename);
       exit(8);
     }
     for (;;) {
@@ -303,7 +302,6 @@ static void processfile(FILE *file, const char *filename) {
       r= fseek(file,pos,SEEK_SET); if (r==-1) { perror(filename); exit(8); }
       r= fread(&as,1,sizeof(as),file); if (r!=sizeof(as)) { perror(filename); exit(8); }
       printrecord(&as,filename);
-      seekdist= -2*(long)sizeof(as);
     }
   }
   if (ferror(file) || fclose(file)) { perror(filename); exit(8); }
@@ -317,15 +315,12 @@ static void processnamedfile(const char *filename) {
 }
 
 int main(int argc, const char *const *argv) {
-union { struct_acct ac; char c[1]; } xu;
   myopt(&argv,cmdinfos);
   if (!nobanner) printbanner();
-fprintf(stdout,"s=%d %d\n",(int)sizeof(struct_acct),
-       (int)((char*)&xu.ac.ac_comm - xu.c));
   if (usestdin) {
     processfile(stdin,"<standard input>");
   } else if (!*argv) {
-    processnamedfile("/var/account/pacct");
+    processnamedfile("/var/log/account/pacct");
   } else {
     while (*argv) {
       processnamedfile(*argv);