Home | History | Annotate | Line # | Download | only in lib
      1      1.1  christos /*	$NetBSD: printpooldata.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $	*/
      2      1.1  christos 
      3      1.1  christos /*
      4  1.1.1.2   darrenr  * Copyright (C) 2012 by Darren Reed.
      5      1.1  christos  *
      6      1.1  christos  * See the IPFILTER.LICENCE file for details on licencing.
      7      1.1  christos  */
      8      1.1  christos 
      9      1.1  christos #include "ipf.h"
     10      1.1  christos #include <ctype.h>
     11      1.1  christos 
     12      1.1  christos 
     13      1.1  christos void
     14      1.1  christos printpooldata(pool, opts)
     15      1.1  christos 	ip_pool_t *pool;
     16      1.1  christos 	int opts;
     17      1.1  christos {
     18      1.1  christos 
     19      1.1  christos 	if ((opts & OPT_DEBUG) == 0) {
     20      1.1  christos 		if ((pool->ipo_flags & IPOOL_ANON) != 0)
     21      1.1  christos 			PRINTF("# 'anonymous' tree %s\n", pool->ipo_name);
     22      1.1  christos 		if ((pool->ipo_flags & IPOOL_DELETE) != 0)
     23      1.1  christos 			PRINTF("# ");
     24      1.1  christos 		PRINTF("table role=");
     25      1.1  christos 	} else {
     26      1.1  christos 		if ((pool->ipo_flags & IPOOL_DELETE) != 0)
     27      1.1  christos 			PRINTF("# ");
     28      1.1  christos 		PRINTF("%s: %s",
     29      1.1  christos 			ISDIGIT(*pool->ipo_name) ? "Number" : "Name",
     30      1.1  christos 			pool->ipo_name);
     31      1.1  christos 		if ((pool->ipo_flags & IPOOL_ANON) == IPOOL_ANON)
     32      1.1  christos 			PRINTF("(anon)");
     33      1.1  christos 		putchar(' ');
     34      1.1  christos 		PRINTF("Role: ");
     35      1.1  christos 	}
     36      1.1  christos 
     37      1.1  christos 	printunit(pool->ipo_unit);
     38      1.1  christos 
     39      1.1  christos 	if ((opts & OPT_DEBUG) == 0) {
     40      1.1  christos 		PRINTF(" type=tree %s=%s\n",
     41      1.1  christos 			(!*pool->ipo_name || ISDIGIT(*pool->ipo_name)) ? \
     42      1.1  christos 			"number" : "name", pool->ipo_name);
     43      1.1  christos 	} else {
     44      1.1  christos 		putchar(' ');
     45      1.1  christos 
     46      1.1  christos 		PRINTF("\tReferences: %d\tHits: %lu\n", pool->ipo_ref,
     47      1.1  christos 			pool->ipo_hits);
     48      1.1  christos 		if ((pool->ipo_flags & IPOOL_DELETE) != 0)
     49      1.1  christos 			PRINTF("# ");
     50      1.1  christos 		PRINTF("\tNodes Starting at %p\n", pool->ipo_list);
     51      1.1  christos 	}
     52      1.1  christos }
     53