Exemplo n.º 1
0
void headers_brief_filter(long msgnum, void *userdata)
{
	long i, l;
	struct CtdlMessage *msg;
	msg_filter *flt = (msg_filter*) userdata;

	l = GetCount(flt->Filter);
	msg = CtdlFetchMessage(msgnum, 0, 1);
	StrBufPrintf(flt->buffer, "%ld", msgnum);
	if (msg == NULL) {
		for (i = 0; i < l; i++) {
			StrBufAppendBufPlain(flt->buffer, HKEY("|"), 0);
		}
	}
	else {
		const char *k;
		long len;
		void *v;
		RewindHashPos(flt->Filter, flt->p, 0);
		while (GetNextHashPos(flt->Filter, flt->p, &len, &k, &v)) {
			eMsgField f = (eMsgField) v;
			
			StrBufAppendBufPlain(flt->buffer, HKEY("|"), 0);
			if (!CM_IsEmpty(msg, f)) {
				StrBufAppendBufPlain(flt->buffer, CM_KEY(msg, f), 0);
			}
		}
	}
	StrBufAppendBufPlain(flt->buffer, HKEY("\n"), 0);
	cputbuf(flt->buffer);
}
Exemplo n.º 2
0
Arquivo: trap.c Projeto: kanojs/akaros
void
print_trapframe(struct hw_trapframe *hw_tf)
{
    char buf[1024];
    int len = format_trapframe(hw_tf, buf, sizeof(buf));
    cputbuf(buf,len);
}
Exemplo n.º 3
0
ssize_t dev_stdout_write(struct file *file, const char *buf, size_t count,
                         off64_t *offset)
{
	char *t_buf;
	struct proc *p = current;
	if (p)
		t_buf = user_strdup_errno(p, buf, count);
	else
		t_buf = (char*)buf;
	if (!t_buf)
		return -1;
	/* TODO: tty hack.  they are sending us an escape sequence, and the keyboard
	 * would try to print it (which it can't do yet).  The hack is even dirtier
	 * in that we only detect it if it is the first char, and we ignore
	 * everything else. */
	if (t_buf[0] == '\033') /* 0x1b */
		return count;
	cputbuf(t_buf, count);
	return count;
}
Exemplo n.º 4
0
void cmd_gvdn(char *argbuf)
{
	const ConfType *pCfg;
	char *confptr;
	long min = atol(argbuf);
	const char *Pos = NULL;
	const char *PPos = NULL;
	const char *HKey;
	long HKLen;
	StrBuf *Line;
	StrBuf *Config;
	StrBuf *Cfg;
	StrBuf *CfgToken;
	HashList *List;
	HashPos *It;
	void *vptr;
	
	List = NewHash(1, NULL);
	Cfg = NewStrBufPlain(config.c_fqdn, -1);
	Put(List, SKEY(Cfg), Cfg, HFreeStrBuf);
	Cfg = NULL;

	confptr = CtdlGetSysConfig(INTERNETCFG);
	Config = NewStrBufPlain(confptr, -1);
	free(confptr);

	Line = NewStrBufPlain(NULL, StrLength(Config));
	CfgToken = NewStrBufPlain(NULL, StrLength(Config));
	while (StrBufSipLine(Line, Config, &Pos))
	{
		if (Cfg == NULL)
			Cfg = NewStrBufPlain(NULL, StrLength(Line));
		PPos = NULL;
		StrBufExtract_NextToken(Cfg, Line, &PPos, '|');
		StrBufExtract_NextToken(CfgToken, Line, &PPos, '|');
		if (GetHash(CfgNameHash, SKEY(CfgToken), &vptr) &&
		    (vptr != NULL))
		{
			pCfg = (ConfType *) vptr;
			if (pCfg->Type <= min)
			{
				Put(List, SKEY(Cfg), Cfg, HFreeStrBuf);
				Cfg = NULL;
			}
		}
	}

	cprintf("%d Valid Domains\n", LISTING_FOLLOWS);
	It = GetNewHashPos(List, 1);
	while (GetNextHashPos(List, It, &HKLen, &HKey, &vptr))
	{
		cputbuf(vptr);
		cprintf("\n");
	}
	cprintf("000\n");

	DeleteHashPos(&It);
	DeleteHash(&List);
	FreeStrBuf(&Cfg);
	FreeStrBuf(&Line);
	FreeStrBuf(&CfgToken);
	FreeStrBuf(&Config);
}