From d6144217412b1e51171765c7a9e16086bb3814a3 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Sun, 22 Nov 1998 22:38:18 +0000
Subject: [PATCH] Apply patches from Hallvard and others to remove lint.

---
 clients/fax500/main.c               |  1 +
 clients/fax500/rp500.c              |  1 +
 clients/ud/edit.c                   |  2 +-
 clients/ud/main.c                   | 17 ++++++++---------
 clients/ud/ud.h                     |  2 +-
 clients/ud/util.c                   |  2 +-
 libraries/liblber/etest.c           |  1 +
 libraries/liblber/idtest.c          |  6 +-----
 servers/slapd/tools/ldif2id2entry.c |  3 ++-
 servers/slurpd/proto-slurp.h        |  2 +-
 servers/slurpd/tsleep.c             |  3 ++-
 11 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/clients/fax500/main.c b/clients/fax500/main.c
index 66c3fecc6b..2e1131df4d 100644
--- a/clients/fax500/main.c
+++ b/clients/fax500/main.c
@@ -17,6 +17,7 @@
 
 #include <ac/socket.h>
 #include <ac/string.h>
+#include <ac/ctype.h>
 #include <ac/syslog.h>
 #include <ac/time.h>
 #include <ac/wait.h>
diff --git a/clients/fax500/rp500.c b/clients/fax500/rp500.c
index 5f02cc40e7..9b9c695d16 100644
--- a/clients/fax500/rp500.c
+++ b/clients/fax500/rp500.c
@@ -12,6 +12,7 @@
 
 #include "portable.h"
 
+#include <stdio.h>
 #include <stdlib.h>
 
 #include <ac/ctype.h>
diff --git a/clients/ud/edit.c b/clients/ud/edit.c
index 88fe0b613a..891f2e7c87 100644
--- a/clients/ud/edit.c
+++ b/clients/ud/edit.c
@@ -187,7 +187,7 @@ load_editor( void )
 	}
 	else if (pid > 0) {
 		/* parent - wait until the child proc is done editing */
-		void (*handler)();
+		RETSIGTYPE (*handler)();
 		handler = SIGNAL(SIGINT, SIG_IGN);
 		(void) wait(&status);
 		(void) SIGNAL(SIGINT, handler);
diff --git a/clients/ud/main.c b/clients/ud/main.c
index 83823f8a2f..d22f3ab85b 100644
--- a/clients/ud/main.c
+++ b/clients/ud/main.c
@@ -654,18 +654,13 @@ initialize_client( void )
 #ifndef NO_TERMCAP
 	{
 	char *term;
-	struct winsize win;			/* for tty set-up */
 
 	if (((term = getenv("TERM")) == NULL) || (tgetent(bp, term) <= 0))
 		return;
 	else {
 #ifdef TIOCGWINSZ
-		if (ioctl(fileno(stdout), TIOCGWINSZ, &win) < 0) {
-			lpp = tgetnum("li");
-			col_size = tgetnum("co");
-		} else
-#endif
-		{
+		struct winsize win;		/* for tty set-up */
+		if (ioctl(fileno(stdout), TIOCGWINSZ, &win) >= 0) {
 			if ((lpp = win.ws_row) == 0)
 				lpp = tgetnum("li");
 			if ((col_size = win.ws_col) == 0)
@@ -674,10 +669,14 @@ initialize_client( void )
 				lpp = DEFAULT_TTY_HEIGHT;
 			if ((col_size <= 0) || tgetflag("hc"))
 				col_size = DEFAULT_TTY_WIDTH;
+			(void) SIGNAL (SIGWINCH, chwinsz);
+		} else
+#endif
+		{
+			lpp = tgetnum("li");
+			col_size = tgetnum("co");
 		}
 	}
-	(void) SIGNAL (SIGWINCH, chwinsz);
-
 	}
 #endif
 }
diff --git a/clients/ud/ud.h b/clients/ud/ud.h
index aeea56ae64..a5245479e3 100644
--- a/clients/ud/ud.h
+++ b/clients/ud/ud.h
@@ -230,7 +230,7 @@ void status	LDAP_P(( void ));
 void change_base	LDAP_P(( int type, char **base, char *s ));
 void initialize_client	LDAP_P(( void ));
 RETSIGTYPE  attn	LDAP_P(( int sig ));
-#ifndef NO_TERMCAP
+#if !defined(NO_TERMCAP) && defined(TIOCGWINSZ)
 RETSIGTYPE  chwinsz	LDAP_P(( int sig ));
 #endif
 
diff --git a/clients/ud/util.c b/clients/ud/util.c
index 41a059d425..184cfc8fcc 100644
--- a/clients/ud/util.c
+++ b/clients/ud/util.c
@@ -578,7 +578,7 @@ Malloc( unsigned int size )
 void
 Free( void *ptr )
 {
-#ifndef STDC_HEADERS
+#if 0
 	if (free(ptr) < 0) {
 		perror("free");
 		exit(-1);
diff --git a/libraries/liblber/etest.c b/libraries/liblber/etest.c
index ca1acc742b..e46d506450 100644
--- a/libraries/liblber/etest.c
+++ b/libraries/liblber/etest.c
@@ -23,6 +23,7 @@ static void usage( char *name )
 	fprintf( stderr, "usage: %s fmtstring\n", name );
 }
 
+int
 main( int argc, char **argv )
 {
 #ifdef notdef
diff --git a/libraries/liblber/idtest.c b/libraries/liblber/idtest.c
index a35e098262..8d68fd6036 100644
--- a/libraries/liblber/idtest.c
+++ b/libraries/liblber/idtest.c
@@ -20,11 +20,7 @@
 #include <quipu/attr.h>
 #endif
 
-static usage( char *name )
-{
-	fprintf( stderr, "usage: %s\n", name );
-}
-
+int
 main( int argc, char **argv )
 {
 #ifdef HAVE_PSAP_H
diff --git a/servers/slapd/tools/ldif2id2entry.c b/servers/slapd/tools/ldif2id2entry.c
index 226d8232db..e84ed64802 100644
--- a/servers/slapd/tools/ldif2id2entry.c
+++ b/servers/slapd/tools/ldif2id2entry.c
@@ -173,7 +173,8 @@ main( int argc, char **argv )
 				data.dsize = strlen( buf ) + 1;
 				if ( ldbm_store( db->dbc_db, key, data,
 				    LDBM_INSERT ) != 0 ) {
-					perror( "id2entry ldbm_store" );
+					fputs("id2entry ldbm_store failed\n",
+					      stderr);
 					exit( 1 );
 				}
 			}
diff --git a/servers/slurpd/proto-slurp.h b/servers/slurpd/proto-slurp.h
index c697344028..56e3282902 100644
--- a/servers/slurpd/proto-slurp.h
+++ b/servers/slurpd/proto-slurp.h
@@ -60,7 +60,7 @@ int sanity	LDAP_P((void));
 int St_init	LDAP_P((St **st));
 
 /* tsleep.c */
-void tsleep	LDAP_P((time_t interval));
+int tsleep	LDAP_P((time_t interval));
 #if defined( HAVE_LWP )
 void start_lwp_scheduler LDAP_P(( void ));
 #endif
diff --git a/servers/slurpd/tsleep.c b/servers/slurpd/tsleep.c
index abe606d02a..c21cf7def4 100644
--- a/servers/slurpd/tsleep.c
+++ b/servers/slurpd/tsleep.c
@@ -147,11 +147,12 @@ start_lwp_scheduler( void )
  * Here we assume we have fully preemptive threads, and that sleep()
  * does the right thing.
  */
-void
+int
 tsleep(
     time_t	interval
 )
 {
     sleep( interval );
+    return 0;
 }
 #endif /* !HAVE_LWP */
-- 
GitLab