Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Add HAVE_STRVERSCMP, guard the only usage of strverscmp with #ifdef
Browse files Browse the repository at this point in the history
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
  • Loading branch information
Denys Vlasenko committed Jun 21, 2011
1 parent 040b5a2 commit 561f9c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions coreutils/ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,11 @@ static int sortcmp(const void *a, const void *b)
if (sort_opts == SORT_DIR) {
dif = S_ISDIR(d2->dn_mode) - S_ISDIR(d1->dn_mode);
} else
#ifdef HAVE_STRVERSCMP && HAVE_STRVERSCMP == 1
if (sort_opts == SORT_VERSION) {
dif = strverscmp(d1->name, d2->name);
} else
#endif
if (sort_opts == SORT_EXT) {
dif = strcmp(strchrnul(d1->name, '.'), strchrnul(d2->name, '.'));
}
Expand Down
5 changes: 5 additions & 0 deletions include/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ typedef unsigned smalluint;
#define HAVE_STRCHRNUL 1
#define HAVE_STRSEP 1
#define HAVE_STRSIGNAL 1
#define HAVE_STRVERSCMP 1
#define HAVE_VASPRINTF 1
#define HAVE_XTABS 1
#define HAVE_MNTENT_H 1
Expand All @@ -372,6 +373,7 @@ typedef unsigned smalluint;
# undef HAVE_STRCHRNUL
# undef HAVE_STRSEP
# undef HAVE_STRSIGNAL
# undef HAVE_STRVERSCMP
# undef HAVE_VASPRINTF
# undef HAVE_NET_ETHERNET_H
#endif
Expand All @@ -389,18 +391,21 @@ typedef unsigned smalluint;
# undef HAVE_PTSNAME_R
# undef HAVE_SYS_STATFS_H
# undef HAVE_SIGHANDLER_T
# undef HAVE_STRVERSCMP
# undef HAVE_XTABS
# undef HAVE_DPRINTF
#endif

#if defined(__digital__) && defined(__unix__)
# undef HAVE_STPCPY
# undef HAVE_STRVERSCMP
#endif

#if defined(ANDROID)
# undef HAVE_DPRINTF
# undef HAVE_STPCPY
# undef HAVE_STRCHRNUL
# undef HAVE_STRVERSCMP
# undef HAVE_NET_ETHERNET_H
#endif

Expand Down

0 comments on commit 561f9c8

Please sign in to comment.