1NATURALSTRCMP(3)             MBK UTILITY FUNCTIONS            NATURALSTRCMP(3)
2
3
4

NAME

6       naturalstrcmp  -  compare  string in alphabetical order for letters and
7       numerical for digits.
8

SYNOPSIS

10       #include "mut.h"
11       int naturalstrcmp(s, t)
12       char ∗s, ∗t;
13

PARAMETERS

15       s                   Pointer to the first string to compare
16
17       t                   Pointer to the second string to compare
18

DESCRIPTION

20       naturalstrcmp is an alphanumerical comparison function that ensures x12
21       >  x2  for example.  First, the alphabetical part of the string is com‐
22       pared, using strcmp(3), then, if it has trailing numbers, they are com‐
23       pared using a numerical function.
24

RETURN VALUES

26       naturalstrcmp has the same return values than the standard library str‐
27       cmp(3) function.
28

EXAMPLE

30       #include "mut.h"
31       static int
32          connectorcmp(flc, slc)
33       locon_list **flc, **slc;
34       {
35          return naturalstrcmp((*slc)->NAME, (*flc)->NAME);
36       }
37

SEE ALSO

39       mbk(1), strcmp(3).
40
41
42
43
44
45
46ASIM/LIP6                       October 1, 1997               NATURALSTRCMP(3)
Impressum