示例#1
0
文件: input.c 项目: dforsyth/rirc
static void
new_list_head(input *i)
{
	/* Append a new line as the list_head */

	input_line *l;

	if ((l = calloc(1, sizeof(*l))) == NULL)
		fatal("calloc");

	DLL_ADD(i->list_head, l);

	i->line = i->list_head = l;

	/* Gap buffer pointers */
	i->head = l->text;
	i->tail = l->text + MAX_INPUT;

	i->window = l->text;
}
示例#2
0
文件: net.c 项目: loudambiance/rirc
static server*
new_server(char *host, char *port)
{
	server *s;

	if ((s = calloc(1, sizeof(*s))) == NULL)
		fatal("calloc");

	/* Set non-zero default fields */
	s->soc = -1;
	s->iptr = s->input;
	s->nptr = config.nicks;
	s->host = strdup(host);
	s->port = strdup(port);

	auto_nick(&(s->nptr), s->nick);

	s->channel = ccur = new_channel(host, s, NULL, BUFFER_SERVER);

	DLL_ADD(server_head, s);

	return s;
}