No information is available for this file.
9b926fde28d577b77c7df055b27fb7f7b7c64b861fc5401f79be75f044eb768e
/* Dave's neato wtmp program
* wzap.c
* NOTE: reads 'wtmp' from current directory and writes
* 'wtmp.out' in cuurent directory...
*/
#include <utmp.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
FILE *Wfile, *Wout;
struct utmp myutmp;
main(argc,argv)
int argc;
char *argv[];
{
char username[20];
char yesorno[5];
long thetime, posi;
if (argc<2) {
printf("\n\n");
printf("Enter username to zap from the wtmp: ");
scanf("%s",username);
} else strcpy(username,argv[1]);
printf("\nopening file...\n");
if ((Wfile = fopen("wtmp","r"))==NULL)
{ printf("no open file\n"); exit(0); }
printf("\opening output file...\n");
if ((Wout = fopen("wtmp.out","wr"))==NULL)
{ printf("no open output file...\n"); exit(0); }
printf("working...\n");
while(!feof(Wfile)) {
fread(&myutmp,sizeof(myutmp),1,Wfile);
if (strncmp(myutmp.ut_name,username,8))
fwrite(&myutmp,sizeof(myutmp),1,Wout);
}
fclose(Wfile);
fclose(Wout);
}