File src/strnatcmp.c

-*- mode: c; c-file-style: "k&r" -*-
strnatcmp.c -- Perform 'natural order' comparisons of strings in C. Copyright (C) 2000, 2004 by Martin Pool <mbp sourcefrog net>
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution.


Included Files

partial change history: * * 2004-10-10 mbp: Lift out character type dependencies into macros. * * Eric Sosman pointed out that ctype functions take a parameter whose * value must be that of an unsigned int, even on platforms that have * negative chars in their default char type.


Preprocessor definitions

#define _LONGLONG 1

#define nat_isdigit isdigit

#define nat_isspace isspace

#define nat_toupper toupper


Global Function strnatcasecmp()

Compare, recognizing numeric string and ignoring case.

int strnatcasecmp ( nat_char const* a, nat_char const* b )

Prototyped in: src/strnatcmp.h
Calls: strnatcmp0() src/strnatcmp.c
Called by: a_sort_type() src/dinoex_admin.c

Global Function strnatcmp()

int strnatcmp ( nat_char const* a, nat_char const* b )
Prototyped in: src/strnatcmp.h
Calls: strnatcmp0() src/strnatcmp.c

Local Function compare_left()

static int compare_left ( nat_char const* a, nat_char const* b )
Calls: __isctype()
Called by: strnatcmp0() src/strnatcmp.c

Local Function compare_right()

static int compare_right ( nat_char const* a, nat_char const* b )
Calls: __isctype()
Called by: strnatcmp0() src/strnatcmp.c

Local Function strnatcmp0()

static int strnatcmp0 ( nat_char const* a, nat_char const* b, int fold_case )
Calls: compare_left() src/strnatcmp.c
  compare_right() src/strnatcmp.c
  __assert(), __isctype(), __sbistype(), __sbtoupper()
Called by: strnatcasecmp() src/strnatcmp.c
  strnatcmp() src/strnatcmp.c