git: 88a3eaf413c1 - main - misc/team: Fix compiler complaints

From: Joerg Wunsch <joerg_at_FreeBSD.org>
Date: Wed, 15 Feb 2023 22:41:46 UTC
The branch main has been updated by joerg:

URL: https://cgit.FreeBSD.org/ports/commit/?id=88a3eaf413c1cad272d9e10693efce9e7b5a2c26

commit 88a3eaf413c1cad272d9e10693efce9e7b5a2c26
Author:     Joerg Wunsch <joerg@FreeBSD.org>
AuthorDate: 2023-02-15 22:38:09 +0000
Commit:     Joerg Wunsch <joerg@FreeBSD.org>
CommitDate: 2023-02-15 22:41:34 +0000

    misc/team: Fix compiler complaints
    
    The code used a very old "all arguments are compatible with int"
    method for a varargs message function. Convert it to <stdarg.h>.
    
    While at it, replace a few private library function declarations by
    their appropriate header file includes.
---
 misc/team/Makefile      |  2 +-
 misc/team/files/patch-c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/misc/team/Makefile b/misc/team/Makefile
index 8ccb6a35422b..8e4049d149cd 100644
--- a/misc/team/Makefile
+++ b/misc/team/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	team
 PORTVERSION=	3.1
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	misc
 MASTER_SITES=	LOCAL/joerg
 
diff --git a/misc/team/files/patch-c b/misc/team/files/patch-c
new file mode 100644
index 000000000000..03c89993ed64
--- /dev/null
+++ b/misc/team/files/patch-c
@@ -0,0 +1,62 @@
+--- team.c~	2023-02-15 22:43:13.785130000 +0100
++++ team.c	2023-02-15 23:21:27.257000000 +0100
+@@ -82,6 +82,11 @@
+ #include <errno.h>
+ #include <signal.h>
+ #include <stdio.h>
++#include <stdlib.h>
++#include <stdarg.h>
++#include <string.h>
++#include <unistd.h>
++#include <getopt.h>
+ #include <sys/types.h>
+ #include <sys/file.h>
+ #include <sys/stat.h>
+@@ -151,10 +156,12 @@
+ #endif
+ 
+ /*VARARGS1*/
+-mesg(a,b,c,d,e,f,g,h,i)
+-  char *a;
+-  int b,c,d,e,f,g,h,i;
++int
++mesg(char *a, ...)
+ {
++    va_list ap;
++    va_start(ap, a);
++    int rv;
+ # if (defined F_SETLKW)
+     struct flock l;
+     l.l_whence = 0; l.l_start = 0L; l.l_len = 0L;
+@@ -163,13 +170,16 @@
+ # if (defined LOCK_EX)
+     flock(fileno(stderr),LOCK_EX);
+ # endif
+-  fprintf(stderr,a,b,c,d,e,f,g,h,i);
++    rv = vfprintf(stderr,a,ap);
+ # if (defined LOCK_EX)
+     flock(fileno(stderr),LOCK_UN);
+ # endif
+ # if (defined F_SETLKW)
+     l.l_type = F_UNLCK; fcntl(fileno(stderr),F_SETLKW,&l);
+ # endif
++    va_end(ap);
++
++    return rv;
+ }
+ 
+ local bool		verbose = false;
+@@ -181,13 +191,6 @@
+ 
+ extern time_t		time of((time_t *));
+ extern int		atoi of((const char *));
+-extern char		*malloc of((unsigned));
+-extern char		*calloc of((address,unsigned));
+-extern char		*strchr of((const char *,int));
+-
+-extern int		getopt of((int,char *[],const char *));
+-extern char		*optarg;
+-extern int		optind;
+ 
+ /*
+   The  regular Unix read and write calls are not guaranteed to process