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 p

⟦e41436eed⟧ TextFile

    Length: 3019 (0xbcb)
    Types: TextFile
    Names: »p_stdin.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Tools/probe/p_stdin.c« 

TextFile

/* p_stdin.c: Gets values for the probe via stdin */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Tools/probe/RCS/p_stdin.c,v 5.0 90/09/20 16:30:19 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Tools/probe/RCS/p_stdin.c,v 5.0 90/09/20 16:30:19 pp Exp Locker: pp $
 *
 * $Log:	p_stdin.c,v $
 * Revision 5.0  90/09/20  16:30:19  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "util.h"
#include "q.h"
#include "tb_q.h"
#include <isode/cmd_srch.h>


#define  GetStr(buf)			(gets (buf) != NULL && isstr(buf))


/* --- externals --- */
extern CMD_TABLE			qtbl_que[];
extern Q_struct				*QuePtr;
extern ADDR				*make_adr_new();


/* --- static routines  --- */
static void 				prompt_encoded();




/* ---------------------  Begin  Routines  -------------------------------- */




void prompt_probe_stdin()
{
	char    buf[BUFSIZ];
	int	found;
	ADDR	*ap;

	/* --- Print a message --- */
	printf ("\n\n");
	printf (
"******************************************************************************");
	printf ("\n\n");
	printf ("This is a probe generation utility. Please note that the Recipient address \n"); 
	printf ("field is recursive, and that each address should be input, a line at a time\n\n"); 
	printf (
"******************************************************************************");
	printf ("\n\n");


	/* --- Originator --- */
	printf ("From:   ");
	printf ("%s\n", QuePtr -> Oaddress  -> ad_value);


	/* --- Recipients --- */
	printf ("To:     ");
	for (found = FALSE; GetStr(buf);) {
		ap = make_adr_new (buf, AD_RECIPIENT);
		adr_add (&QuePtr -> Raddress, ap);
		printf ("        ");
		found = TRUE;
	}
	if (found == FALSE) {
		printf ("*** Error: No Recipients specified ***\n"); 
		exit (1);
	}


	/* --- Content Length --- */
	printf ("%s:  ", rcmd_srch(Q_MSGSIZE, qtbl_que));
	GetStr(buf);
	QuePtr -> msgsize = atoi(buf);


	/* --- EncodedInformationTypes --- */
	(void) prompt_encoded();


	/* --- UA id --- */
	printf ("%s:  ", rcmd_srch(Q_UA_ID, qtbl_que));
	GetStr(buf);
	if (isstr(buf))
		QuePtr -> ua_id = strdup (buf); 


	/* --- Per Message Flag --- */
	QuePtr -> implicit_conversion = 
		prompt_yn (rcmd_srch (Q_IMPLICIT_CONVERSION, qtbl_que));

	QuePtr -> alternate_recip_allowed = 
		prompt_yn (rcmd_srch (Q_ALTERNATE_RECIP_ALLOWED, qtbl_que));

	printf ("\n");
}



/* ---------------------  Static Routines  -------------------------------- */



static int prompt_yn (name)
char	*name; 
{ 
	char	buf[BUFSIZ];
	int	retval;
	
	if (name == NULLCP) { 
		 printf ("*** Error: Internal error no key specified ***\n");
                exit (1);
        }
	
	printf ("%s (y/n):  ", name);
	if (gets(buf) == NULL)
		exit (1);
	retval = set_yn(buf);
	return retval;
}



static void prompt_encoded()
{
	char	buf[BUFSIZ];
	int	retval;		


	for (;;) {
		printf ("%s:  ", rcmd_srch(Q_ENCODED_INFO, qtbl_que));
		if (gets(buf) == NULL)	exit (1);
		retval = set_encoded (buf);
		if (retval == NOTOK)
			continue;
		return;
	}
}