summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-05-08 20:27:25 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-05-08 20:27:25 +0000
commit387c472660ef173c2e469e70eb1a25d47f6e8887 (patch)
tree4686516a373bbb5ca9594c4cb285aedc6a72aa8d /misc.c
parent69128668938c82e8d428e77726ef00b2b6f799b9 (diff)
- mouring@cvs.openbsd.org 2001/05/08 19:45:25
[misc.c misc.h scp.c sftp.c] Use addargs() in sftp plus some clean up of addargs(). OK Markus
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/misc.c b/misc.c
index e949ded8..d12bcefe 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.6 2001/05/03 23:09:52 mouring Exp $ */
+/* $OpenBSD: misc.c,v 1.7 2001/05/08 19:45:24 mouring Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: misc.c,v 1.6 2001/05/03 23:09:52 mouring Exp $");
+RCSID("$OpenBSD: misc.c,v 1.7 2001/05/08 19:45:24 mouring Exp $");
#include "misc.h"
#include "log.h"
@@ -164,6 +164,27 @@ colon(char *cp)
return (0);
}
+void
+addargs(arglist *args, char *fmt, ...)
+{
+ va_list ap;
+ char buf[1024];
+
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+
+ if (args->list == NULL) {
+ args->nalloc = 32;
+ args->num = 0;
+ } else if (args->num+2 >= args->nalloc)
+ args->nalloc *= 2;
+
+ args->list = xrealloc(args->list, args->nalloc * sizeof(char *));
+ args->list[args->num++] = xstrdup(buf);
+ args->list[args->num] = NULL;
+}
+
mysig_t
mysignal(int sig, mysig_t act)
{