From 8849655d24bf6d73102b92f900d6d78b6600dca2 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 8 Oct 1998 00:19:47 +0000
Subject: [PATCH] I agree.  I think, though, that the best argument presented
 in the debate was from Paul Vixie, who wanted INET to be the name covering
 both IPV4 and IPV6.  The following kit makes the needed changes:

Tom Ivar Helbekkmo
---
 doc/{README.ipaddr => README.inet}     |  2 +-
 src/backend/utils/adt/Makefile         |  4 +-
 src/backend/utils/adt/{ip.c => inet.c} | 68 +++++++++++++-------------
 src/backend/utils/adt/mac.c            |  4 +-
 src/include/catalog/pg_opclass.h       |  4 +-
 src/include/catalog/pg_operator.h      | 22 ++++-----
 src/include/catalog/pg_proc.h          | 28 +++++------
 src/include/catalog/pg_type.h          |  6 +--
 src/include/utils/builtins.h           | 33 ++++++-------
 src/include/utils/{mac.h => inet.h}    |  6 +--
 src/tools/pgindent/pgindent            |  2 +-
 11 files changed, 90 insertions(+), 89 deletions(-)
 rename doc/{README.ipaddr => README.inet} (98%)
 rename src/backend/utils/adt/{ip.c => inet.c} (79%)
 rename src/include/utils/{mac.h => inet.h} (90%)

diff --git a/doc/README.ipaddr b/doc/README.inet
similarity index 98%
rename from doc/README.ipaddr
rename to doc/README.inet
index 7e7883a47e7..69df7dfc2ca 100644
--- a/doc/README.ipaddr
+++ b/doc/README.inet
@@ -1,7 +1,7 @@
 PostgreSQL type extensions for IP and MAC addresses.
 ---------------------------------------------------
 
-$Id: README.ipaddr,v 1.1 1998/10/03 05:40:41 momjian Exp $
+$Id: README.inet,v 1.1 1998/10/08 00:19:32 momjian Exp $
 
 I needed to record IP and MAC level ethernet addresses in a data
 base, and I really didn't want to store them as plain strings, with
diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefile
index 686a2d0e8ca..7ac61fc5d67 100644
--- a/src/backend/utils/adt/Makefile
+++ b/src/backend/utils/adt/Makefile
@@ -4,7 +4,7 @@
 #    Makefile for utils/adt
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.18 1998/10/03 05:40:47 momjian Exp $
+#    $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.19 1998/10/08 00:19:33 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -24,7 +24,7 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o chunk.o \
 	oid.o oracle_compat.o \
 	regexp.o regproc.o ruleutils.o selfuncs.o sets.o \
 	tid.o timestamp.o varchar.o varlena.o version.o \
-	ip.o mac.o inet_net_ntop.o inet_net_pton.o
+	inet.o mac.o inet_net_ntop.o inet_net_pton.o
 
 all: SUBSYS.o
 
diff --git a/src/backend/utils/adt/ip.c b/src/backend/utils/adt/inet.c
similarity index 79%
rename from src/backend/utils/adt/ip.c
rename to src/backend/utils/adt/inet.c
index 9b4ede1c64b..25e04362148 100644
--- a/src/backend/utils/adt/ip.c
+++ b/src/backend/utils/adt/inet.c
@@ -1,9 +1,9 @@
 /*
- *	PostgreSQL type definitions for IP addresses.  This
+ *	PostgreSQL type definitions for the INET type.  This
  *	is for IP V4 CIDR notation, but prepared for V6: just
  *	add the necessary bits where the comments indicate.
  *
- *	$Id: ip.c,v 1.4 1998/10/04 16:24:30 momjian Exp $
+ *	$Id: inet.c,v 1.1 1998/10/08 00:19:35 momjian Exp $
  */
 
 #include <sys/types.h>
@@ -19,38 +19,40 @@
 #include <postgres.h>
 #include <utils/palloc.h>
 #include <utils/builtins.h>
-#include <utils/mac.h>
+#include <utils/network.h>
+
+static int v4bitncmp(unsigned int a1, unsigned int a2, int bits);
 
 /*
  *	Access macros.	Add IPV6 support.
  */
 
-#define ip_addrsize(ipaddrptr) \
-	(((ipaddr_struct *)VARDATA(ipaddrptr))->family == AF_INET ? 4 : -1)
+#define ip_addrsize(inetptr) \
+	(((inet_struct *)VARDATA(inetptr))->family == AF_INET ? 4 : -1)
 
-#define ip_family(ipaddrptr) \
-	(((ipaddr_struct *)VARDATA(ipaddrptr))->family)
+#define ip_family(inetptr) \
+	(((inet_struct *)VARDATA(inetptr))->family)
 
-#define ip_bits(ipaddrptr) \
-	(((ipaddr_struct *)VARDATA(ipaddrptr))->bits)
+#define ip_bits(inetptr) \
+	(((inet_struct *)VARDATA(inetptr))->bits)
 
-#define ip_v4addr(ipaddrptr) \
-	(((ipaddr_struct *)VARDATA(ipaddrptr))->addr.ipv4_addr)
+#define ip_v4addr(inetptr) \
+	(((inet_struct *)VARDATA(inetptr))->addr.ipv4_addr)
 
 /*
  *	IP address reader.
  */
 
-ipaddr *
-ipaddr_in(char *src)
+inet *
+inet_in(char *src)
 {
 	int			bits;
-	ipaddr	   *dst;
+	inet	   *dst;
 
-	dst = palloc(VARHDRSZ + sizeof(ipaddr_struct));
+	dst = palloc(VARHDRSZ + sizeof(inet_struct));
 	if (dst == NULL)
 	{
-		elog(ERROR, "unable to allocate memory in ipaddr_in()");
+		elog(ERROR, "unable to allocate memory in inet_in()");
 		return (NULL);
 	}
 	/* First, try for an IP V4 address: */
@@ -75,7 +77,7 @@ ipaddr_in(char *src)
  */
 
 char *
-ipaddr_out(ipaddr *src)
+inet_out(inet *src)
 {
 	char	   *dst,
 				tmp[sizeof("255.255.255.255/32")];
@@ -99,7 +101,7 @@ ipaddr_out(ipaddr *src)
 	dst = palloc(strlen(tmp) + 1);
 	if (dst == NULL)
 	{
-		elog(ERROR, "unable to allocate memory in ipaddr_out()");
+		elog(ERROR, "unable to allocate memory in inet_out()");
 		return (NULL);
 	}
 	strcpy(dst, tmp);
@@ -111,7 +113,7 @@ ipaddr_out(ipaddr *src)
  */
 
 bool
-ipaddr_lt(ipaddr *a1, ipaddr *a2)
+inet_lt(inet *a1, inet *a2)
 {
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
@@ -129,13 +131,13 @@ ipaddr_lt(ipaddr *a1, ipaddr *a2)
 }
 
 bool
-ipaddr_le(ipaddr *a1, ipaddr *a2)
+inet_le(inet *a1, inet *a2)
 {
-	return (ipaddr_lt(a1, a2) || ipaddr_eq(a1, a2));
+	return (inet_lt(a1, a2) || inet_eq(a1, a2));
 }
 
 bool
-ipaddr_eq(ipaddr *a1, ipaddr *a2)
+inet_eq(inet *a1, inet *a2)
 {
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
@@ -152,13 +154,13 @@ ipaddr_eq(ipaddr *a1, ipaddr *a2)
 }
 
 bool
-ipaddr_ge(ipaddr *a1, ipaddr *a2)
+inet_ge(inet *a1, inet *a2)
 {
-	return (ipaddr_gt(a1, a2) || ipaddr_eq(a1, a2));
+	return (inet_gt(a1, a2) || inet_eq(a1, a2));
 }
 
 bool
-ipaddr_gt(ipaddr *a1, ipaddr *a2)
+inet_gt(inet *a1, inet *a2)
 {
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
@@ -176,13 +178,13 @@ ipaddr_gt(ipaddr *a1, ipaddr *a2)
 }
 
 bool
-ipaddr_ne(ipaddr *a1, ipaddr *a2)
+inet_ne(inet *a1, inet *a2)
 {
-	return (!ipaddr_eq(a1, a2));
+	return (!inet_eq(a1, a2));
 }
 
 bool
-ipaddr_sub(ipaddr *a1, ipaddr *a2)
+inet_sub(inet *a1, inet *a2)
 {
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
@@ -199,7 +201,7 @@ ipaddr_sub(ipaddr *a1, ipaddr *a2)
 }
 
 bool
-ipaddr_subeq(ipaddr *a1, ipaddr *a2)
+inet_subeq(inet *a1, inet *a2)
 {
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
@@ -216,7 +218,7 @@ ipaddr_subeq(ipaddr *a1, ipaddr *a2)
 }
 
 bool
-ipaddr_sup(ipaddr *a1, ipaddr *a2)
+inet_sup(inet *a1, inet *a2)
 {
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
@@ -233,7 +235,7 @@ ipaddr_sup(ipaddr *a1, ipaddr *a2)
 }
 
 bool
-ipaddr_supeq(ipaddr *a1, ipaddr *a2)
+inet_supeq(inet *a1, inet *a2)
 {
 	if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET))
 	{
@@ -254,7 +256,7 @@ ipaddr_supeq(ipaddr *a1, ipaddr *a2)
  */
 
 int4
-ipaddr_cmp(ipaddr *a1, ipaddr *a2)
+inet_cmp(inet *a1, inet *a2)
 {
 	if (ntohl(ip_v4addr(a1)) < ntohl(ip_v4addr(a2)))
 		return (-1);
@@ -267,7 +269,7 @@ ipaddr_cmp(ipaddr *a1, ipaddr *a2)
  *	Bitwise comparison for V4 addresses.  Add V6 implementation!
  */
 
-int
+static int
 v4bitncmp(unsigned int a1, unsigned int a2, int bits)
 {
 	unsigned long mask = 0;
diff --git a/src/backend/utils/adt/mac.c b/src/backend/utils/adt/mac.c
index 6d33f148dc6..488f1dd11ae 100644
--- a/src/backend/utils/adt/mac.c
+++ b/src/backend/utils/adt/mac.c
@@ -1,7 +1,7 @@
 /*
  *	PostgreSQL type definitions for MAC addresses.
  *
- *	$Id: mac.c,v 1.3 1998/10/04 16:24:32 momjian Exp $
+ *	$Id: mac.c,v 1.4 1998/10/08 00:19:36 momjian Exp $
  */
 
 #include <stdio.h>
@@ -10,7 +10,7 @@
 #include <postgres.h>
 #include <utils/palloc.h>
 #include <utils/builtins.h>
-#include <utils/mac.h>
+#include <utils/network.h>
 
 manufacturer manufacturers[] = {
   {0x00, 0x00, 0x0C, "Cisco"},
diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h
index 388f5986303..94186e469c6 100644
--- a/src/include/catalog/pg_opclass.h
+++ b/src/include/catalog/pg_opclass.h
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_opclass.h,v 1.12 1998/10/03 05:40:54 momjian Exp $
+ * $Id: pg_opclass.h,v 1.13 1998/10/08 00:19:38 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -109,7 +109,7 @@ DATA(insert OID = 1313 (	timespan_ops   1186   ));
 DESCR("");
 DATA(insert OID = 810  (	macaddr_ops   829   ));
 DESCR("");
-DATA(insert OID = 935  (	ipaddr_ops   869   ));
+DATA(insert OID = 935  (	inet_ops   869   ));
 DESCR("");
 
 #endif	 /* PG_OPCLASS_H */
diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h
index 4604ccd7a94..14166d5aef8 100644
--- a/src/include/catalog/pg_operator.h
+++ b/src/include/catalog/pg_operator.h
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_operator.h,v 1.39 1998/10/03 05:40:55 momjian Exp $
+ * $Id: pg_operator.h,v 1.40 1998/10/08 00:19:39 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -644,16 +644,16 @@ DATA(insert OID = 1224 (  ">"	   PGUID 0 b t f 829 829	 16 1222 1223 0 0 macaddr
 DATA(insert OID = 1225 (  ">="	   PGUID 0 b t f 829 829	 16 1223 1222 0 0 macaddr_ge intltsel intltjoinsel ));
 
 /* IP type */
-DATA(insert OID = 1201 (  "="	   PGUID 0 b t t 869 869	 16 1201 1202 0 0 ipaddr_eq eqsel eqjoinsel ));
-DATA(insert OID = 1202 (  "<>"	   PGUID 0 b t f 869 869	 16 1202 1201 0 0 ipaddr_ne neqsel neqjoinsel ));
-DATA(insert OID = 1203 (  "<"	   PGUID 0 b t f 869 869	 16 1205 1206 0 0 ipaddr_lt intltsel intltjoinsel ));
-DATA(insert OID = 1204 (  "<="	   PGUID 0 b t f 869 869	 16 1206 1205 0 0 ipaddr_le intltsel intltjoinsel ));
-DATA(insert OID = 1205 (  ">"	   PGUID 0 b t f 869 869	 16 1203 1204 0 0 ipaddr_gt intltsel intltjoinsel ));
-DATA(insert OID = 1206 (  ">="	   PGUID 0 b t f 869 869	 16 1204 1203 0 0 ipaddr_ge intltsel intltjoinsel ));
-DATA(insert OID = 931  (  "<<"	   PGUID 0 b t f 869 869     16 933  934  0 0 ipaddr_sub intltsel intltjoinsel ));
-DATA(insert OID = 932  (  "<<="	   PGUID 0 b t f 869 869     16 934  933  0 0 ipaddr_subeq intltsel intltjoinsel ));
-DATA(insert OID = 933  (  ">>"	   PGUID 0 b t f 869 869     16 931  932  0 0 ipaddr_sup intltsel intltjoinsel ));
-DATA(insert OID = 934  (  ">>="	   PGUID 0 b t f 869 869     16 932  931  0 0 ipaddr_supeq intltsel intltjoinsel ));
+DATA(insert OID = 1201 (  "="	   PGUID 0 b t t 869 869	 16 1201 1202 0 0 inet_eq eqsel eqjoinsel ));
+DATA(insert OID = 1202 (  "<>"	   PGUID 0 b t f 869 869	 16 1202 1201 0 0 inet_ne neqsel neqjoinsel ));
+DATA(insert OID = 1203 (  "<"	   PGUID 0 b t f 869 869	 16 1205 1206 0 0 inet_lt intltsel intltjoinsel ));
+DATA(insert OID = 1204 (  "<="	   PGUID 0 b t f 869 869	 16 1206 1205 0 0 inet_le intltsel intltjoinsel ));
+DATA(insert OID = 1205 (  ">"	   PGUID 0 b t f 869 869	 16 1203 1204 0 0 inet_gt intltsel intltjoinsel ));
+DATA(insert OID = 1206 (  ">="	   PGUID 0 b t f 869 869	 16 1204 1203 0 0 inet_ge intltsel intltjoinsel ));
+DATA(insert OID = 931  (  "<<"	   PGUID 0 b t f 869 869     16 933  934  0 0 inet_sub intltsel intltjoinsel ));
+DATA(insert OID = 932  (  "<<="	   PGUID 0 b t f 869 869     16 934  933  0 0 inet_subeq intltsel intltjoinsel ));
+DATA(insert OID = 933  (  ">>"	   PGUID 0 b t f 869 869     16 931  932  0 0 inet_sup intltsel intltjoinsel ));
+DATA(insert OID = 934  (  ">>="	   PGUID 0 b t f 869 869     16 932  931  0 0 inet_supeq intltsel intltjoinsel ));
 
 
 /*
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 76f92f0e612..969470a253c 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_proc.h,v 1.71 1998/10/03 05:40:56 momjian Exp $
+ * $Id: pg_proc.h,v 1.72 1998/10/08 00:19:40 momjian Exp $
  *
  * NOTES
  *	  The script catalog/genbki.sh reads this file and generates .bki
@@ -2069,32 +2069,32 @@ DATA(insert OID = 837 (  macaddr_manuf	   PGUID 11 f t f 1 f 25 "829" 100 0 0 10
 DESCR("MAC manufacturer");
 
 /* for ip type support */
-DATA(insert OID = 910 (  ipaddr_in			PGUID 11 f t f 1 f 869 "0" 100 0 0 100	foo bar ));
+DATA(insert OID = 910 (  inet_in			PGUID 11 f t f 1 f 869 "0" 100 0 0 100	foo bar ));
 DESCR("(internal)");
-DATA(insert OID = 911 (  ipaddr_out			PGUID 11 f t f 1 f 23 "0" 100 0 0 100  foo bar ));
+DATA(insert OID = 911 (  inet_out			PGUID 11 f t f 1 f 23 "0" 100 0 0 100  foo bar ));
 DESCR("(internal)");
 
-DATA(insert OID = 920 (  ipaddr_eq		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 920 (  inet_eq		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("equal");
-DATA(insert OID = 921 (  ipaddr_lt		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 921 (  inet_lt		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("less-than");
-DATA(insert OID = 922 (  ipaddr_le		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 922 (  inet_le		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 923 (  ipaddr_gt		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 923 (  inet_gt		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("greater-than");
-DATA(insert OID = 924 (  ipaddr_ge		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 924 (  inet_ge		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 925 (  ipaddr_ne		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 925 (  inet_ne		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("not equal");
-DATA(insert OID = 926 (  ipaddr_cmp	   	   PGUID 11 f t f 2 f 23 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 926 (  inet_cmp	   	   PGUID 11 f t f 2 f 23 "869 869" 100 0 0 100  foo bar ));
 DESCR("less-equal-greater");
-DATA(insert OID = 927 (  ipaddr_sub	   	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 927 (  inet_sub	   	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("is-subnet");
-DATA(insert OID = 928 (  ipaddr_subeq  	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 928 (  inet_subeq  	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("is-subnet-or-equal");
-DATA(insert OID = 929 (  ipaddr_sup	   	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 929 (  inet_sup	   	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("is-supernet");
-DATA(insert OID = 930 (  ipaddr_supeq  	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
+DATA(insert OID = 930 (  inet_supeq  	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
 DESCR("is-supernet-or-equal");
 
 
diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h
index 3a675c1c337..64118e3e9dd 100644
--- a/src/include/catalog/pg_type.h
+++ b/src/include/catalog/pg_type.h
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_type.h,v 1.48 1998/10/03 05:40:58 momjian Exp $
+ * $Id: pg_type.h,v 1.49 1998/10/08 00:19:42 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -300,7 +300,7 @@ DATA(insert OID = 791 (  _money    PGUID  -1 -1 f b t \054 0  790 array_in array
 /* OIDS 800 - 899 */
 DATA(insert OID = 829 ( macaddr	   PGUID  6 -1 f b t \054 0	0 macaddr_in macaddr_out macaddr_in macaddr_out i _null_ ));
 DESCR("MAC address");
-DATA(insert OID = 869 ( ipaddr	   PGUID  -1 -1 f b t \054 0 0 ipaddr_in ipaddr_out ipaddr_in ipaddr_out i _null_ ));
+DATA(insert OID = 869 ( inet	   PGUID  -1 -1 f b t \054 0 0 inet_in inet_out inet_in inet_out i _null_ ));
 DESCR("IP address");
 
 /* OIDS 900 - 999 */
@@ -339,7 +339,7 @@ DATA(insert OID = 1033 (  aclitem	 PGUID 8   -1 f b t \054 0 0 aclitemin aclitem
 DESCR("access control list");
 DATA(insert OID = 1034 (  _aclitem	 PGUID -1 -1 f b t \054 0 1033 array_in array_out array_in array_out i _null_ ));
 DATA(insert OID = 1040 (  _macaddr   PGUID -1 -1 f b t \054 0  829 array_in array_out array_in array_out i _null_ ));
-DATA(insert OID = 1041 (  _ipaddr    PGUID -1 -1 f b t \054 0  869 array_in array_out array_in array_out i _null_ ));
+DATA(insert OID = 1041 (  _inet    PGUID -1 -1 f b t \054 0  869 array_in array_out array_in array_out i _null_ ));
 DATA(insert OID = 1042 ( bpchar		 PGUID -1  -1 f b t \054 0	18 bpcharin bpcharout bpcharin bpcharout i _null_ ));
 DESCR("blank-padded characters, length specifed when created");
 #define BPCHAROID		1042
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 9b3ca4c627c..e02fd31bb61 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: builtins.h,v 1.57 1998/10/04 15:31:07 momjian Exp $
+ * $Id: builtins.h,v 1.58 1998/10/08 00:19:43 momjian Exp $
  *
  * NOTES
  *	  This should normally only be included by fmgr.h.
@@ -28,7 +28,7 @@
 #include <utils/nabstime.h>
 #include <utils/int8.h>
 #include <utils/cash.h>
-#include <utils/mac.h>
+#include <utils/network.h>
 #include <utils/rel.h>
 
 /*
@@ -518,21 +518,20 @@ char *inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size);
 /* inet_net_pton.c */
 int inet_net_pton(int af, const char *src, void *dst, size_t size);
 
-/* ip.c */
-ipaddr	   *ipaddr_in(char *str);
-char	   *ipaddr_out(ipaddr * addr);
-bool		ipaddr_lt(ipaddr * a1, ipaddr * a2);
-bool		ipaddr_le(ipaddr * a1, ipaddr * a2);
-bool		ipaddr_eq(ipaddr * a1, ipaddr * a2);
-bool		ipaddr_ge(ipaddr * a1, ipaddr * a2);
-bool		ipaddr_gt(ipaddr * a1, ipaddr * a2);
-bool		ipaddr_ne(ipaddr * a1, ipaddr * a2);
-bool		ipaddr_sub(ipaddr * a1, ipaddr * a2);
-bool		ipaddr_subeq(ipaddr * a1, ipaddr * a2);
-bool		ipaddr_sup(ipaddr * a1, ipaddr * a2);
-bool		ipaddr_supeq(ipaddr * a1, ipaddr * a2);
-int4		ipaddr_cmp(ipaddr * a1, ipaddr * a2);
-int			v4bitncmp(unsigned int a1, unsigned int a2, int bits);
+/* inet.c */
+inet	   *inet_in(char *str);
+char	   *inet_out(inet * addr);
+bool		inet_lt(inet * a1, inet * a2);
+bool		inet_le(inet * a1, inet * a2);
+bool		inet_eq(inet * a1, inet * a2);
+bool		inet_ge(inet * a1, inet * a2);
+bool		inet_gt(inet * a1, inet * a2);
+bool		inet_ne(inet * a1, inet * a2);
+bool		inet_sub(inet * a1, inet * a2);
+bool		inet_subeq(inet * a1, inet * a2);
+bool		inet_sup(inet * a1, inet * a2);
+bool		inet_supeq(inet * a1, inet * a2);
+int4		inet_cmp(inet * a1, inet * a2);
 
 
 /* mac.c */
diff --git a/src/include/utils/mac.h b/src/include/utils/inet.h
similarity index 90%
rename from src/include/utils/mac.h
rename to src/include/utils/inet.h
index df8a6762217..5b5546ffbfd 100644
--- a/src/include/utils/mac.h
+++ b/src/include/utils/inet.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: mac.h,v 1.2 1998/10/04 15:31:09 momjian Exp $
+ * $Id: inet.h,v 1.1 1998/10/08 00:19:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,9 +26,9 @@ typedef struct
 		unsigned int	ipv4_addr;	/* network byte order */
 		/* add IPV6 address type here */
 	}			addr;
-}			ipaddr_struct;
+}			inet_struct;
 
-typedef struct varlena ipaddr;
+typedef struct varlena inet;
 
 /*
  *	This is the internal storage format for MAC addresses:
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index 5873ae27021..b5e47b543ab 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -786,7 +786,7 @@ do
 -Tword8 \
 -Tyy_size_t \
 -Tyy_state_type \
--Tipaddr \
+-Tinet \
 -Tmacaddr \
 /tmp/$$a >/tmp/$$ 2>&1
 	if [ "$?" -ne 0 -o -s /tmp/$$ ]
-- 
GitLab