4 * A simple program to parse citadel.log
12 #if TIME_WITH_SYS_TIME
13 # include <sys/time.h>
17 # include <sys/time.h>
27 void get_config (void);
31 main (int argc, char **argv)
45 logfp = fopen ("citadel.log", "r");
48 perror ("Could not open citadel.log");
53 while (fgets (buf, sizeof buf, logfp) != NULL)
55 buf[strlen (buf) - 1] = 0;
58 LogTime = atol (strtok(buf, "|"));
59 LogType = atol (strtok(NULL, "|"));
60 strcpy(LogName, strtok(NULL, "|"));
65 if (LogType & CL_CONNECT)
66 strcpy (aaa, "Connect");
67 if (LogType & CL_LOGIN)
68 strcpy (aaa, "Login");
69 if (LogType & CL_NEWUSER)
70 strcpy (aaa, "New User");
71 if (LogType & CL_BADPW)
72 strcpy (aaa, "Bad PW Attempt");
73 if (LogType & CL_TERMINATE)
74 strcpy (aaa, "Terminate");
75 if (LogType & CL_DROPCARR)
76 strcpy (aaa, "Dropped Carrier");
77 if (LogType & CL_SLEEPING)
78 strcpy (aaa, "Sleeping");
79 if (LogType & CL_PWCHANGE)
80 strcpy (aaa, "Changed Passwd");
81 tm = (struct tm *) localtime (&LogTime);
82 tstring = (char *) asctime (tm);
83 printf ("%30s %20s %s", LogName, aaa, tstring);