NATURALSTRCMP(3) | MBK UTILITY FUNCTIONS | NATURALSTRCMP(3) |
naturalstrcmp - compare string in alphabetical order for letters and numerical for digits.
See the file buster/alliance/alc_origin.1.en.gz.
#include "mut.h" int naturalstrcmp(s, t) char ∗s, ∗t;
naturalstrcmp is an alphanumerical comparison function that ensures x12 > x2 for example. First, the alphabetical part of the string is compared, using strcmp(3), then, if it has trailing numbers, they are compared using a numerical function.
naturalstrcmp has the same return values than the standard library strcmp(3) function.
#include "mut.h" static int connectorcmp(flc, slc) locon_list **flc, **slc; { return naturalstrcmp((*slc)->NAME, (*flc)->NAME); }
See the file buster/alliance/alc_bug_report.1.en.gz.
October 1, 1997 | ASIM/LIP6 |