Module Name:    src
Committed By:   kamil
Date:           Fri Jun 23 00:18:01 UTC 2017

Modified Files:
        src/bin/ksh: io.c lex.c sh.h shf.c tree.c

Log Message:
ksh: Use ANSI C varargs, drop support for older version <varargs.h>


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/io.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/lex.c
cvs rdiff -u -r1.27 -r1.28 src/bin/ksh/sh.h
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/shf.c
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/io.c
diff -u src/bin/ksh/io.c:1.13 src/bin/ksh/io.c:1.14
--- src/bin/ksh/io.c:1.13	Thu Jun 22 19:41:07 2017
+++ src/bin/ksh/io.c	Fri Jun 23 00:18:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.13 2017/06/22 19:41:07 kamil Exp $	*/
+/*	$NetBSD: io.c,v 1.14 2017/06/23 00:18:01 kamil Exp $	*/
 
 /*
  * shell buffered IO and formatted output
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: io.c,v 1.13 2017/06/22 19:41:07 kamil Exp $");
+__RCSID("$NetBSD: io.c,v 1.14 2017/06/23 00:18:01 kamil Exp $");
 #endif
 
 
@@ -37,7 +37,7 @@ errorf(fmt, va_alist)
 	exstat = 1;
 	if (*fmt) {
 		error_prefix(TRUE);
-		SH_VA_START(va, fmt);
+		va_start(va, fmt);
 		shf_vfprintf(shl_out, fmt, va);
 		va_end(va);
 		shf_putchar('\n', shl_out);
@@ -60,7 +60,7 @@ warningf(fileline, fmt, va_alist)
 	va_list va;
 
 	error_prefix(fileline);
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_out, fmt, va);
 	va_end(va);
 	shf_putchar('\n', shl_out);
@@ -88,7 +88,7 @@ bi_errorf(fmt, va_alist)
 		/* not set when main() calls parse_args() */
 		if (builtin_argv0)
 			shf_fprintf(shl_out, "%s: ", builtin_argv0);
-		SH_VA_START(va, fmt);
+		va_start(va, fmt);
 		shf_vfprintf(shl_out, fmt, va);
 		va_end(va);
 		shf_putchar('\n', shl_out);
@@ -121,7 +121,7 @@ internal_errorf(jump, fmt, va_alist)
 
 	error_prefix(TRUE);
 	shf_fprintf(shl_out, "internal error: ");
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_out, fmt, va);
 	va_end(va);
 	shf_putchar('\n', shl_out);
@@ -160,7 +160,7 @@ shellf(fmt, va_alist)
 
 	if (!initio_done) /* shl_out may not be set up yet... */
 		return;
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_out, fmt, va);
 	va_end(va);
 	shf_flush(shl_out);
@@ -180,7 +180,7 @@ shprintf(fmt, va_alist)
 
 	if (!shl_stdout_ok)
 		internal_errorf(1, "shl_stdout not valid");
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_stdout, fmt, va);
 	va_end(va);
 }
@@ -216,7 +216,7 @@ kshdebug_printf_(fmt, va_alist)
 
 	if (!kshdebug_shf)
 		return;
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_fprintf(kshdebug_shf, "[%d] ", getpid());
 	shf_vfprintf(kshdebug_shf, fmt, va);
 	va_end(va);

Index: src/bin/ksh/lex.c
diff -u src/bin/ksh/lex.c:1.18 src/bin/ksh/lex.c:1.19
--- src/bin/ksh/lex.c:1.18	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/lex.c	Fri Jun 23 00:18:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.c,v 1.18 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: lex.c,v 1.19 2017/06/23 00:18:01 kamil Exp $	*/
 
 /*
  * lexical analysis and source input
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: lex.c,v 1.18 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: lex.c,v 1.19 2017/06/23 00:18:01 kamil Exp $");
 #endif
 
 
@@ -852,7 +852,7 @@ yyerror(fmt, va_alist)
 	source->str = null;	/* zap pending input */
 
 	error_prefix(TRUE);
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_out, fmt, va);
 	va_end(va);
 	errorf("%s", null);

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.27 src/bin/ksh/sh.h:1.28
--- src/bin/ksh/sh.h:1.27	Fri Jun 23 00:09:36 2017
+++ src/bin/ksh/sh.h	Fri Jun 23 00:18:01 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.27 2017/06/23 00:09:36 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.28 2017/06/23 00:18:01 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.27 2017/06/23 00:09:36 kamil Exp $ */
+/* $Id: sh.h,v 1.28 2017/06/23 00:18:01 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -23,15 +23,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-
-#ifdef HAVE_PROTOTYPES
-# include <stdarg.h>
-# define SH_VA_START(va, argn) va_start(va, argn)
-#else
-# include <varargs.h>
-# define SH_VA_START(va, argn) va_start(va)
-#endif /* HAVE_PROTOTYPES */
-
+#include <stdarg.h>
 #include <errno.h>
 #include <fcntl.h>
 

Index: src/bin/ksh/shf.c
diff -u src/bin/ksh/shf.c:1.10 src/bin/ksh/shf.c:1.11
--- src/bin/ksh/shf.c:1.10	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/shf.c	Fri Jun 23 00:18:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: shf.c,v 1.10 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: shf.c,v 1.11 2017/06/23 00:18:01 kamil Exp $	*/
 
 /*
  *  Shell file I/O routines
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: shf.c,v 1.10 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: shf.c,v 1.11 2017/06/23 00:18:01 kamil Exp $");
 #endif
 
 
@@ -770,7 +770,7 @@ shf_fprintf(shf, fmt, va_alist)
 	va_list args;
 	int n;
 
-	SH_VA_START(args, fmt);
+	va_start(args, fmt);
 	n = shf_vfprintf(shf, fmt, args);
 	va_end(args);
 
@@ -797,7 +797,7 @@ shf_snprintf(buf, bsize, fmt, va_alist)
 			(long) buf, bsize);
 
 	shf_sopen(buf, bsize, SHF_WR, &shf);
-	SH_VA_START(args, fmt);
+	va_start(args, fmt);
 	n = shf_vfprintf(&shf, fmt, args);
 	va_end(args);
 	shf_sclose(&shf); /* null terminates */
@@ -817,7 +817,7 @@ shf_smprintf(fmt, va_alist)
 	va_list args;
 
 	shf_sopen((char *) 0, 0, SHF_WR|SHF_DYNAMIC, &shf);
-	SH_VA_START(args, fmt);
+	va_start(args, fmt);
 	shf_vfprintf(&shf, fmt, args);
 	va_end(args);
 	return shf_sclose(&shf); /* null terminates */

Index: src/bin/ksh/tree.c
diff -u src/bin/ksh/tree.c:1.6 src/bin/ksh/tree.c:1.7
--- src/bin/ksh/tree.c:1.6	Sun Jun 26 19:09:00 2005
+++ src/bin/ksh/tree.c	Fri Jun 23 00:18:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.6 2005/06/26 19:09:00 christos Exp $	*/
+/*	$NetBSD: tree.c,v 1.7 2017/06/23 00:18:01 kamil Exp $	*/
 
 /*
  * command tree climbing
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: tree.c,v 1.6 2005/06/26 19:09:00 christos Exp $");
+__RCSID("$NetBSD: tree.c,v 1.7 2017/06/23 00:18:01 kamil Exp $");
 #endif
 
 
@@ -387,7 +387,7 @@ fptreef(shf, indent, fmt, va_alist)
 {
   va_list	va;
 
-  SH_VA_START(va, fmt);
+  va_start(va, fmt);
 
   vfptreef(shf, indent, fmt, va);
   va_end(va);
@@ -411,7 +411,7 @@ snptreef(s, n, fmt, va_alist)
 
   shf_sopen(s, n, SHF_WR | (s ? 0 : SHF_DYNAMIC), &shf);
 
-  SH_VA_START(va, fmt);
+  va_start(va, fmt);
   vfptreef(&shf, 0, fmt, va);
   va_end(va);
 

Reply via email to