home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff319.lzh
/
CNewsSrc
/
cnews.orig.lzh
/
misc
/
newshist.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-27
|
1KB
|
81 lines
/*
* newshist msgids - print history lines corresponding to msgids
*/
#include <stdio.h>
#include "news.h"
#include "history.h"
char *progname;
int debug;
static char *histfile; /* unused */
int remote; /* to satisfy rnews code */
int headdebug = 0; /* no debugging */
/*
* main - parse arguments and handle options
*/
main(argc, argv)
int argc;
char *argv[];
{
int c;
int errflg = 0;
extern int optind;
extern char *optarg;
progname = argv[0];
while ((c = getopt(argc, argv, "df:")) != EOF)
switch (c) {
case 'd':
++debug;
break;
case 'f':
histfile = optarg;
break;
default:
errflg++;
break;
}
if (optind == argc || errflg) {
fprintf(stderr, "usage: %s [-df file] msgid ...\n", progname);
exit(2);
}
for (; optind < argc; optind++)
process(argv[optind]);
exit(0);
}
/*
* process - message-id argument
*/
process(msgid)
char *msgid;
{
char *histent;
if (msgid == NULL)
return;
histent = gethistory(msgid);
if (histent == NULL) {
char newmsgid[1000];
extern char *strcpy(), *strcat();
(void) strcpy(newmsgid, "<");
(void) strcat(newmsgid, msgid);
(void) strcat(newmsgid, ">");
histent = gethistory(newmsgid);
}
if (histent == NULL)
fprintf(stderr, "%s: no history entry for %s nor <%s>\n",
progname, msgid, msgid);
else
fputs(histent, stdout);
(void) fflush(stdout);
}
unprivileged()
{
}