From 2bd4a73b56b525de8bd97231d03196585a3e00a1 Mon Sep 17 00:00:00 2001 From: kappa Date: Fri, 30 Oct 2020 19:07:23 +0100 Subject: [PATCH] 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. --- VERSION | 1 - dump_wtmp.c | 68 ----------------------------------------------------- 2 files changed, 69 deletions(-) delete mode 100644 VERSION delete mode 100644 dump_wtmp.c diff --git a/VERSION b/VERSION deleted file mode 100644 index c239c60..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.5 diff --git a/dump_wtmp.c b/dump_wtmp.c deleted file mode 100644 index 40fd57d..0000000 --- a/dump_wtmp.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include - -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); -}