Ejemplo n.º 1
0
static int
snmp_import_tree(struct snmp_toolinfo *tool, enum tok *tok)
{

	while (*tok != TOK_EOF) {
		switch (*tok) {
		    case TOK_ERR:
			return (-1);
		    case TOK_LPAREN:
			if (snmp_import_object(tool) < 0)
			    return (-1);
			break;
		    case TOK_RPAREN:
			if (snmp_suboid_pop(&current_oid) < 0)
			    return (-1);
			(void) snmp_import_update_table(ENTRY_NONE,
				(struct snmp_index_entry *) NULL);
			break;
		    default:
			/* anything else here would be illegal */
			return (-1);
		}
		*tok = gettoken(tool);
	}

	return (0);
}
Ejemplo n.º 2
0
static int32_t
snmp_import_tree(struct snmp_toolinfo *snmptoolctx, enum tok *tok)
{
	while (*tok != TOK_EOF) {
		switch (*tok) {
		    case TOK_ERR:
			return (-1);
		    case '(':
			if (snmp_import_object(snmptoolctx) < 0)
			    return (-1);
			break;
		    case ')':
			if (snmp_suboid_pop(&current_oid) < 0)
			    return (-1);
			(void) snmp_import_update_table(ENTRY_NONE, NULL);
			break;
		    default:
			/* Anything else here would be illegal. */
			return (-1);
		}
		*tok = gettoken(snmptoolctx);
	}

	return (0);
}