1/*
2 * Copyright (C) 2002 by Darren Reed.
3 *
4 * See the IPFILTER.LICENCE file for details on licencing.
5 */
6
7#include <sys/ioctl.h>
8#include "ipf.h"
--- 38 unchanged lines hidden (view full) ---
47
48 last = 0;
49 top = NULL;
50 printed = 0;
51
52 while (!last && (ioctl(fd, SIOCLOOKUPITER, &obj) == 0)) {
53 if (entry.ipn_next == NULL)
54 last = 1;
55 entry.ipn_next = top;
56 top = malloc(sizeof(*top));
57 if (top == NULL)
58 break;
59 bcopy(&entry, top, sizeof(entry));
60 }
61
62 while (top != NULL) {
63 node = top;
64 (void) printpoolnode(node, opts);
65 if ((opts & OPT_DEBUG) == 0)
66 putchar(';');
67 top = node->ipn_next;
68 free(node);
69 printed++;
70 }
71
72 if (printed == 0)
73 putchar(';');
74
75 if ((opts & OPT_DEBUG) == 0)
76 PRINTF(" };\n");
77 return pool->ipo_next;
78}
2 * Copyright (C) 2002 by Darren Reed.
3 *
4 * See the IPFILTER.LICENCE file for details on licencing.
5 */
6
7#include <sys/ioctl.h>
8#include "ipf.h"
--- 38 unchanged lines hidden (view full) ---
47
48 last = 0;
49 top = NULL;
50 printed = 0;
51
52 while (!last && (ioctl(fd, SIOCLOOKUPITER, &obj) == 0)) {
53 if (entry.ipn_next == NULL)
54 last = 1;
55 entry.ipn_next = top;
56 top = malloc(sizeof(*top));
57 if (top == NULL)
58 break;
59 bcopy(&entry, top, sizeof(entry));
60 }
61
62 while (top != NULL) {
63 node = top;
64 (void) printpoolnode(node, opts);
65 if ((opts & OPT_DEBUG) == 0)
66 putchar(';');
67 top = node->ipn_next;
68 free(node);
69 printed++;
70 }
71
72 if (printed == 0)
73 putchar(';');
74
75 if ((opts & OPT_DEBUG) == 0)
76 PRINTF(" };\n");
77 return pool->ipo_next;
78}