1 // Copyright 2016 The Fuchsia Authors
2 // Copyright (c) 2008 Travis Geiselbrecht
3 //
4 // Use of this source code is governed by a MIT-style
5 // license that can be found in the LICENSE file or at
6 // https://opensource.org/licenses/MIT
7 
8 #include <string.h>
9 #include <sys/types.h>
10 
11 int
strncmp(char const * cs,char const * ct,size_t count)12 strncmp(char const *cs, char const *ct, size_t count)
13 {
14     signed char __res = 0;
15 
16     while (count > 0) {
17         if ((__res = *cs - *ct++) != 0 || !*cs++)
18             break;
19         count--;
20     }
21 
22     return __res;
23 }
24