/
dzavalishin
/
pok
Обзор
Документация
Войти
/
dzavalishin
/
pok
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
kernel/libc/strcmp.c
53 строки
1 KB
Samuel Tardieu
Update year in copyright headers
20 мар 2021, 11:30
20 мар 2021, 11:30
71185e2
Код
Авторство
О чём код?
/* * POK header * * The following file is a part of the POK project. Any modification should * be made according to the POK licence. You CANNOT use this file or a part * of a file for your own project. * * For more information on the POK licence, please see our LICENCE FILE * * Please follow the coding guidelines described in doc/CODING_GUIDELINES * * Copyright (c) 2007-2021 POK team */ #if defined(POK_NEEDS_DEBUG) || defined(POK_NEEDS_PORTS_QUEUEING) || \ defined(POK_NEEDS_PORTS_SAMPLING) || defined(POK_NEEDS_PORTS_VIRTUAL) #include <libc.h> __attribute__((weak)) int strcmp(const char *s1, const char *s2) { unsigned int i; for (i = 0;; i++) { if (s1[i] == '\0' && s2[i] == '\0') { return 0; } if (s1[i] < s2[i]) { return -1; } if (s1[i] > s2[i]) { return 1; } } } __attribute__((weak)) int strncmp(const char *s1, const char *s2, size_t size) { unsigned int i; for (i = 0; i < size; i++) { if (s1[i] == '\0' && s2[i] == '\0') { return 0; } if (s1[i] < s2[i]) { return -1; } if (s1[i] > s2[i]) { return 1; } } return 0; } #endif