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 node = malloc(sizeof(*top));
56 if (node == NULL)
57 break;
58 bcopy(&entry, node, sizeof(entry));
59 node->ipn_next = top;
60 top = node;
61 }
62
63 while (top != NULL) {
64 node = top;
65 (void) printpoolnode(node, opts);
66 if ((opts & OPT_DEBUG) == 0)
67 putchar(';');
68 top = node->ipn_next;
69 free(node);
70 printed++;
71 }
72
73 if (printed == 0)
74 putchar(';');
75
76 if ((opts & OPT_DEBUG) == 0)
77 PRINTF(" };\n");
78
79 if (ioctl(fd, SIOCIPFDELTOK, &iter.ili_key) != 0)
80 perror("SIOCIPFDELTOK");
81
82 return pool->ipo_next;
83}
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 node = malloc(sizeof(*top));
56 if (node == NULL)
57 break;
58 bcopy(&entry, node, sizeof(entry));
59 node->ipn_next = top;
60 top = node;
61 }
62
63 while (top != NULL) {
64 node = top;
65 (void) printpoolnode(node, opts);
66 if ((opts & OPT_DEBUG) == 0)
67 putchar(';');
68 top = node->ipn_next;
69 free(node);
70 printed++;
71 }
72
73 if (printed == 0)
74 putchar(';');
75
76 if ((opts & OPT_DEBUG) == 0)
77 PRINTF(" };\n");
78
79 if (ioctl(fd, SIOCIPFDELTOK, &iter.ili_key) != 0)
80 perror("SIOCIPFDELTOK");
81
82 return pool->ipo_next;
83}