aboutsummaryrefslogtreecommitdiff
path: root/src/misc.c
blob: 9a38e637ce5276eb892d8b4e2fad829077caa3f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <string.h>

/* 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;
}