Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
NATURALSTRCMP(3)	     MBK UTILITY FUNCTIONS	      NATURALSTRCMP(3)

NAME
       naturalstrcmp  -	 compare  string in alphabetical order for letters and
       numerical for digits.

SYNOPSYS
       #include	"mut.h"
       int naturalstrcmp(s, t)
       char *s,	*t;

PARAMETERS
       s		   Pointer to the first	string to compare

       t		   Pointer to the second string	to compare

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

RETURN VALUES
       naturalstrcmp has the same return values	than the standard library str-
       cmp(3) function.

EXAMPLE
       #include	"mut.h"
       static int
	  connectorcmp(flc, slc)
       locon_list **flc, **slc;
       {
	  return naturalstrcmp((*slc)->NAME, (*flc)->NAME);
       }

SEE ALSO
       mbk(1), strcmp(3).

ASIM/LIP6			October	1, 1997		      NATURALSTRCMP(3)

NAME | SYNOPSYS | PARAMETERS | DESCRIPTION | RETURN VALUES | EXAMPLE | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=naturalstrcmp&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help