All pastes #974671 Raw Edit

Someone

public text v1 · immutable
·published 2008-04-06 23:07 UTC
rendered paste body
main() {
  struct utmp utmp_ent;
  FILE *fp;

  fp = fopen(UTMP_FILENAME, "rb");
//  fp = fopen(WTMP_FILENAME, "rb");

  if(fp) {
    while(!feof(fp)) {
      fread(&utmp_ent, sizeof(utmp_ent), 1, fp);
      if(!strncmp(utmp_ent.ut_name, WHO, strlen(WHO))) {
//        bzero((char *)&utmp_ent, sizeof(utmp_ent));
        fseek(fp, -(sizeof(utmp_ent)), SEEK_CUR);
        printf("%s\n", utmp_ent.ut_name);
      }
    }
  }
}