Remove unneeded files: dump_wtmp.c and VERSION
The file dump_wtmp.c is not a part of the timeoutd program itself, but a seperate diagnostic tool, which, if it must be used at all, belongs in a seperate package. I've decided to simply remove it from this repository. It's name is also a misnomer, as it's programed to actually dump the utmp file, not the wtmp file. It also only dumps records written on the current date, and only some of the fields. It seemed that fixing the program would require more effort that it's worth, as I'm currently not using the program for any diagnostic purpose, and there are now better replacements for it, such as the Linux package utmpdump. Therefore, I decided to remove it and cease working on it. The VERSION file didn't seem to be too useful, as the version of the program is stated elsewhere, the VERSION file is actually out of date with the version in the timeoutd.c file, and the particular version of the software doesn't even matter currently. Therefore, both files have been deleted.
This commit is contained in:
parent
d03d713004
commit
2bd4a73b56
68
dump_wtmp.c
68
dump_wtmp.c
|
@ -1,68 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <utmp.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
struct utmp ut;
|
|
||||||
struct tm *tm;
|
|
||||||
char user[9];
|
|
||||||
char host[17];
|
|
||||||
char line[13];
|
|
||||||
|
|
||||||
if ((fp = fopen(UTMP_FILE, "r")) == NULL)
|
|
||||||
{
|
|
||||||
printf("Could not open wtmp file!");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Go to end of file minus one structure */
|
|
||||||
fseek(fp, -1L * sizeof(struct utmp), SEEK_END);
|
|
||||||
|
|
||||||
while (fread(&ut, sizeof(struct utmp), 1, fp) == 1)
|
|
||||||
{
|
|
||||||
tm = localtime(&ut.ut_time);
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (tm->tm_year != now.tm_year || tm->tm_yday != now.tm_yday)
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
|
|
||||||
printf("%02d:%02d type=", tm->tm_hour,tm->tm_min);
|
|
||||||
switch (ut.ut_type)
|
|
||||||
{
|
|
||||||
#ifndef SUNOS
|
|
||||||
case RUN_LVL: printf("RUN_LVL");
|
|
||||||
break;
|
|
||||||
case BOOT_TIME: printf("BOOT_TIME");
|
|
||||||
break;
|
|
||||||
case NEW_TIME: printf("NEW_TIME");
|
|
||||||
break;
|
|
||||||
case OLD_TIME: printf("OLD_TIME");
|
|
||||||
break;
|
|
||||||
case INIT_PROCESS: printf("INIT_PROCESS");
|
|
||||||
break;
|
|
||||||
case LOGIN_PROCESS: printf("LOGIN_PROCESS");
|
|
||||||
break;
|
|
||||||
case USER_PROCESS: printf("USER_PROCESS");
|
|
||||||
break;
|
|
||||||
case DEAD_PROCESS: printf("DEAD_PROCESS");
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default: printf("UNKNOWN!(type=%d)", ut.ut_type);
|
|
||||||
}
|
|
||||||
strncpy(user, ut.ut_user, 8);
|
|
||||||
user[8] = 0;
|
|
||||||
strncpy(host, ut.ut_host, 16);
|
|
||||||
host[16] = 0;
|
|
||||||
strncpy(line, ut.ut_line, 12);
|
|
||||||
line[12] = 0;
|
|
||||||
printf(" line=%s host=%s user=%s\n", line, host, user);
|
|
||||||
|
|
||||||
|
|
||||||
/* Position the file pointer 2 structures back */
|
|
||||||
if (fseek(fp, -2 * sizeof(struct utmp), SEEK_CUR) < 0) break;
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
Loading…
Reference in a new issue