Exemplo n.º 1
0
static int
ui_write_prompt(struct uiclient *client)
{
	char *tmp = make_prompt();

	evbuffer_add(client->outbuf, (void *)tmp, strlen(tmp));
	event_add(client->ev_write, NULL);

	return (0);
}
Exemplo n.º 2
0
Arquivo: param.c Projeto: E-LLP/QuIP
static COMMAND_FUNC( do_chng_one )
{
	Param *p;
	const char **pnlist;
	int nlist=0;
	int i=0;
	const char *s;

	p=theptbl;

	/* count the number of parameters */
	while( p->p_type != NULL_P_TYPE ) {
		nlist++;
		p++;
	}

	pnlist = (const char **) getbuf( (nlist+1) * sizeof(char *) );
	if( pnlist == NULL ) mem_err("do_chng_one");

#ifdef HAVE_HISTORY

	if( intractive(SINGLE_QSP_ARG) && IS_TRACKING_HISTORY(THIS_QSP) ){
		List *lp;
		Node *np;

		lp = new_list();
		for(i=0;i<nlist;i++){
			pnlist[i] = theptbl[i].p_name;
			np = mk_node(&theptbl[i]);
			addTail(lp,np);
		}
		pnlist[i]="all";
		np = mk_node(&pnlist[i]);
		addTail(lp,np);

		if( intractive(SINGLE_QSP_ARG) ){
			char pline[LLEN];
			make_prompt(QSP_ARG  pline,PNAME_PMPT);
			new_defs(QSP_ARG  pline);		/* is this needed? */
			init_hist_from_item_list(QSP_ARG  PNAME_PMPT,lp);
		}

		dellist(lp);
	}

#else /* ! HAVE_HISTORY */
	for(i=0;i<nlist;i++)
		pnlist[i] = theptbl[i].p_name;
#endif /* ! HAVE_HISTORY */

	s=NAMEOF(PNAME_PMPT);
	if( !strcmp(s,"all") ){
		p=theptbl;
		while( p->p_type != NULL_P_TYPE ) {
			getparm(QSP_ARG  p);
			showparm(QSP_ARG  p);
			p++;
		}
		return;
	} else if( get_pval(QSP_ARG  s,theptbl) == -1 ){
		sprintf(ERROR_STRING,"Unknown parameter \"%s\"",s);
		WARN(ERROR_STRING);
	}
}