openbsd-ports/sysutils/tcplist/patches/patch-utils_c
sthen 5c54bb26a9 - add upstream patches (missing ntohl, adjust lsof parsing)
- add missing prototype
- unbreak lsof command line
- mark BROKEN on lp64

considering between these problems this port was totally useless, so
presumably nobody actually uses this and is a good candidate for removal.
2012-01-17 17:08:16 +00:00

121 lines
2.6 KiB
Plaintext

$OpenBSD: patch-utils_c,v 1.3 2012/01/17 17:08:16 sthen Exp $
--- utils.c.orig Tue Jan 17 16:44:32 2012
+++ utils.c Tue Jan 17 16:44:32 2012
@@ -17,7 +17,7 @@ static char rcsid[] = "$Id: utils.c,v 1.6 1997/04/24 1
#else
#include <strings.h>
#endif
-#include <varargs.h>
+#include <stdarg.h>
#include "utils.h"
#ifdef lint
@@ -42,14 +42,11 @@ extern int d;
* follows it.
*/
/*VARARGS*/
-void Error(va_alist)
-va_dcl
+void Error(const char *format, ...)
{
va_list args;
- char *format;
- va_start(args);
- format = va_arg(args, char *);
+ va_start(args, format);
(void)fprintf(stderr, "%s: ", progname);
(void)vfprintf(stderr, format, args);
(void)fprintf(stderr, "\n");
@@ -63,18 +60,11 @@ va_dcl
* is equal to or greater than the debugging level.
*/
/*VARARGS*/
-void dfprintf(va_alist)
-va_dcl
+void dfprintf(int debugLevel, FILE *stream, const char *format, ...)
{
va_list args;
- int debugLevel;
- FILE *stream;
- char *format;
- va_start(args);
- debugLevel = va_arg(args, int);
- stream = va_arg(args, FILE *);
- format = va_arg(args, char *);
+ va_start(args, format);
if(d >= debugLevel){
(void)vfprintf(stream, format, args);
}
@@ -85,14 +75,11 @@ va_dcl
* Warning(): behaves like Error, except returns rather than exits.
*/
/*VARARGS*/
-void Warning(va_alist)
-va_dcl
+void Warning(const char *format, ...)
{
va_list args;
- char *format;
- va_start(args);
- format = va_arg(args, char *);
+ va_start(args, format);
(void)fprintf(stderr, "%s: ", progname);
(void)vfprintf(stderr, format, args);
(void)fprintf(stderr, "\n");
@@ -186,22 +173,16 @@ int line;
* in malloc'ed space.
*/
/*VARARGS*/
-char *cat(va_alist)
-va_dcl
+char *cat(char *one, ...)
{
va_list args;
unsigned length=1;
char *str, *newstr;
/* get length */
- va_start(args);
- loop{
- str = va_arg(args, char *);
- if(NULL!=str){
- length+=strlen(str);
- } else {
- break;
- }
+ va_start(args, one);
+ for (str = one; str != NULL; str = va_arg(args, char *)) {
+ length+=strlen(str);
}
va_end(args);
@@ -211,14 +192,9 @@ va_dcl
newstr[0]=(char)0;
/* create string */
- va_start(args);
- loop{
- str = va_arg(args, char *);
- if(NULL!=str) {
- (void)strcat(newstr, str);
- } else {
- break;
- }
+ va_start(args, one);
+ for (str = one; str != NULL; str = va_arg(args, char *)) {
+ (void)strcat(newstr, str);
}
va_end(args);
#ifdef lint
@@ -259,6 +235,7 @@ int hostresolv;
lastfail++;
}
}
+ iaddr=ntohl(iaddr);
sprintf(iaddrbuff, "%u.%u.%u.%u", (iaddr>>24)&0xff,
(iaddr>>16)&0xff, (iaddr>>8)&0xff,
iaddr&0xff);