1 --- a/rdnssd/Makefile.am
2 +++ b/rdnssd/Makefile.am
3 @@ -30,7 +30,8 @@ conf_SCRIPTS = merge-hook
5 rdnssd_SOURCES = rdnssd.c rdnssd.h \
10 rdnssd_LDADD = $(LIBRT) \
11 @top_builddir@/compat/libcompat.a
13 --- a/rdnssd/Makefile.in
14 +++ b/rdnssd/Makefile.in
15 @@ -60,7 +60,7 @@ CONFIG_CLEAN_FILES =
16 CONFIG_CLEAN_VPATH_FILES =
17 am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(confdir)"
18 PROGRAMS = $(sbin_PROGRAMS)
19 -am_rdnssd_OBJECTS = rdnssd.$(OBJEXT) icmp.$(OBJEXT) netlink.$(OBJEXT)
20 +am_rdnssd_OBJECTS = rdnssd.$(OBJEXT) icmp.$(OBJEXT) netlink.$(OBJEXT) strverscmp.$(OBJEXT)
21 rdnssd_OBJECTS = $(am_rdnssd_OBJECTS)
23 rdnssd_DEPENDENCIES = $(am__DEPENDENCIES_1) \
24 @@ -251,7 +251,8 @@ conf_SCRIPTS = merge-hook
26 rdnssd_SOURCES = rdnssd.c rdnssd.h \
32 rdnssd_LDADD = $(LIBRT) \
33 @top_builddir@/compat/libcompat.a
34 @@ -373,6 +374,7 @@ distclean-compile:
36 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icmp.Po@am__quote@
37 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlink.Po@am__quote@
38 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strverscmp.Po@am__quote@
39 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdnssd.Po@am__quote@
43 +++ b/rdnssd/strverscmp.c
45 +/* Compare strings while treating digits characters numerically.
46 + Copyright (C) 1997, 2000, 2002, 2004 Free Software Foundation, Inc.
47 + This file is part of the GNU C Library.
48 + Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
50 + This program is free software; you can redistribute it and/or modify
51 + it under the terms of the GNU General Public License as published by
52 + the Free Software Foundation; either version 2, or (at your option)
55 + This program is distributed in the hope that it will be useful,
56 + but WITHOUT ANY WARRANTY; without even the implied warranty of
57 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58 + GNU General Public License for more details.
60 + You should have received a copy of the GNU General Public License along
61 + with this program; if not, write to the Free Software Foundation,
62 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
71 +/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
72 + fractional parts, S_Z: idem but with leading Zeroes only */
78 +/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
83 +/* ISDIGIT differs from isdigit, as follows:
84 + - Its arg may be any int or unsigned int; it need not be an unsigned char.
85 + - It's guaranteed to evaluate its argument exactly once.
86 + - It's typically faster.
87 + POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
88 + ISDIGIT_LOCALE unless it's important to use the locale's definition
89 + of `digit' even when the host does not conform to POSIX. */
90 +#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
96 +# define __strverscmp strverscmp
99 +/* Compare S1 and S2 as strings holding indices/version numbers,
100 + returning less than, equal to or greater than zero if S1 is less than,
101 + equal to or greater than S2 (for more info, see the texinfo doc).
105 +__strverscmp (const char *s1, const char *s2)
107 + const unsigned char *p1 = (const unsigned char *) s1;
108 + const unsigned char *p2 = (const unsigned char *) s2;
109 + unsigned char c1, c2;
113 + /* Symbol(s) 0 [1-9] others (padding)
114 + Transition (10) 0 (01) d (00) x (11) - */
115 + static const unsigned int next_state[] =
117 + /* state x d 0 - */
118 + /* S_N */ S_N, S_I, S_Z, S_N,
119 + /* S_I */ S_N, S_I, S_I, S_I,
120 + /* S_F */ S_N, S_F, S_F, S_F,
121 + /* S_Z */ S_N, S_F, S_Z, S_Z
124 + static const int result_type[] =
126 + /* state x/x x/d x/0 x/- d/x d/d d/0 d/-
127 + 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
129 + /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
130 + CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
131 + /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP,
132 + 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
133 + /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
134 + CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
135 + /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP,
144 + /* Hint: '0' is a digit too. */
145 + state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0));
147 + while ((diff = c1 - c2) == 0 && c1 != '\0')
149 + state = next_state[state];
152 + state |= (c1 == '0') + (ISDIGIT (c1) != 0);
155 + state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))];
163 + while (ISDIGIT (*p1++))
164 + if (!ISDIGIT (*p2++))
167 + return ISDIGIT (*p2) ? -1 : diff;
174 +weak_alias (__strverscmp, strverscmp)