4 * A simple program to parse citadel.log
16 void get_config (void);
20 main (int argc, char **argv)
34 logfp = fopen ("citadel.log", "r");
37 perror ("Could not open citadel.log");
42 while (fgets (buf, 256, logfp) != NULL)
44 buf[strlen (buf) - 1] = 0;
47 LogTime = atol (strtok(buf, "|"));
48 LogType = atol (strtok(NULL, "|"));
49 strcpy(LogName, strtok(NULL, "|"));
54 if (LogType & CL_CONNECT)
55 strcpy (aaa, "Connect");
56 if (LogType & CL_LOGIN)
57 strcpy (aaa, "Login");
58 if (LogType & CL_NEWUSER)
59 strcpy (aaa, "New User");
60 if (LogType & CL_BADPW)
61 strcpy (aaa, "Bad PW Attempt");
62 if (LogType & CL_TERMINATE)
63 strcpy (aaa, "Terminate");
64 if (LogType & CL_DROPCARR)
65 strcpy (aaa, "Dropped Carrier");
66 if (LogType & CL_SLEEPING)
67 strcpy (aaa, "Sleeping");
68 if (LogType & CL_PWCHANGE)
69 strcpy (aaa, "Changed Passwd");
70 tm = (struct tm *) localtime (&LogTime);
71 tstring = (char *) asctime (tm);
72 printf ("%30s %20s %s", LogName, aaa, tstring);