|
|
1.1 ! root 1: #ifndef lint ! 2: static char *sccsid = "@(#)ihave.c 1.10 (Berkeley) 10/15/87"; ! 3: #endif ! 4: ! 5: #include "common.h" ! 6: ! 7: #ifdef LOG ! 8: int ih_accepted; ! 9: int ih_rejected; ! 10: int ih_failed; ! 11: #endif ! 12: ! 13: /* ! 14: * IHAVE <messageid> ! 15: * ! 16: * Accept an article for transferral if we haven't seen it before. ! 17: */ ! 18: ! 19: ihave(argc, argv) ! 20: int argc; ! 21: char *argv[]; ! 22: { ! 23: char errbuf[2 * MAX_STRLEN]; ! 24: int retcode; ! 25: register char *cp; ! 26: ! 27: if (argc != 2) { ! 28: printf("%d Usage: IHAVE <message-id>.\r\n", ERR_CMDSYN); ! 29: (void) fflush(stdout); ! 30: return; ! 31: } ! 32: ! 33: cp = gethistent(argv[1]); ! 34: if (cp != NULL) { ! 35: printf("%d Got it.\r\n", ERR_GOTIT); ! 36: (void) fflush(stdout); ! 37: #ifdef LOG ! 38: ih_rejected++; ! 39: #ifdef IHAVE_DEBUG ! 40: syslog(LOG_DEBUG, "%s ihave %s rejected", hostname, argv[1]); ! 41: #endif ! 42: #endif ! 43: return; ! 44: } ! 45: ! 46: retcode = spawn(rnews, "rnews", (char *) 0, CONT_XFER, ERR_XFERFAIL, errbuf); ! 47: if (retcode <= 0) ! 48: printf("%d %s\r\n", ERR_XFERFAIL, errbuf); ! 49: else if (retcode > 0) ! 50: printf("%d Thanks.\r\n", ! 51: OK_XFERED); ! 52: (void) fflush(stdout); ! 53: ! 54: #ifdef LOG ! 55: if (retcode == 1) ! 56: ih_accepted++; ! 57: else ! 58: ih_failed++; ! 59: ! 60: #ifdef IHAVE_DEBUG ! 61: syslog(LOG_DEBUG, "%s ihave %s accepted %s", ! 62: hostname, argv[1], retcode == 1 ? "succeeded" : "failed"); ! 63: #endif ! 64: #endif ! 65: ! 66: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.