blob: 99566bd92a72fe636e0d426182bea12138f35040 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <stddef.h>
#include "demo.h"
int strcmp(const char *s1, const char *s2)
{
while (*s1 && *s1 == *s2)
s1++, s2++;
return (int)*(const unsigned char *)s1 - (int)*(const unsigned char *)s2;
}
char *strtok_input(char **tokens)
{
char *start = *tokens;
while (*start && *start == ' ')
++start;
if (!*start) {
*tokens = start;
return NULL;
}
char *end = start + 1;
while (*end && *end != ' ')
++end;
*tokens = *end ? end + 1 : end;
*end = '\0';
return start;
}
|