From 14c25c92be68a13d3ac94bdc46b16ba2590de4c9 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 28 Feb 2010 14:16:56 +0100 Subject: getnet: switch to config parser Signed-off-by: Bernhard Reutner-Fischer --- test/inet/getnetent.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/inet/getnetent.c (limited to 'test') diff --git a/test/inet/getnetent.c b/test/inet/getnetent.c new file mode 100644 index 000000000..6607cea9a --- /dev/null +++ b/test/inet/getnetent.c @@ -0,0 +1,17 @@ +#include +#include +int main(void) +{ + struct netent *net; + setnetent(0); + while ((net = getnetent())) { + while (net->n_net && !((net->n_net >> 24) & 0xff)) { + net->n_net <<= 8; + } + printf("%lu.%lu.%lu.%lu\n", + (net->n_net >> 24) & 0xff, (net->n_net >> 16) & 0xff, + (net->n_net >> 8) & 0xff, net->n_net & 0xff); + } + endnetent(); + return 0; +} -- cgit v1.2.3