aboutsummaryrefslogtreecommitdiffstats
path: root/net/imm
diff options
context:
space:
mode:
authorlinimon <linimon@FreeBSD.org>2004-08-23 15:36:54 +0800
committerlinimon <linimon@FreeBSD.org>2004-08-23 15:36:54 +0800
commit4c293ae8af7c70049644a4b6d7c080fc1f304435 (patch)
tree00dfc369f74482fec74c381f67e39eaa72df00ec /net/imm
parentbfce7177706f0f0354dd285116819de26e95f6c7 (diff)
downloadfreebsd-ports-gnome-4c293ae8af7c70049644a4b6d7c080fc1f304435.tar.gz
freebsd-ports-gnome-4c293ae8af7c70049644a4b6d7c080fc1f304435.tar.zst
freebsd-ports-gnome-4c293ae8af7c70049644a4b6d7c080fc1f304435.zip
Fix build on 5.x.
PR: ports/69091 Submitted by: Samy Al Bahra <samy at kerneled dot org> Approved by: maintainer timeout (1 month)
Diffstat (limited to 'net/imm')
-rw-r--r--net/imm/Makefile4
-rw-r--r--net/imm/files/patch-src::utils.c200
2 files changed, 200 insertions, 4 deletions
diff --git a/net/imm/Makefile b/net/imm/Makefile
index 942d9af704bc..9cf49cf2e12a 100644
--- a/net/imm/Makefile
+++ b/net/imm/Makefile
@@ -22,10 +22,6 @@ USE_X_PREFIX= yes
.include <bsd.port.pre.mk>
-.if ${OSVERSION} >= 501000
-BROKEN= "Does not compile on FreeBSD ${OSVERSION}"
-.endif
-
post-extract:
@${MKDIR} ${WRKSRC}/freebsd
@${CP} ${FILESDIR}/Makefile.work ${WRKSRC}/Makefile
diff --git a/net/imm/files/patch-src::utils.c b/net/imm/files/patch-src::utils.c
new file mode 100644
index 000000000000..a7db5d4e2d04
--- /dev/null
+++ b/net/imm/files/patch-src::utils.c
@@ -0,0 +1,200 @@
+--- src/utils.c.orig Thu Jul 15 12:37:25 2004
++++ src/utils.c Thu Jul 15 13:36:09 2004
+@@ -20,7 +20,7 @@
+ * These notices must be retained in any copies of any part of this software.
+ ******************************************************************************/
+ #include <stdio.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #ifdef __NetBSD__
+@@ -40,47 +40,118 @@
+
+ /*----------------------------------------------------------------------------*/
+
+-void warn( va_alist )
+-va_dcl
++/* Allocate memory for format string buffers */
++int
++vfsalloc(char *fmt, va_list ap)
+ {
+- va_list args;
+- char *fmt;
++ char *s;
++ int i, n = 0, len = 0;
+
+- va_start( args );
+- fmt = va_arg( args, char * );
+- fprintf( stderr, "Warning: " );
+- vfprintf( stderr, fmt, args );
+- va_end( args );
++ if (!fmt)
++ return 0;
++
++ s = strchr(fmt, '%');
++
++ while (s) {
++ ++s;
++ ++n;
++
++ switch (*s) {
++ case 'd':
++ i = va_arg(ap, int);
++ len += 1 + sizeof(int)<<1;
++ break;
++ case 's':
++ len += strlen(va_arg(ap, char *));
++ break;
++ }
++ s = strchr(s, '%');
++ }
++
++ len += strlen(fmt) - (2 * n);
++
++ return len;
++}
++
++void warn( char *fmt, ... )
++{
++ va_list ap;
++ char *buf, *s;
++ int len;
++
++ if (!fmt)
++ return;
++
++ va_start(ap, fmt);
++ if (!(len = vfsalloc(fmt, ap)))
++ return;
++ va_end(ap);
++
++ if (!(buf = malloc(len)))
++ return;
++
++ va_start(ap, fmt);
++ vsprintf(buf, fmt, ap);
++ va_end(ap);
++
++ fprintf(stderr, "Warning: %s\n", buf);
++ free(buf);
+ }
+
+ /*----------------------------------------------------------------------------*/
+
+-void die( va_alist )
+-va_dcl
++void die(char *fmt, ... )
+ {
+- va_list args;
+- char *fmt;
++ va_list ap;
++ char *buf, *s;
++ int len;
++
++ if (!fmt)
++ return;
++
++ va_start(ap, fmt);
++ if (!(len = vfsalloc(fmt, ap)))
++ return;
++ va_end(ap);
++
++ if (!(buf = malloc(len)))
++ return;
+
+- va_start( args );
+- fmt = va_arg( args, char * );
+- fprintf( stderr, "Error: " );
+- vfprintf( stderr, fmt, args );
+- exit( 1 );
++ va_start(ap, fmt);
++ vsprintf(buf, fmt, ap);
++ va_end(ap);
++
++ fprintf(stderr, "Error: %s\n", buf);
++ free(buf);
++ exit(1);
+ }
+
+ /*----------------------------------------------------------------------------*/
+
+-void fatal( va_alist )
+-va_dcl
++void fatal(char *fmt, ... )
+ {
+- va_list args;
+- char *fmt;
++ va_list ap;
++ char *buf, *s;
++ int len;
++
++ if (!fmt)
++ return;
+
+- va_start( args );
+- fmt = va_arg( args, char * );
+- fprintf( stderr, "Internal Error: " );
+- vfprintf( stderr, fmt, args );
+- exit( 2 );
++ va_start(ap, fmt);
++ if (!(len = vfsalloc(fmt, ap)))
++ return;
++ va_end(ap);
++
++ if (!(buf = malloc(len)))
++ return;
++
++ va_start(ap, fmt);
++ vsprintf(buf, fmt, ap);
++ va_end(ap);
++
++ fprintf(stderr, "Internal error: %s\n", buf);
++ free(buf);
++ exit(2);
+ }
+
+ /*----------------------------------------------------------------------------*/
+@@ -142,21 +213,34 @@
+
+ /*----------------------------------------------------------------------------*/
+
+-void mailmessage( va_alist )
+-va_dcl
++void mailmessage(char *fmt, ... )
+ {
+- va_list args;
+- char *fmt;
++ va_list ap;
++ char *buf, s;
++ int len;
+ FILE *popen(), *fp;
+ char cmdline[80];
+ if (whome == NULL) whome = getlogin();
+ sprintf(cmdline,"%s %s",mailprog,whome);
+ fp = popen(cmdline,"w");
+- va_start( args );
+- fmt = va_arg( args, char * );
+- fprintf( fp, "MNM Warning: " );
+- vfprintf( fp, fmt, args );
+- va_end( args );
++
++ if (!fmt)
++ return;
++
++ va_start(ap, fmt);
++ if (!(len = vfsalloc(fmt, ap)))
++ return;
++ va_end(ap);
++
++ if (!(buf = malloc(len)))
++ return;
++
++ va_start(ap, fmt);
++ vsprintf(buf, fmt, ap);
++ va_end(ap);
++
++ fprintf(fp, "MNM Warning: %s", buf);
++ free(buf);
+ pclose(fp);
+ }