Loading...
--- Libc/Libc-1725.40.4/man/FreeBSD/stdarg.3
+++ Libc/Libc-583/man/FreeBSD/stdarg.3
@@ -74,21 +74,13 @@
.Pp
The
.Fn va_start
-macro must be called first, and it initializes
-.Fa ap ,
-which can be passed to
-.Fn va_arg
-for each argument to be processed.
-Calling
-.Fn va_end
-signals that there are no further arguments, and causes
+macro initializes
.Fa ap
-to be invalidated.
-Note that each call to
-.Fn va_start
-must be matched by a call to
+for subsequent use by
+.Fn va_arg
+and
.Fn va_end ,
-from within the same function.
+and must be called first.
.Pp
The parameter
.Fa last
@@ -99,6 +91,10 @@
.Fn va_start
macro, it should not be declared as a register variable, or as a
function or an array type.
+.Pp
+The
+.Fn va_start
+macro returns no value.
.Pp
The
.Fn va_arg
@@ -140,38 +136,34 @@
.Pp
The
.Fn va_copy
-macro copies the state of the variable argument list,
+macro copies a variable argument list, previously initialized by
+.Fn va_start ,
+from
+.Fa src
+to
+.Fa dest .
+The state is preserved such that it is equivalent to calling
+.Fn va_start
+with the same second argument used with
.Fa src ,
-previously initialized by
-.Fn va_start ,
-to the variable argument list,
-.Fa dest ,
-which must not have been previously initialized by
-.Fn va_start ,
-without an intervening call to
-.Fn va_end .
-The state preserved in
-.Fa dest
-is equivalent to calling
-.Fn va_start
-and
-.Fn va_arg
-on
-.Fa dest
-in the same way as was used on
+and calling
+.Fn va_arg
+the same number of times as called with
.Fa src .
-The copied variable argument list can subsequently be passed to
-.Fn va_arg ,
-and must finally be passed to
+.Pp
+The
+.Fn va_copy
+macro returns no value.
+.Pp
+The
.Fn va_end
-when through with it.
-.Pp
-After a variable argument list is invalidated by
-.Fn va_end ,
-it can be reinitialized with
-.Fn va_start
-or made a copy of another variable argument list with
-.Fn va_copy .
+macro handles a normal return from the function whose variable argument
+list was initialized by
+.Fn va_start .
+.Pp
+The
+.Fn va_end
+macro returns no value.
.Sh EXAMPLES
The function
.Em foo
@@ -180,12 +172,11 @@
.Bd -literal -offset indent
void foo(char *fmt, ...)
{
- va_list ap, ap2;
+ va_list ap;
int d;
char c, *s;
va_start(ap, fmt);
- va_copy(ap2, ap);
while (*fmt)
switch(*fmt++) {
case 's': /* string */
@@ -203,10 +194,6 @@
break;
}
va_end(ap);
- ...
- /* use ap2 to iterate over the arguments again */
- ...
- va_end(ap2);
}
.Ed
.Sh COMPATIBILITY