summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuodong Xu <guodong.xu@linaro.org>2012-08-21 10:12:27 +0800
committerGuodong Xu <guodong.xu@linaro.org>2012-08-21 10:12:27 +0800
commitc8368123ecf2658e989279ac701ba44c0a71922a (patch)
treef19984abcea4c008d1b02eccc5216b7b0fe37019
parent42e92d5c29c8f472365a3e4bc312622ac092ebfa (diff)
add test code to parse comma separated stringworking-stm-test
-rw-r--r--param_array.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/param_array.c b/param_array.c
index ad79f41..4df479f 100644
--- a/param_array.c
+++ b/param_array.c
@@ -208,6 +208,8 @@ int free_param_array(int param_num, char **param_array)
}
#ifdef PARAM_DEBUG_TEST_STUB
+void test_comma(void);
+
int main()
{
char string_array[][100]={
@@ -245,6 +247,24 @@ int main()
free_param_array(param_num, param_array);
}
+ test_comma();
+
return 0;
}
+
+void test_comma(void)
+{
+ char buf[] = "endabled,set,up,lock,success";
+ char *s, *tmp = buf;
+
+ while((s = strchr(tmp, ',')) != NULL){
+ *s = '\0';
+ printf("FOUND: %s\n", tmp);
+ tmp = s + 1;
+ }
+
+ printf("FOUND: %s\n", tmp);
+
+ return;
+}
#endif