Deleted Added
full compact
printpool_live.c (170263) printpool_live.c (172771)
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;
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)
55 node = malloc(sizeof(*top));
56 if (node == NULL)
58 break;
57 break;
59 bcopy(&entry, top, sizeof(entry));
58 bcopy(&entry, node, sizeof(entry));
59 node->ipn_next = top;
60 top = node;
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");
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
77 return pool->ipo_next;
78}
82 return pool->ipo_next;
83}