freebsd-dev/sbin/ipf/libipf/printdstlist.c
Cy Schubert 2582ae5740 ipfilter: Adjust userland returns to conform to style(9)
Adjust ipfilter's userland return statements to conform to style(9).

MFC after:	1 month
2022-01-03 18:06:43 -08:00

56 lines
1.0 KiB
C

/*
* Copyright (C) 2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*/
#include "ipf.h"
ippool_dst_t *
printdstlist( ippool_dst_t *pp, copyfunc_t copyfunc, char *name, int opts,
ipf_dstnode_t *nodes, wordtab_t *fields)
{
ipf_dstnode_t *node;
ippool_dst_t dst;
if ((*copyfunc)(pp, &dst, sizeof(dst)))
return(NULL);
if ((name != NULL) && strncmp(name, dst.ipld_name, FR_GROUPLEN))
return(dst.ipld_next);
if (fields == NULL)
printdstlistdata(&dst, opts);
if ((dst.ipld_flags & IPDST_DELETE) != 0)
PRINTF("# ");
if ((opts & OPT_DEBUG) == 0)
PRINTF("\t{");
if (nodes == NULL) {
putchar(';');
} else {
for (node = nodes; node != NULL; ) {
ipf_dstnode_t *n;
n = calloc(1, node->ipfd_size);
if (n == NULL)
break;
if ((*copyfunc)(node, n, node->ipfd_size)) {
free(n);
return(NULL);
}
node = printdstlistnode(n, bcopywrap, opts, fields);
free(n);
}
}
if ((opts & OPT_DEBUG) == 0)
PRINTF(" };\n");
return(dst.ipld_next);
}