dogetnetmask.c (7c478bd95313f5f23a4c958a745db2134aa03244) dogetnetmask.c (2c5ec7a875dcd76853e6618614e990f1e8cdd56d)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *

--- 5 unchanged lines hidden (view full) ---

14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *

--- 5 unchanged lines hidden (view full) ---

14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22#ident "%Z%%M% %I% %E% SMI"
23
24/*
22
23/*
24 * Copyright (c) 2018 Peter Tribble.
25 * Copyright (c) 1994-1996, by Sun Microsystems, Inc.
26 * All rights reserved.
27 */
28
29#include <stdio.h>
30#include <stdlib.h>
31#include <string.h>
32#include <sys/types.h>
33#include <sys/socket.h>
34#include <netinet/in.h>
35#include <arpa/inet.h>
36#include <netdb.h>
25 * Copyright (c) 1994-1996, by Sun Microsystems, Inc.
26 * All rights reserved.
27 */
28
29#include <stdio.h>
30#include <stdlib.h>
31#include <string.h>
32#include <sys/types.h>
33#include <sys/socket.h>
34#include <netinet/in.h>
35#include <arpa/inet.h>
36#include <netdb.h>
37#include <libsocket_priv.h>
37#include "getent.h"
38
39extern char *inet_nettoa(struct in_addr in);
40
41static int
42putnetmask(const struct in_addr key, const struct in_addr netmask, FILE *fp)
43{
38#include "getent.h"
39
40extern char *inet_nettoa(struct in_addr in);
41
42static int
43putnetmask(const struct in_addr key, const struct in_addr netmask, FILE *fp)
44{
44 char **p;
45 int rc = 0;
46 struct in_addr net;
47
48 net.s_addr = ntohl(key.s_addr);
49 if (fprintf(fp, "%-20s", inet_nettoa(net)) == EOF)
50 rc = 1;
51 if (fprintf(fp, " %s", inet_ntoa(netmask)) == EOF)
52 rc = 1;

--- 32 unchanged lines hidden ---
45 int rc = 0;
46 struct in_addr net;
47
48 net.s_addr = ntohl(key.s_addr);
49 if (fprintf(fp, "%-20s", inet_nettoa(net)) == EOF)
50 rc = 1;
51 if (fprintf(fp, " %s", inet_ntoa(netmask)) == EOF)
52 rc = 1;

--- 32 unchanged lines hidden ---