From 2fb784d8ce44979afcb4c7a9b4cc7f17be1c3ba1 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 5 Dec 2010 15:20:03 -0500 Subject: Initial commit --- src/misc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/misc.c diff --git a/src/misc.c b/src/misc.c new file mode 100644 index 0000000..9a38e63 --- /dev/null +++ b/src/misc.c @@ -0,0 +1,15 @@ +#include + +/* Returns the index of the first occurence of ch in str */ +int strind(const char* str, const char ch) +{ + int index = 0; + while(*str != 0 || str == NULL) + { + if(*str == ch) + break; + ++index; + ++str; + } + return index; +} -- cgit