diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2019-10-06 15:53:52 +0100 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2019-10-06 15:53:52 +0100 |
| commit | e77b371fb0fc4e62fa727a340b2e322fa60ebcff (patch) | |
| tree | 78a278b63831a856e8d39bace88d12bb3a5a9b60 /os/stdlib | |
| parent | 64aa82592c6c2b043d8c62100d4ce110bf616c1e (diff) | |
| download | tinyOS-e77b371fb0fc4e62fa727a340b2e322fa60ebcff.tar.xz tinyOS-e77b371fb0fc4e62fa727a340b2e322fa60ebcff.zip | |
Add command parsing and echo commandadd-shell
Diffstat (limited to 'os/stdlib')
| -rw-r--r-- | os/stdlib/sdtlib.h | 3 | ||||
| -rw-r--r-- | os/stdlib/stdlib.c | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/os/stdlib/sdtlib.h b/os/stdlib/sdtlib.h index a0b3402..85073d2 100644 --- a/os/stdlib/sdtlib.h +++ b/os/stdlib/sdtlib.h @@ -1 +1,2 @@ -char* int_to_str(int i);
\ No newline at end of file +char* int_to_str(int i); +int strcmp(const char *str1, const char *str2);
\ No newline at end of file diff --git a/os/stdlib/stdlib.c b/os/stdlib/stdlib.c index 465e978..bdb2242 100644 --- a/os/stdlib/stdlib.c +++ b/os/stdlib/stdlib.c @@ -18,4 +18,18 @@ char* int_to_str(int i) *--p = '-'; } return p; +} + + +int strcmp(const char *str1, const char *str2) +{ + while(*str1){ + if (*str1 != *str2) { + break; + } + str1++; + str2++; + } + + return *(const unsigned char*)str1 - *(const unsigned char*)str2; }
\ No newline at end of file |