|
|
1.1 ! root 1: #ifndef lint ! 2: static char *sccsid = "@(#)ihave.c 1.3 (Berkeley) 3/2/86"; ! 3: #endif ! 4: ! 5: #include "common.h" ! 6: ! 7: /* ! 8: * IHAVE <messageid> ! 9: * ! 10: * Accept an article for transferral if we haven't seen it before. ! 11: */ ! 12: ! 13: ihave(argc, argv) ! 14: int argc; ! 15: char *argv[]; ! 16: { ! 17: int retcode; ! 18: register FILE *fp; ! 19: ! 20: if (argc != 2) { ! 21: printf("%d IHAVE requires two arguments.\r\n", ERR_CMDSYN); ! 22: (void) fflush(stdout); ! 23: return; ! 24: } ! 25: ! 26: fp = openartbyid(argv[1]); ! 27: if (fp != NULL) { ! 28: (void) fclose(fp); ! 29: printf("%d Already seen that one, thanks.\r\n", ERR_GOTIT); ! 30: (void) fflush(stdout); ! 31: #ifdef LOG ! 32: syslog(LOG_INFO, "%s ihave %s rejected", hostname, argv[1]); ! 33: #endif ! 34: return; ! 35: } ! 36: ! 37: retcode = spawn(RNEWS, "rnews", (char *) 0, CONT_XFER, ERR_XFERFAIL); ! 38: if (retcode <= 0) ! 39: printf("%d Transfer failed.\r\n", ERR_XFERFAIL); ! 40: else if (retcode > 0) ! 41: printf("%d Article transferred successfully. Thank you.\r\n", ! 42: OK_XFERED); ! 43: (void) fflush(stdout); ! 44: ! 45: #ifdef LOG ! 46: syslog(LOG_INFO, "%s ihave %s accepted %s", ! 47: hostname, argv[1], retcode == 1 ? "succeeded" : "failed"); ! 48: #endif ! 49: ! 50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.