Przeglądaj źródła

pastime: convert from varargs to stdarg

Ralf S. Engelschall 23 lat temu
rodzic
commit
27aa328a4f
2 zmienionych plików z 272 dodań i 1 usunięć
  1. 269 0
      radius/radius.patch
  2. 3 1
      radius/radius.spec

+ 269 - 0
radius/radius.patch

@@ -0,0 +1,269 @@
+--- include/log.h.orig	Tue Mar 19 15:32:00 2002
++++ include/log.h	Fri Jun 13 10:52:25 2003
+@@ -111,7 +111,7 @@
+ void initlog(char*);
+ void radlog_open(int category);
+ void radlog_close();
+-void radlog(/*int, char *, ...*/);
++void radlog(int, char *, ...);
+ int __insist_failure(char *, char *, int);
+ 
+ /* Debugging facilities */
+@@ -137,7 +137,7 @@
+ #endif
+ 
+ void _debug_print(char *file, int line, char *func_name, char *str);
+-char *_debug_format_string(/* char *fmt, ... */);
++char *_debug_format_string(char *fmt, ... );
+ 	
+ /* Parsing */	
+ 
+--- include/radiusd.h.orig	Mon Aug  5 15:25:12 2002
++++ include/radiusd.h	Fri Jun 13 10:56:16 2003
+@@ -166,9 +166,9 @@
+ #define stat_inc(m,a,c) \
+  do {\
+ 	NAS *nas;\
+-	server_stat->##m . ##c ++;\
++	server_stat->m.c++;\
+ 	if ((nas = nas_lookup_ip(a)) != NULL && nas->app_data)\
+-		((struct nas_stat*)nas->app_data)-> ##m . ##c ++;\
++		((struct nas_stat*)nas->app_data)->m.c++;\
+  } while (0)
+ 
+ extern struct radstat radstat;
+--- include/display.h.orig	Tue Mar 19 15:32:00 2002
++++ include/display.h	Fri Jun 13 11:00:09 2003
+@@ -34,4 +34,4 @@
+ void scroll(int);
+ void page(int);
+ void clearmsg();
+-int msg();
++int msg(int, char *, ...);
+--- radlib/debug.c.orig	Tue Mar 19 15:32:02 2002
++++ radlib/debug.c	Fri Jun 13 10:40:36 2003
+@@ -31,7 +31,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <time.h>
+ #include <errno.h>
+ #include <string.h>
+--- radlib/logger.c.orig	Tue Mar 19 15:32:02 2002
++++ radlib/logger.c	Fri Jun 13 10:53:05 2003
+@@ -27,7 +27,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <time.h>
+ #include <errno.h>
+ #include <string.h>
+@@ -35,36 +35,27 @@
+ 
+ /*PRINTFLIKE2*/
+ void
+-radlog(lvl, msg, va_alist)
+-	int lvl;
+-	char *msg;
+-	va_dcl
++radlog(int lvl, char *msg, ...)
+ {
+ 	va_list ap;
+ 	int ec = 0;
+ 
+ 	if (lvl & L_PERROR)
+ 		ec = errno;
+-	va_start(ap);
++	va_start(ap, msg);
+ 	vlog(lvl, NULL, 0, NULL, ec, msg, ap);
+ 	va_end(ap);
+ }
+ 
+ void
+-_dolog(level, file, line, func_name, fmt, va_alist)
+-	int level;
+-	char *file;
+-	int line;
+-	char *func_name;
+-	char *fmt;
+-	va_dcl
++_dolog(int level, char *file, int line, char *func_name, char *fmt, ...)
+ {
+ 	va_list ap;
+ 	int ec = 0;
+ 	
+ 	if (level & L_PERROR)
+ 		ec = errno;
+-	va_start(ap);
++	va_start(ap, fmt);
+ 	vlog(level, file, line, func_name, ec, fmt, ap);
+ 	va_end(ap);
+ }
+@@ -81,15 +72,12 @@
+ }
+ 
+ char *
+-_debug_format_string(va_alist)
+-	va_dcl
++_debug_format_string(char *fmt, ...)
+ {
+ 	va_list ap;
+-	char *fmt;
+ 	char *str = NULL;
+ 	
+-	va_start(ap);
+-	fmt = va_arg(ap,char*);
++	va_start(ap, fmt);
+ 	vasprintf(&str, fmt, ap);
+ 	va_end(ap);
+ 	return str;
+--- radlib/applog.c.orig	Tue Mar 19 15:32:02 2002
++++ radlib/applog.c	Fri Jun 13 10:53:43 2003
+@@ -27,7 +27,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <time.h>
+ #include <errno.h>
+ #include <string.h>
+--- radiusd/log.c.orig	Tue Mar 19 15:32:00 2002
++++ radiusd/log.c	Fri Jun 13 10:56:47 2003
+@@ -23,7 +23,7 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <errno.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <syslog.h>
+ #include <radiusd.h>
+ #include <log.h>
+--- radiusd/rewrite.y.orig	Wed Jul 31 13:56:18 2002
++++ radiusd/rewrite.y	Fri Jun 13 10:57:52 2003
+@@ -28,7 +28,7 @@
+ #include <radiusd.h>
+ #include <symtab.h>
+ #include <setjmp.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <obstack1.h>
+ #include <argcv.h>
+ #include <rewrite.h>
+@@ -4590,11 +4590,7 @@
+ 
+ /*VARARGS3*/
+ int
+-va_run_init(name, request, typestr, va_alist)
+-        char *name;
+-        VALUE_PAIR *request;
+-        char *typestr;
+-        va_dcl
++va_run_init(char *name, VALUE_PAIR *request, char *typestr, ...)
+ {
+         FILE *fp;
+         va_list ap;
+@@ -4626,7 +4622,7 @@
+ 
+         /* Pass arguments */
+         nargs = 0;
+-        va_start(ap);
++        va_start(ap, typestr);
+         while (*typestr) {
+                 nargs++;
+                 switch (*typestr++) {
+--- radiusd/snmpserv.c.orig	Tue Mar 19 15:32:00 2002
++++ radiusd/snmpserv.c	Fri Jun 13 10:58:11 2003
+@@ -28,7 +28,7 @@
+ 
+ #include <sys/types.h>
+ #include <sys/socket.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <asn1.h>
+ #include <snmp.h>
+ #include <mib.h>
+--- raduse/raduse.c.orig	Wed Mar 20 12:35:13 2002
++++ raduse/raduse.c	Fri Jun 13 10:58:40 2003
+@@ -60,7 +60,7 @@
+         PORT_STAT *port;
+ } port_usage_t;
+ 
+-#define AP(p,m) (((port_usage_t*)(p)->app_data)-> ##m)
++#define AP(p,m) (((port_usage_t*)(p)->app_data)->m)
+ 
+ /* various options */
+ int width = 5;            /* width for time output (5 - hh:mm, 8 - hh:mm:ss) */
+--- raduse/display.c.orig	Tue Mar 19 15:32:04 2002
++++ raduse/display.c	Fri Jun 13 11:00:10 2003
+@@ -26,7 +26,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <ctype.h>
+ #include <log.h>
+ #include <mem.h>
+@@ -139,16 +139,13 @@
+ 
+ 
+ /*VARARGS2*/
+-msg(type, msgfmt, va_alist)
+-	int             type;
+-        char           *msgfmt;
+-	va_dcl
++int msg(int type, char *msgfmt, ...)
+ {
+ 	register int    i;
+ 	va_list ap;
+ 	char next_msg[128];
+ 	
+-	va_start(ap);
++	va_start(ap, msgfmt);
+ 
+ 	next_msg[0] = ' ';
+ 	i = 1 + vsprintf(next_msg+1, msgfmt, ap);
+--- radtest/gram.y.orig	Wed Aug 14 16:11:13 2002
++++ radtest/gram.y	Fri Jun 13 11:00:49 2003
+@@ -41,7 +41,7 @@
+ #include <signal.h>
+ #include <errno.h>
+ #include <sys/wait.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <sysdep.h>
+ #include <radius.h>
+ #include <radclient.h>
+@@ -368,14 +368,11 @@
+ }
+ 
+ void
+-parse_error(va_alist)
+-        va_dcl
++parse_error(char *fmt, ...)
+ {
+         va_list ap;
+-        char *fmt;
+         
+-        va_start(ap);
+-        fmt = va_arg(ap, char*);
++        va_start(ap, fmt);
+         fprintf(stderr, "%s:%d: ", source_filename, source_line_num);
+         vfprintf(stderr, fmt, ap);
+         va_end(ap);
+--- radtest/radtest.h.orig	Tue Mar 19 15:32:04 2002
++++ radtest/radtest.h	Fri Jun 13 11:01:07 2003
+@@ -69,7 +69,7 @@
+ int open_input(char *name);
+ void close_input();
+ void set_yydebug();
+-void parse_error();
++void parse_error(char *fmt, ...);
+ void print(Variable *var);
+ void radtest_send(int port, int code, Variable *var);
+ void putback(char *str);

+ 3 - 1
radius/radius.spec

@@ -33,11 +33,12 @@ Distribution: OpenPKG [PLUS]
 Group:        Network
 License:      GPL
 Version:      0.96.4
-Release:      20030115
+Release:      20030613
 
 #   list of sources
 Source0:      ftp://ftp.gnu.org/gnu/radius/gnu-radius-%{version}.tar.gz
 Source1:      rc.radius
+Patch0:       radius.patch
 
 #   build information
 Prefix:       %{l_prefix}
@@ -56,6 +57,7 @@ AutoReqProv:  no
 
 %prep
     %setup -q -n gnu-radius-%{version}
+    %patch -p0
 
 %build
     CC="%{l_cc}" \