openbsd-ports/sysutils/tcplist/patches/patch-utils_c
2004-01-04 18:58:44 +00:00

113 lines
2.4 KiB
Plaintext

$OpenBSD: patch-utils_c,v 1.1 2004/01/04 18:58:44 espie Exp $
--- utils.c.orig 2004-01-04 19:49:27.000000000 +0100
+++ utils.c 2004-01-04 19:53:29.000000000 +0100
@@ -17,7 +17,7 @@ static char rcsid[] = "$Id: utils.c,v 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