I can't remember exactly why I decided I needed to write this program. I figured more than anything else, though, it was a good programming exercise (since I'm a lousy programmer) and it gave me the chance to learn more about reporting errors through syslogd.
It's basically a useless little utility that lets you insert arbitrary messages into the system log. A program like logger will do exactly the same thing, which I figured out after I wrote this, but I figure at least with this code you could easily modify it into a CGI script that would let web potatoes (like couch potatoes with a keyboard instead of a remote, unless you own a WebTV box) insert messages into your system log. Hmm, maybe I should set up a page to do that... sounds like a bad enough idea....
Anyhow, here you go, enjoy. Seems to compile fine under IRIX 6.3 and Linux. At least I think it does. And you're right, it is a waste to type up a whole web page for something so lame, especially when the logger command does the exact same thing, only with infinitely more finesse. But remember, it's more about the idea than it is the implementation. And I think covert little scripts that baffle and annoy system administrators can be great fun when appropriately applied, don't you?
#include <stdio.h>
#include <syslog.h>
int main(int argc, char *argv[])
{
if (argc
< 2)
{
printf("Usage: %s <annoying message>\n", argv[0]);
exit(1);
}
openlog(argv[0],
LOG_PID, LOG_DAEMON);
syslog(LOG_INFO,
argv[1]);
closelog();
printf("Sufficiently
annoyed.\n");
exit(0);
}