summaryrefslogtreecommitdiff
path: root/ui/util.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2012-06-25 22:21:58 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2012-06-25 22:21:58 +0000
commit9e1359e2fab24df5d56c3e85dfe5ba926faf2eef (patch)
tree3ccaa6090eed579517072a1dc6fcbea16450721c /ui/util.c
parentefbde1c75a5ac52cf228a35d2f91ff61f35659a0 (diff)
downloadwireshark-9e1359e2fab24df5d56c3e85dfe5ba926faf2eef.tar.gz
Revert 43481: linking dftest against libui was not the problem.
svn path=/trunk/; revision=43488
Diffstat (limited to 'ui/util.c')
-rw-r--r--ui/util.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/ui/util.c b/ui/util.c
index e2887e1de4..63863f2097 100644
--- a/ui/util.c
+++ b/ui/util.c
@@ -47,6 +47,45 @@
#include "ui/util.h"
+/*
+ * Collect command-line arguments as a string consisting of the arguments,
+ * separated by spaces.
+ */
+char *
+get_args_as_string(int argc, char **argv, int optindex)
+{
+ int len;
+ int i;
+ char *argstring;
+
+ /*
+ * Find out how long the string will be.
+ */
+ len = 0;
+ for (i = optindex; i < argc; i++) {
+ len += (int) strlen(argv[i]);
+ len++; /* space, or '\0' if this is the last argument */
+ }
+
+ /*
+ * Allocate the buffer for the string.
+ */
+ argstring = (char *)g_malloc(len);
+
+ /*
+ * Now construct the string.
+ */
+ argstring[0] = '\0';
+ i = optindex;
+ for (;;) {
+ g_strlcat(argstring, argv[i], len);
+ i++;
+ if (i == argc)
+ break;
+ g_strlcat(argstring, " ", len);
+ }
+ return argstring;
+}
/* Compute the difference between two seconds/microseconds time stamps. */
void