Beispiel #1
0
char *	function_xdebug (char *word)
{
	char	*ret = NULL, *free_str = NULL;
	const char	*mask = NULL;
	int	cnt;
	size_t	clue = 0;

	mask = next_arg(word, &word);
	mask = mask && *mask ? mask : star;

	for (cnt = 0; opts[cnt].command; cnt++)
	{
		if (!~opts[cnt].flag) {
			continue;
		} else if (!wild_match(mask,opts[cnt].command)) {
			continue;
		} else if (x_debug & opts[cnt].flag) {
			malloc_strcat_wordlist_c(&ret, space, "+", &clue);
		} else {
			malloc_strcat_wordlist_c(&ret, space, "-", &clue);
		}
		malloc_strcat_c(&ret, opts[cnt].command, &clue);
	}

	if (word && *word)
		malloc_strcat_wordlist_c(&ret, space,
			free_str = function_xdebug(word), &clue);
	new_free(&free_str);
	malloc_strcat_c(&ret, "", &clue);
	return ret;
}
Beispiel #2
0
static char *	all_keys_for_dbm (int refnum)
{
	Dbm *	db;
	Datum 	k;
	char *	retval = NULL;
	size_t	clue = 0;
	char *	x;

	if (!(db = lookup_dbm(refnum)))
		return NULL;

	k = sdbm_firstkey(db->db);
	x = Datum_to_string(k);
	malloc_strcat_wordlist_c(&retval, space, x, &clue);
	new_free(&x);

	for (;;)
	{
		k = sdbm_nextkey(db->db);
		if (k.dptr == NULL)
			break;
		x = Datum_to_string(k);
		malloc_strcat_wordlist_c(&retval, space, x, &clue);
		new_free(&x);
	}

	return retval;
}