2 strncmp - compare two strings up to a specified number of characters
12 return integer (1, 0 or -1)
15 Let n1 = size(s1), n2 = size(s2) and m = min(n1, n2, n).
16 This function compares up to m values of consecutive characters
17 in the strings s1 and s2. If an inequality is encountered, the
18 function returns 1 or -1 according as the greater character is
19 in s1 or s2. If there has been no inequality, the function
20 returns 1, 0, or -1 according as min(n1, n) is greater than, equal
21 to, or less than min(n2, n); in particular, if n1 and n2 are
22 both greater than equal to n, 0 is returned.
26 strncmp("abc", "xyz", 0) == 0
27 strncmp("abc", "xyz", 1) == -1
28 strncmp("abc", "", 1) == 1
29 strncmp("a", "b", 2) == -1
30 strncmp("ab", "ac", 2) == -1
31 strncmp("\0ac", "\0b", 2) == -1
32 strncmp("ab", "abc", 2) == 0
33 strncmp("abc", "abd", 2) == 0
40 This function uses FLAG stringrel(STRING *s1, STRING *s2),
41 temporarily replacing the string sizes by min(n1,n) and min(n2,n).
44 strcat, strcpy, strerror, strlen, strncpy, strpos,
45 strprintf, strscan, strscanf, substr
47 ## Copyright (C) 2006 Ernest Bowen
49 ## Calc is open software; you can redistribute it and/or modify it under
50 ## the terms of the version 2.1 of the GNU Lesser General Public License
51 ## as published by the Free Software Foundation.
53 ## Calc is distributed in the hope that it will be useful, but WITHOUT
54 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
55 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
56 ## Public License for more details.
58 ## A copy of version 2.1 of the GNU Lesser General Public License is
59 ## distributed with calc under the filename COPYING-LGPL. You should have
60 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
61 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
63 ## @(#) $Revision: 30.3 $
64 ## @(#) $Id: strncmp,v 30.3 2013/08/11 01:16:03 chongo Exp $
65 ## @(#) $Source: /usr/local/src/bin/calc/help/RCS/strncmp,v $
67 ## Under source code control: 2006/03/03 03:32:44
68 ## File existed as early as: 2006
70 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
71 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/