Mail and News are tried and true distribution mechanisms. They are used by millions on people on a daily basis. Your assignment is to develop a simple Mail/News Agent that will display a quick summary of waiting EMail and News articles.
Upon startup, your program should ask questions as to: (1) POP server
hostname, (2) POP server username, (3) POP server password, (4) NNTP
server hostname, and (5) list of newsgroups to check. The password must be
retrieved by the UNIX getpass() C function or a
non-echoing equivalent. The number of newsgroups checked may be up to
256. Appropriate error information should be displayed in case of
wrong input. For mail, the program should display the number of
messages waiting and the total size of all messages (use the STAT
command). For news, the program should display the number of articles
and the starting article number (use the GROUP command).
Example
$ mn_client
POP server: naur.csee.wvu.edu
POP username: cs268
POP password:
NNTP server: news.wvnet.edu
Newsgroups (1 per line. End with a .)
Newsgroup 1: comp.os.linux
Newsgroup 2: comp.lang.python
Newsgroup 3: .
should produce output similar to this:
Checking mail at naur.csee.wvu.edu for cs268.
cs268 has 3 messages (15878 bytes)
Checking news at news.wvnet.edu for 2 newsgroups.
comp.os.linux has 38 articles (starting with number 2380)
comp.lang.python has 215 articles (staring with number 15498)
You may use 157.182.194.39 as a working POP server. Username: cstest
and password: cstest
(ftp://ds.internic.net/rfc/rfc1939.txt)
(ftp://ds.internic.net/rfc/rfc977.txt)
For extra credit, provide the option of using APOP for POP. This must be
an argument to your program (-a). Hint: use getopt() to parse
arguments.
For extra credit, provide the option of having mail and/or news print out
a list of the articles/messages in a (from, subject) form. The arguments
you must support are (-m for printing mail info and -n for printing news
info). Hints: For POP, use the TOP command if available.
For NNTP, use the XOVER command if available. If the command
is not supported by the server, then ignore the argument and print a
warning message.