diff options
author | nagappan <nagappan> | 2005-05-19 05:50:55 +0000 |
---|---|---|
committer | nagappan <nagappan> | 2005-05-19 05:50:55 +0000 |
commit | 51b30357eec88a30b022998b8c4c936a322c1cbb (patch) | |
tree | c8ef364efb3ca734d941871eb7a3c3340405078d /utils.c |
Initial revision
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 65 |
1 files changed, 65 insertions, 0 deletions
@@ -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; +} |