From e60914acca0aa65e9208c3bc717b62ca1a8bbb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Groenvall?= Date: Mon, 27 Jan 1997 14:08:08 +0000 Subject: [PATCH] Made things compile under SunOS4 again. Fix lots of warnings under SunOS4. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1201 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftpd/ftpd.c | 2 +- appl/login/utmp_login.c | 13 +++++++------ appl/telnet/telnet/ring.c | 2 +- lib/roken/roken.h | 6 +++++- lib/roken/roken.h.in | 6 +++++- lib/roken/strerror.c | 3 ++- lib/roken/strtok_r.c | 2 ++ lib/sl/sl.c | 4 ++-- 8 files changed, 25 insertions(+), 13 deletions(-) diff --git a/appl/ftp/ftpd/ftpd.c b/appl/ftp/ftpd/ftpd.c index b05abd2af..117b3239b 100644 --- a/appl/ftp/ftpd/ftpd.c +++ b/appl/ftp/ftpd/ftpd.c @@ -55,7 +55,7 @@ RCSID("$Id$"); #ifdef HAVE_SYS_SOCKET_H #include #endif -#ifdef HAVE_SYS_IOCTL_H +#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4 #include #endif #ifdef HAVE_SYS_TIME_H diff --git a/appl/login/utmp_login.c b/appl/login/utmp_login.c index 2ae63b169..3259a2f20 100644 --- a/appl/login/utmp_login.c +++ b/appl/login/utmp_login.c @@ -49,11 +49,9 @@ void utmp_login(char *tty, char *username, char *hostname) { return; } void utmp_login(char *tty, char *username, char *hostname) { struct utmp utmp; - struct hostent *he; int fd; char *ttyx; /* tty w/o /dev/* */ - char *id; ttyx = tty; @@ -71,6 +69,7 @@ void utmp_login(char *tty, char *username, char *hostname) # ifdef HAVE_UT_ADDR if (hostname[0]) { + struct hostent *he; if ((he = gethostbyname(hostname))) memcpy(&utmp.ut_addr, he->h_addr_list[0], sizeof(utmp.ut_addr)); @@ -90,11 +89,13 @@ void utmp_login(char *tty, char *username, char *hostname) # endif # ifdef HAVE_UT_ID - /* any particular reason to not include "tty" ? */ - id = ttyx; - if(strncmp(ttyx, "tty", 3) == 0) + { + /* any particular reason to not include "tty" ? */ + char *id = ttyx; + if(strncmp(ttyx, "tty", 3) == 0) id += 3; - strncpy(utmp.ut_id, id, sizeof(utmp.ut_id)); + strncpy(utmp.ut_id, id, sizeof(utmp.ut_id)); + } # endif diff --git a/appl/telnet/telnet/ring.c b/appl/telnet/telnet/ring.c index f80387dd6..2d574ff08 100644 --- a/appl/telnet/telnet/ring.c +++ b/appl/telnet/telnet/ring.c @@ -55,7 +55,7 @@ RCSID("$Id$"); #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_SYS_IOCTL_H +#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4 #include #endif #ifdef HAVE_SYS_SOCKET_H diff --git a/lib/roken/roken.h b/lib/roken/roken.h index 364256a67..0c5734e4d 100644 --- a/lib/roken/roken.h +++ b/lib/roken/roken.h @@ -65,7 +65,7 @@ #include #endif -#ifdef HAVE_SYS_IOCTL_H +#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4 #include #endif @@ -99,6 +99,10 @@ char * strlwr(char *); int strnlen(char*, int); #endif +#ifndef HAVE_STRTOK_R +char *strtok_r(char *s1, const char *s2, char **lasts); +#endif + #ifndef HAVE_STRUPR char * strupr(char *); #endif diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 364256a67..0c5734e4d 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -65,7 +65,7 @@ #include #endif -#ifdef HAVE_SYS_IOCTL_H +#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4 #include #endif @@ -99,6 +99,10 @@ char * strlwr(char *); int strnlen(char*, int); #endif +#ifndef HAVE_STRTOK_R +char *strtok_r(char *s1, const char *s2, char **lasts); +#endif + #ifndef HAVE_STRUPR char * strupr(char *); #endif diff --git a/lib/roken/strerror.c b/lib/roken/strerror.c index 9954aed98..f417ddc6b 100644 --- a/lib/roken/strerror.c +++ b/lib/roken/strerror.c @@ -41,8 +41,9 @@ RCSID("$Id$"); #endif -#include +#include #include +#include extern int sys_nerr; extern char *sys_errlist[]; diff --git a/lib/roken/strtok_r.c b/lib/roken/strtok_r.c index 2cee81870..b6ca9abce 100644 --- a/lib/roken/strtok_r.c +++ b/lib/roken/strtok_r.c @@ -43,6 +43,8 @@ RCSID("$Id$"); #include +#include "roken.h" + char * strtok_r(char *s1, const char *s2, char **lasts) { diff --git a/lib/sl/sl.c b/lib/sl/sl.c index 46192778e..b6e4fd68b 100644 --- a/lib/sl/sl.c +++ b/lib/sl/sl.c @@ -135,7 +135,7 @@ sl_loop (SL_cmd *cmds, char *prompt) ptr = malloc(max_count * sizeof(*ptr)); if (ptr == NULL) { printf ("sl_loop: failed to allocate %u bytes of memory\n", - max_count * sizeof(*ptr)); + (int) max_count * sizeof(*ptr)); return -1; } @@ -164,7 +164,7 @@ sl_loop (SL_cmd *cmds, char *prompt) if (ptr == NULL) { printf ("sl_loop: failed to allocate %u " "bytes of memory\n", - max_count * sizeof(*ptr)); + (int) max_count * sizeof(*ptr)); return -1; } }