summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authornagappan <nagappan>2005-05-19 05:50:55 +0000
committernagappan <nagappan>2005-05-19 05:50:55 +0000
commit51b30357eec88a30b022998b8c4c936a322c1cbb (patch)
treec8ef364efb3ca734d941871eb7a3c3340405078d /utils.c
Initial revision
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/utils.c b/utils.c
new file mode 100644
index 0000000..0437deb
--- /dev/null
+++ b/utils.c
@@ -0,0 +1,65 @@
+/*
+ * Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp
+ *
+ * Author:
+ * Nagappan A <anagappan@novell.com>
+ *
+ * Copyright 2004 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#define _GNU_SOURCE
+
+#include "appmap-gen.h"
+#include "utils.h"
+
+char *strip_white_space (char *data)
+{
+ int i;
+ int j = 0;
+ char *stripped_data = NULL;
+
+ stripped_data = (char *) malloc (sizeof (char) * strlen (data) + 1);
+
+ for (i = 0; i < strlen (data); i++)
+ {
+ if (data[i] != ' ')
+ stripped_data[j++] = data[i];
+ }
+ stripped_data[j] = '\0';
+ return stripped_data;
+}
+
+char *strip_delim (char *data, char delim)
+{
+ int i;
+ int j = 0;
+ char *stripped_data = NULL;
+
+ stripped_data = (char *) malloc (sizeof (char) * strlen (data) + 1);
+
+ for (i = 0; i < strlen (data); i++)
+ {
+ if (data[i] == delim)
+ {
+ break;
+ }
+ stripped_data[j++] = data[i];
+ }
+ stripped_data[j] = '\0';
+ return stripped_data;
+}