DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T i

⟦72eec29a2⟧ TextFile

    Length: 1723 (0x6bb)
    Types: TextFile
    Names: »ihave.c«

Derivation

└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
    └─⟦5cced586a⟧ »EurOpenD3/news/nntp/nntp.1.5.7.tar.Z« 
        └─⟦7340f105e⟧ 
            └─⟦this⟧ »./server/ihave.c« 

TextFile

#ifndef lint
static char	*sccsid = "@(#)ihave.c	1.13	(Berkeley) 8/27/89";
#endif

#include "common.h"

#ifdef LOG
int	ih_accepted;
int	ih_rejected;
int	ih_failed;
#endif LOG

/*
 * IHAVE <messageid>
 *
 * Accept an article for transferral if we haven't seen it before.
 */

ihave(argc, argv)
	int		argc;
	char		*argv[];
{
	char		errbuf[2 * NNTP_STRLEN];
	int		retcode;
	register char	*cp;

	if (argc != 2) {
		printf("%d Usage: IHAVE <message-id>.\r\n", ERR_CMDSYN);
		(void) fflush(stdout);
		return;
	}

	cp = gethistent(argv[1]);
	if (cp != NULL) {
		printf("%d Got it.\r\n", ERR_GOTIT);
		(void) fflush(stdout);
#ifdef LOG
		ih_rejected++;
#ifdef IHAVE_DEBUG
		syslog(LOG_DEBUG, "%s ihave %s rejected", hostname, argv[1]);
#endif IHAVE_DEBUG
#endif LOG
		return;
	}

	if (space() != 0) {
	    /* force error reporting code into sending */
	    /* an out-of-space error message	       */
	    if (gethostname(errbuf, MAXHOSTNAMELEN) < 0)
		(void) strcpy(errbuf, "Amnesiac");

	    (void) strcat(errbuf, " NNTP server out of space. Try later.");

	    retcode = 0;		/* indicates that an error occurred */
	} else 
#ifdef BATCHED_INPUT
	    /* C news input hook */
	    retcode = batch_input_article(CONT_XFER, ERR_XFERFAIL, errbuf);
#else
	    retcode = spawn(rnews, "rnews", (char *) 0, CONT_XFER,
			    ERR_XFERFAIL, errbuf);
#endif

	if (retcode <= 0)
		printf("%d %s\r\n", ERR_XFERFAIL, errbuf);
	else if (retcode > 0)
		printf("%d Thanks.\r\n",
			OK_XFERED);
	(void) fflush(stdout);

#ifdef LOG
	if (retcode == 1)
		ih_accepted++;
	else
		ih_failed++;
		
#ifdef IHAVE_DEBUG
	syslog(LOG_DEBUG, "%s ihave %s accepted %s",
		hostname, argv[1], retcode == 1 ? "succeeded" : "failed");
#endif IHAVE_DEBUG
#endif LOG

}