|
|
1.1 ! root 1: #ifndef lint ! 2: static char *sccsid = "@(#)post.c 1.4 (Berkeley) 3/6/86"; ! 3: #endif ! 4: ! 5: #include "common.h" ! 6: ! 7: /* ! 8: * POST ! 9: * ! 10: * Post an article to a set of newsgroups. ! 11: */ ! 12: ! 13: post(argc, argv) ! 14: int argc; ! 15: char *argv[]; ! 16: { ! 17: int retcode; ! 18: ! 19: if (!canpost) { ! 20: printf("%d Sorry, you're not allowed to post.\r\n", ! 21: ERR_NOPOST); ! 22: #ifdef LOG ! 23: syslog(LOG_INFO, "%s post rejected", hostname); ! 24: #endif ! 25: (void) fflush(stdout); ! 26: return; ! 27: } ! 28: ! 29: #ifdef POSTER ! 30: if (uid_poster == 0) { ! 31: printf("%d User %s does not exist! Can't post.\r\n", ! 32: POSTER, ERR_POSTFAIL); ! 33: syslog(LOG_ERR, "post: User nobody does not exist."); ! 34: (void) fflush(stdout); ! 35: return; ! 36: } ! 37: #endif ! 38: ! 39: retcode = spawn(INEWS, "inews", "-h", CONT_POST, ERR_POSTFAIL); ! 40: if (retcode <= 0) ! 41: printf("%d Posting failed.\r\n", ERR_POSTFAIL); ! 42: else if (retcode > 0) ! 43: printf("%d Article posted successfully.\n", OK_POSTED); ! 44: (void) fflush(stdout); ! 45: ! 46: #ifdef LOG ! 47: syslog(LOG_INFO, "%s post %s", hostname, ! 48: retcode == 1 ? "succeeded" : "failed"); ! 49: #endif ! 50: ! 51: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.