aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-11-20 19:20:46 -0500
committerMike Frysinger <vapier@gentoo.org>2011-11-20 19:46:38 -0500
commit97b31ceedcfc909b4e8479ad8f7ea4f47fb5336d (patch)
tree1ed94abdc62534569932aba970797d0d41bfdc50
parentget_sname: avoid buffer overflows if proto name is too long (diff)
downloadnet-tools-97b31ceedcfc909b4e8479ad8f7ea4f47fb5336d.tar.gz
net-tools-97b31ceedcfc909b4e8479ad8f7ea4f47fb5336d.tar.bz2
net-tools-97b31ceedcfc909b4e8479ad8f7ea4f47fb5336d.zip
clean up const/unsigned pointers with aftype/hwtype structs
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--arp.c6
-rw-r--r--lib/arcnet.c2
-rw-r--r--lib/ash.c6
-rw-r--r--lib/ax25.c4
-rw-r--r--lib/ddp.c4
-rw-r--r--lib/econet.c8
-rw-r--r--lib/ether.c2
-rw-r--r--lib/eui64.c2
-rw-r--r--lib/fddi.c2
-rw-r--r--lib/frame.c2
-rw-r--r--lib/hippi.c2
-rw-r--r--lib/ib.c2
-rw-r--r--lib/inet.c4
-rw-r--r--lib/inet6.c4
-rw-r--r--lib/ipx.c4
-rw-r--r--lib/irda.c2
-rw-r--r--lib/loopback.c2
-rw-r--r--lib/net-support.h6
-rw-r--r--lib/netrom.c4
-rw-r--r--lib/rose.c6
-rw-r--r--lib/strip.c4
-rw-r--r--lib/tr.c2
-rw-r--r--lib/tunnel.c2
-rw-r--r--lib/unix.c8
-rw-r--r--lib/x25.c6
25 files changed, 48 insertions, 48 deletions
diff --git a/arp.c b/arp.c
index 924f416..8a376ec 100644
--- a/arp.c
+++ b/arp.c
@@ -434,7 +434,7 @@ static int arp_file(char *name)
/* Print the contents of an ARP request block. */
-static void arp_disp_2(char *name, int type, int arp_flags, char *hwa, char *mask, char *dev)
+static void arp_disp_2(const char *name, int type, int arp_flags, const char *hwa, const char *mask, const char *dev)
{
static int title = 0;
struct hwtype *xhw;
@@ -484,7 +484,7 @@ static void arp_disp_2(char *name, int type, int arp_flags, char *hwa, char *mas
}
/* Print the contents of an ARP request block. */
-static void arp_disp(char *name, char *ip, int type, int arp_flags, char *hwa, char *mask, char *dev)
+static void arp_disp(const char *name, const char *ip, int type, int arp_flags, const char *hwa, const char *mask, const char *dev)
{
struct hwtype *xhw;
@@ -538,7 +538,7 @@ static int arp_show(char *name)
char dev[100];
int type, flags;
FILE *fp;
- char *hostname;
+ const char *hostname;
int num, entries = 0, showed = 0;
host[0] = '\0';
diff --git a/lib/arcnet.c b/lib/arcnet.c
index eb0f46e..35a2b9a 100644
--- a/lib/arcnet.c
+++ b/lib/arcnet.c
@@ -35,7 +35,7 @@ extern struct hwtype arcnet_hwtype;
/* Display an ARCnet address in readable format. */
-static char *pr_arcnet(unsigned char *ptr)
+static const char *pr_arcnet(const char *ptr)
{
static char buff[64];
diff --git a/lib/ash.c b/lib/ash.c
index c64667c..addb6fd 100644
--- a/lib/ash.c
+++ b/lib/ash.c
@@ -31,8 +31,8 @@ static unsigned char hamming[16] =
};
/* Display an Ash address in readable format. */
-static char *
-pr_ash(unsigned char *ptr)
+static const char *
+pr_ash(const char *ptr)
{
static char buff[128];
char *p = buff;
@@ -102,7 +102,7 @@ struct hwtype ash_hwtype =
#if HAVE_AFASH
/* Display an Ash socket address. */
-static char *
+static const char *
pr_sash(struct sockaddr *sap, int numeric)
{
static char buf[64];
diff --git a/lib/ax25.c b/lib/ax25.c
index 11521d2..209e479 100644
--- a/lib/ax25.c
+++ b/lib/ax25.c
@@ -47,7 +47,7 @@ static char AX25_errmsg[128];
extern struct aftype ax25_aftype;
-static char *AX25_print(unsigned char *ptr)
+static const char *AX25_print(const char *ptr)
{
static char buff[8];
int i;
@@ -66,7 +66,7 @@ static char *AX25_print(unsigned char *ptr)
/* Display an AX.25 socket address. */
-static char *
+static const char *
AX25_sprint(struct sockaddr *sap, int numeric)
{
static char buf[64];
diff --git a/lib/ddp.c b/lib/ddp.c
index 9b5e829..0a08fd2 100644
--- a/lib/ddp.c
+++ b/lib/ddp.c
@@ -32,7 +32,7 @@
#include "util.h"
/* Display a ddp domain address. */
-static char *ddp_print(unsigned char *ptr)
+static const char *ddp_print(const char *ptr)
{
static char buff[64];
struct sockaddr_at *sat = (struct sockaddr_at *) (ptr - 2);
@@ -42,7 +42,7 @@ static char *ddp_print(unsigned char *ptr)
/* Display a ddp domain address. */
-static char *ddp_sprint(struct sockaddr *sap, int numeric)
+static const char *ddp_sprint(struct sockaddr *sap, int numeric)
{
static char buf[64];
diff --git a/lib/econet.c b/lib/econet.c
index 1229a28..05f09c9 100644
--- a/lib/econet.c
+++ b/lib/econet.c
@@ -32,8 +32,8 @@
/* Display an Econet address */
-static char *
-ec_print(unsigned char *ptr)
+static const char *
+ec_print(const char *ptr)
{
static char buff[64];
struct ec_addr *ec = (struct ec_addr *) ptr;
@@ -43,7 +43,7 @@ ec_print(unsigned char *ptr)
/* Display an Econet socket address */
-static char *
+static const char *
ec_sprint(struct sockaddr *sap, int numeric)
{
struct sockaddr_ec *sec = (struct sockaddr_ec *) sap;
@@ -51,7 +51,7 @@ ec_sprint(struct sockaddr *sap, int numeric)
if (sap->sa_family != AF_ECONET)
return _("[NONE SET]");
- return ec_print((unsigned char *) &sec->addr);
+ return ec_print((const char *) &sec->addr);
}
static int
diff --git a/lib/ether.c b/lib/ether.c
index 70a6daf..ddd1598 100644
--- a/lib/ether.c
+++ b/lib/ether.c
@@ -35,7 +35,7 @@ extern struct hwtype ether_hwtype;
/* Display an Ethernet address in readable format. */
-static char *pr_ether(unsigned char *ptr)
+static const char *pr_ether(const char *ptr)
{
static char buff[64];
diff --git a/lib/eui64.c b/lib/eui64.c
index 64c3614..6ab7d26 100644
--- a/lib/eui64.c
+++ b/lib/eui64.c
@@ -49,7 +49,7 @@
struct hwtype eui64_hwtype;
/* Display an EUI-64 address in readable format. */
-static char *pr_eui64( unsigned char *ptr )
+static const char *pr_eui64(const char *ptr)
{
static char buff[64];
diff --git a/lib/fddi.c b/lib/fddi.c
index f6bf5ca..75adddd 100644
--- a/lib/fddi.c
+++ b/lib/fddi.c
@@ -46,7 +46,7 @@ extern struct hwtype fddi_hwtype;
/* Display an FDDI address in readable format. */
-static char *pr_fddi(unsigned char *ptr)
+static const char *pr_fddi(const char *ptr)
{
static char buff[64];
diff --git a/lib/frame.c b/lib/frame.c
index 58d1ad4..ad265d6 100644
--- a/lib/frame.c
+++ b/lib/frame.c
@@ -37,7 +37,7 @@
#include "net-support.h"
#include "pathnames.h"
-char *pr_dlci(unsigned char *ptr)
+static const char *pr_dlci(const char *ptr)
{
static char buf[12];
diff --git a/lib/hippi.c b/lib/hippi.c
index 308db00..bd73ea1 100644
--- a/lib/hippi.c
+++ b/lib/hippi.c
@@ -46,7 +46,7 @@ extern struct hwtype hippi_hwtype;
/* Display an HIPPI address in readable format. */
-static char *pr_hippi(unsigned char *ptr)
+static const char *pr_hippi(const char *ptr)
{
static char buff[64];
diff --git a/lib/ib.c b/lib/ib.c
index 72281a1..e05bd3e 100644
--- a/lib/ib.c
+++ b/lib/ib.c
@@ -36,7 +36,7 @@ extern struct hwtype ib_hwtype;
/* Display an InfiniBand address in readable format. */
-static char *pr_ib(unsigned char *ptr)
+static const char *pr_ib(const char *ptr)
{
static char buff[128];
char *pos;
diff --git a/lib/inet.c b/lib/inet.c
index 60e55df..49fcee8 100644
--- a/lib/inet.c
+++ b/lib/inet.c
@@ -229,14 +229,14 @@ static void INET_reserror(char *text)
/* Display an Internet socket address. */
-static char *INET_print(unsigned char *ptr)
+static const char *INET_print(const char *ptr)
{
return (inet_ntoa((*(struct in_addr *) ptr)));
}
/* Display an Internet socket address. */
-static char *INET_sprint(struct sockaddr *sap, int numeric)
+static const char *INET_sprint(struct sockaddr *sap, int numeric)
{
static char buff[128];
diff --git a/lib/inet6.c b/lib/inet6.c
index c8406fd..5f00430 100644
--- a/lib/inet6.c
+++ b/lib/inet6.c
@@ -126,7 +126,7 @@ static void INET6_reserror(char *text)
/* Display an Internet socket address. */
-static char *INET6_print(unsigned char *ptr)
+static const char *INET6_print(const char *ptr)
{
static char name[80];
@@ -137,7 +137,7 @@ static char *INET6_print(unsigned char *ptr)
/* Display an Internet socket address. */
/* dirty! struct sockaddr usually doesn't suffer for inet6 addresses, fst. */
-static char *INET6_sprint(struct sockaddr *sap, int numeric)
+static const char *INET6_sprint(struct sockaddr *sap, int numeric)
{
static char buff[128];
diff --git a/lib/ipx.c b/lib/ipx.c
index 13d2761..1359f5f 100644
--- a/lib/ipx.c
+++ b/lib/ipx.c
@@ -42,7 +42,7 @@
#endif
/* Display a ipx domain address. */
-static char *IPX_print(unsigned char *ptr)
+static const char *IPX_print(const char *ptr)
{
static char buff[64];
struct sockaddr_ipx *sipx = (struct sockaddr_ipx *) (ptr - 2);
@@ -73,7 +73,7 @@ static char *IPX_print(unsigned char *ptr)
/* Display a ipx domain address. */
-static char *IPX_sprint(struct sockaddr *sap, int numeric)
+static const char *IPX_sprint(struct sockaddr *sap, int numeric)
{
static char buf[64];
diff --git a/lib/irda.c b/lib/irda.c
index 598e6f0..a64876b 100644
--- a/lib/irda.c
+++ b/lib/irda.c
@@ -59,7 +59,7 @@
* Print hardware address of interface
*
*/
-static char *irda_print(unsigned char *ptr)
+static const char *irda_print(const char *ptr)
{
static char buff[12];
diff --git a/lib/loopback.c b/lib/loopback.c
index 0f08ac2..1b7e9cc 100644
--- a/lib/loopback.c
+++ b/lib/loopback.c
@@ -32,7 +32,7 @@
#include "util.h"
/* Display an UNSPEC address. */
-static char *pr_unspec(unsigned char *ptr)
+static const char *pr_unspec(const char *ptr)
{
static char buff[64];
char *pos;
diff --git a/lib/net-support.h b/lib/net-support.h
index dae15ac..d7a19d5 100644
--- a/lib/net-support.h
+++ b/lib/net-support.h
@@ -38,8 +38,8 @@ struct aftype {
char *title;
int af;
int alen;
- char *(*print) (unsigned char *);
- char *(*sprint) (struct sockaddr *, int numeric);
+ const char *(*print) (const char *);
+ const char *(*sprint) (struct sockaddr *, int numeric);
int (*input) (int type, char *bufp, struct sockaddr *);
void (*herror) (char *text);
int (*rprint) (int options);
@@ -60,7 +60,7 @@ struct hwtype {
char *title;
int type;
int alen;
- char *(*print) (unsigned char *);
+ const char *(*print) (const char *);
int (*input) (char *, struct sockaddr *);
int (*activate) (int fd);
int suppress_null_addr;
diff --git a/lib/netrom.c b/lib/netrom.c
index 1de9dc3..f3033c7 100644
--- a/lib/netrom.c
+++ b/lib/netrom.c
@@ -52,7 +52,7 @@ static char netrom_errmsg[128];
extern struct aftype netrom_aftype;
-static char *NETROM_print(unsigned char *ptr)
+static const char *NETROM_print(const char *ptr)
{
static char buff[8];
int i;
@@ -71,7 +71,7 @@ static char *NETROM_print(unsigned char *ptr)
/* Display an AX.25 socket address. */
-static char *NETROM_sprint(struct sockaddr *sap, int numeric)
+static const char *NETROM_sprint(struct sockaddr *sap, int numeric)
{
char buf[64];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
diff --git a/lib/rose.c b/lib/rose.c
index 381226b..52d025a 100644
--- a/lib/rose.c
+++ b/lib/rose.c
@@ -53,8 +53,8 @@ static char ROSE_errmsg[128];
extern struct aftype rose_aftype;
-static char *
- ROSE_print(unsigned char *ptr)
+static const char *
+ ROSE_print(const char *ptr)
{
static char buff[12];
@@ -64,7 +64,7 @@ static char *
}
/* Display a ROSE socket address. */
-static char *
+static const char *
ROSE_sprint(struct sockaddr *sap, int numeric)
{
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
diff --git a/lib/strip.c b/lib/strip.c
index fd396ba..ced2325 100644
--- a/lib/strip.c
+++ b/lib/strip.c
@@ -38,8 +38,8 @@
extern struct hwtype strip_hwtype;
-static char *
-pr_strip(unsigned char *ptr)
+static const char *
+pr_strip(const char *ptr)
{
static char buff[64];
if(ptr[1])
diff --git a/lib/tr.c b/lib/tr.c
index c75f256..961cdb1 100644
--- a/lib/tr.c
+++ b/lib/tr.c
@@ -39,7 +39,7 @@ extern struct hwtype tr_hwtype;
extern struct hwtype tr_hwtype1;
#endif
-static char *pr_tr(unsigned char *ptr)
+static const char *pr_tr(const char *ptr)
{
static char buff[64];
diff --git a/lib/tunnel.c b/lib/tunnel.c
index 19606c1..8a160bf 100644
--- a/lib/tunnel.c
+++ b/lib/tunnel.c
@@ -21,7 +21,7 @@
extern struct hwtype ether_hwtype;
-static char *pr_tunnel(unsigned char *ptr)
+static const char *pr_tunnel(const char *ptr)
{
return ("");
}
diff --git a/lib/unix.c b/lib/unix.c
index fb4dcce..936cd48 100644
--- a/lib/unix.c
+++ b/lib/unix.c
@@ -32,7 +32,7 @@
/* Display an UNSPEC address. */
-static char *UNSPEC_print(unsigned char *ptr)
+static const char *UNSPEC_print(const char *ptr)
{
static char buff[64];
char *pos;
@@ -48,7 +48,7 @@ static char *UNSPEC_print(unsigned char *ptr)
/* Display an UNSPEC socket address. */
-static char *UNSPEC_sprint(struct sockaddr *sap, int numeric)
+static const char *UNSPEC_sprint(struct sockaddr *sap, int numeric)
{
static char buf[64];
@@ -61,14 +61,14 @@ static char *UNSPEC_sprint(struct sockaddr *sap, int numeric)
#if HAVE_AFUNIX
/* Display a UNIX domain address. */
-static char *UNIX_print(unsigned char *ptr)
+static const char *UNIX_print(const char *ptr)
{
return (ptr);
}
/* Display a UNIX domain address. */
-static char *UNIX_sprint(struct sockaddr *sap, int numeric)
+static const char *UNIX_sprint(struct sockaddr *sap, int numeric)
{
static char buf[64];
diff --git a/lib/x25.c b/lib/x25.c
index 1ffb569..d795ca9 100644
--- a/lib/x25.c
+++ b/lib/x25.c
@@ -50,8 +50,8 @@ extern struct aftype x25_aftype;
#endif
-static char *
-X25_print(unsigned char *ptr)
+static const char *
+X25_print(const char *ptr)
{
static char buff[X25_ADDR_LEN+1];
@@ -63,7 +63,7 @@ X25_print(unsigned char *ptr)
/* Display an X.25 socket address. */
-static char *
+static const char *
X25_sprint(struct sockaddr *sap, int numeric)
{
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)