mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Use system function strverscmp() if exists.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
e723926cd0
commit
47cdfd6baf
@ -166,6 +166,7 @@ AC_CHECK_FUNCS([\
|
||||
memcpy memset \
|
||||
setreuid statfs sysconf \
|
||||
tcgetattr tcsetattr truncate \
|
||||
strverscmp
|
||||
])
|
||||
|
||||
dnl
|
||||
|
@ -19,6 +19,10 @@
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_STRVERSCMP
|
||||
#include <string.h>
|
||||
#endif /* HAVE_STRVERSCMP */
|
||||
|
||||
#include "lib/strutil.h"
|
||||
|
||||
/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
|
||||
@ -40,6 +44,9 @@
|
||||
|
||||
int str_verscmp (const char *s1, const char *s2)
|
||||
{
|
||||
#ifdef HAVE_STRVERSCMP
|
||||
return strverscmp(s1, s2);
|
||||
#else /* HAVE_STRVERSCMP */
|
||||
unsigned char *p1 = (unsigned char *) s1;
|
||||
unsigned char *p2 = (unsigned char *) s2;
|
||||
unsigned char c1, c2;
|
||||
@ -105,4 +112,6 @@ int str_verscmp (const char *s1, const char *s2)
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
#endif /* HAVE_STRVERSCMP */
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user