/* * mail2nntp.c * * The mail2nntp program reads mail from stdin and posts it * to one or more newsgroups using NNTP. It delivers the mes- * sage immediately or fails. If queuing is desired it can * operate as a LMTP server. * * The OSSP Project, Cable & Wireless Deutschland GmbH * Thomas Lotterer, * */ #include #include #define ERR_EXECUTION -1 #define ERR_DELIVERY -2 void usage(char *command); int main(int argc, char **argv) { int i; // general purpose scratch int, index ... // read in the arguments while ((i = getopt(argc, argv, "p:l:h:m:tv")) != -1) switch (i) { case 'p': // -p protocol break; case 'l': // -l logtarget break; case 'h': // -h host[:port] break; case 'm': // -m mode break; case 'd': // -t (tracing) break; case 'v': // -v (verbose) break; case '?': default: usage(argv[0]); exit(ERR_EXECUTION); } argc -= optind; argv += optind; // remaining args is/are newsgroup/s printf("Hello, World!\n"); return 0; } /* * print usage information * */ void usage(char *command) { fprintf(stderr, "USAGE: %s [-p protocol] [-l logtarget] "\ "[-h host[:port]] [-m mode] [-t] [-v] newsgroup [newsgroup ...]\n", command); return; }