From 1f205a479b43e5e40672fe5b4ae8f717b28c41b1 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 21 May 1997 01:48:59 +0000 Subject: Update. 1997-05-21 02:49 Ulrich Drepper * gnu-versions.h (_GNU_OBSTACK_INTERFACE_VERSION): Set to 2 since interface was changed with addition of _obstack_memory_used. Suggested by Ian Taylor . * malloc/obstack.c: Include . Include only if __GNU_LIBRARY__ or HAVE_STDLIB_H is defined. Reported by Ian Taylor . * dirent/Makefile (routines): Add versionsort. * dirent/dirent.h: Add prototype for versionsort. * dirent/versionsort.c: New file. * manual/filesys.texi: Add documentation for versionsort. * manual/string.texi: Add documentation for strverscmp. * string/Makefile (routines): Add strverscmp. (tests): Add tst-svc. * string/string.h: Add prototype for strverscmp. * string/strverscmp.c: New file. * string/tst-svc.c: New file. Test for strverscmp. * string/tst-svc.input: New file. Input data for tst-svc. * string/tst-svc.expect: New file. Expected out from tst-svc. * math/Makefile (calls): Add s_signbit. * po/sv.po: Update. * resolv/nss_dns/dns-host.c: Add casts to prevent warnings. * sunrpc/pmap_rmt.c: Likewise. * string/basename.c: Don't use ISO C definition style. Include is HAVE_CONFIG_H is defined. * sunrpc/proto.h: Add `const' wherever possible. * sunrpc/rpc_cout.c: Likewise. * sunrpc/rpc_svcout.c: Likewise. * sunrpc/xdr_mem.c: Likewise. * sunrpc/xdr_rec.c: Likewise. * sunrpc/xdr_stdio.c: Likewise. * sunrpc/rpc_parse.c: Delete comma from end of enum definition. * sunrpc/xdr.c: Little code cleanups. * sunrpc/xdr_flaot.c: Likewise. Patches by Matthew Wilcox . * sysdeps/i386/fpu/__math.h (__finite): Fix typo. * sysdeps/unix/sysv/linux/shmdt.c: Add cast to prevent warning. * time/europe: Update from tzdata1997f. * time/zic.c: Update from tzcode1997e. 1997-05-20 19:20 Miguel de Icaza * sysdeps/sparc/setjmp.S: Flush windows. Bug found by Richard Henderson. 1997-05-19 12:54 Andreas Schwab * misc/efgcvt_r.c (fcvt_r, ecvt_r): Rewritten as to fit the specs. 1997-05-19 18:41 Thorsten Kukuk * nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_parse_spent): Use atol instead of atoi. 1997-05-18 00:22 Philip Blundell * inet/Makefile (routines): Add if_index. * sysdeps/unix/sysv/linux/if_index.c: New file. * sysdeps/stub/if_index.c: New file. * sysdeps/unix/sysv/linux/net/if.h: Add prototypes for routines in if_index.c (required by IPv6 basic API). * sysdeps/unix/sysv/linux/netinet/in.h: Add struct ipv6_pktinfo. 1997-05-17 23:29 Philip Blundell * sysdeps/unix/sysv/linux/netinet/in.h: Update IPv6 definitions for new advanced API draft. 1997-05-13 21:33 Andreas Schwab * stdio-common/printf_fp.c: Only use the field width for deciding on padding when printing special values. * stdio-common/printf_fphex.c: Likewise. 1997-05-15 13:14 Miles Bader Changes by Thomas Bushnell : * hurd/hurdauth.c (_S_msg_add_auth): Implement correctly. 1997-05-12 14:50 Thomas Bushnell, n/BSG * hurd/hurdsig.c (_hurdsig_init): Double size of sigthread stack; msg_add_auth was overflowing it. 1997-05-12 21:20 Richard Henderson * elf/dl-lookup.c (_dl_lookup_symbol_skip): Call _dl_signal_error when we can't find the symbol. 1997-05-12 16:54 Ulrich Drepper * posix/regex.c: Fix handling of 32-bit Windog environments. Patch by Arnold Robbins . 1997-05-10 23:26 Andreas Schwab * sysdeps/unix/sysv/linux/m68k/syscalls.list: Add cacheflush. 1997-05-10 11:40 Andreas Schwab * elf/ldd.bash.in: Remove spurious quote character from version message. 1997-05-10 08:49 Andreas Schwab * locale/programs/locale.c (write_charmaps): Don't get stuck in a loop if the file ends in a long line without newline. * locale/programs/charmap.c (charmap_read): Likewise. 1997-05-12 03:47 Ulrich Drepper * sunrpc/rpc/xdr.h: Include more headers to be self-contained. * sunrpc/rpc/svc_auth.h: Likewise. * sunrpc/rpc/svc.h: Likewise. * sunrpc/rpc/rpc_msg.h: Likewise. * sunrpc/rpc/pmap_rmt.h: Likewise. * sunrpc/rpc/pmap_clnt.h: Likewise. * sunrpc/rpc/clnt.h: Likewise. * sunrpc/rpc/auth_unix.h: Likewise. * sysdeps/generic/rpc/auth.h: Likewise. Patches by Michael Deutschmann . 1997-05-11 15:29 Philip Blundell * sysdeps/stub/sigaction.c (__sigaction): Correct typo. * sysdeps/standalone/arm/errnos.h: New file. * sysdeps/stub/sys/param.h: Add dummy definition of MAXSYMLINKS. * sysdeps/unix/arm/fork.S: New file. * sysdeps/unix/sysv/linux/arm/sysdep.h: New file. * sysdeps/stub/tempname.c (__stdio_gen_tempname): Add missing `streamptr' argument. * sysdeps/stub/vdprintf.c: Remove second copy of file (!), include to get va_list defined, return 0 not NULL. * sysdeps/unix/sysv/linux/statfsbuf.h: Include . * sysdeps/unix/sysv/linux/arm/syscall.S: New file. * sysdeps/stub/direntry.h (struct dirent): Add missing ';'. * sysdeps/stub/seekdir.c (seekdir): Likewise. * sysdeps/stub/dirfd.c (dirfd): Argument dirp is DIR*, not FILE*. * sysdeps/standalone/dirstream.h: Define struct __dirstream not DIR; provides typedef. * sysdeps/unix/sysv/linux/arm/clone.S: New file. * sysdeps/unix/sysv/linux/arm/socket.S: New file. * sysdeps/stub/sysconf.c (__sysconf): Fix typos. 1997-05-01 06:35 Geoff Keating * sysdeps/powerpc/Dist: New file. * sysdeps/powerpc/Makefile: New file. * sysdeps/powerpc/fclrexcpt.c: New file. * sysdeps/powerpc/fegetenv.c: New file. * sysdeps/powerpc/fegetround.c: New file. * sysdeps/powerpc/feholdexcpt.c: New file. * sysdeps/powerpc/fenvbits.h: New file. * sysdeps/powerpc/fenv_const.c: New file. * sysdeps/powerpc/fenv_libc.h: New file. * sysdeps/powerpc/fesetenv.c: New file. * sysdeps/powerpc/fesetround.c: New file. * sysdeps/powerpc/feupdateenv.c: New file. * sysdeps/powerpc/fgetexcptflg.c: New file. * sysdeps/powerpc/fraiseexcpt.c: New file. * sysdeps/powerpc/fsetexcptflg.c: New file. * sysdeps/powerpc/ftestexcept.c: New file. * sysdeps/powerpc/mathbits.h: New file. * sysdeps/powerpc/dl-machine.h: Wrap in #ifndef dl_machine_h; define elf_machine_lookup_noexec_p, elf_machine_lookup_noplt_p, ELF_MACHINE_RELOC_NOPLT; consequent changes to elf_machine_rela. * sysdeps/powerpc/__math.h: Remove definition for hypot and __sgn. * sysdep/powerpc/fpu_control.h: Correct IEEE default mode. * sysdeps/unix/sysv/linux/powerpc/sysdep.h: Don't use .text, but instead .section ".text". 1997-04-25 05:06 Geoff Keating * sysdeps/powerpc/__longjmp.S: Use symbolic register numbering. * sysdeps/powerpc/bsd-_setjmp.S: Likewise. * sysdeps/powerpc/bsd-setjmp.S: Likewise. * sysdeps/powerpc/setjmp.S: Likewise. * sysdeps/unix/sysv/linux/clone.S: Likewise. * sysdeps/unix/sysv/linux/socket.S: Likewise. * sysdeps/unix/sysv/linux/syscall.S: Likewise. 1997-04-20 04:37 Geoff Keating * sysdeps/powerpc/strchr.s: New file. * sysdeps/powerpc/strcmp.s: New (ugly) file. * sysdeps/powerpc/memset.s: New file. * string/tester.c: Include prototype and _GNU_SOURCE to make standalone compilation possible. Give strcmp a better test. Give memset a better test. 1997-04-05 06:34 Geoff Keating * sysdeps/powerpc/strlen.s: Fixed bugs (how did it ever pass its tests before?). Changed to symbolic register numbering as an experiment. * sysdeps/powerpc/ffs.c: Don't include bstring.h, it doesn't exist. * sysdeps/rs6000/ffs.c: Likewise. 1997-05-12 02:28 Ulrich Drepper * time/sys/time.h: Make second argument of setitimer const. Patch by Michael Deutschmann . * sysdeps/stub/setitimer.c: Likewise. * sysdeps/mach/hurd/setitimer.c: Likewise. --- manual/filesys.texi | 11 ++++++++--- manual/string.texi | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ manual/texinfo.tex | 18 +++++++++++------- 3 files changed, 69 insertions(+), 10 deletions(-) (limited to 'manual') diff --git a/manual/filesys.texi b/manual/filesys.texi index afe072c594..5ddd8a20a7 100644 --- a/manual/filesys.texi +++ b/manual/filesys.texi @@ -455,8 +455,8 @@ value are selected. Finally the entries in the @var{namelist} are sorted using the user supplied function @var{cmp}. The arguments of the @var{cmp} function are of type @code{struct dirent **}. I.e., one cannot directly use the -@code{strcmp} or @code{strcoll} function; see the function -@code{alphasort} below. +@code{strcmp} or @code{strcoll} function; see the functions +@code{alphasort} and @code{versionsort} below. The return value of the function gives the number of entries placed in @var{namelist}. If it is @code{-1} an error occurred and the global @@ -465,7 +465,7 @@ variable @code{errno} contains more information on the error. As said above the fourth argument to the @code{scandir} function must be a pointer to a sorting function. For the convenience of the programmer -the GNU C library contains an implementation of a function which is very +the GNU C library contains implementations of functions which are very helpful for this purpose. @deftypefun int alphasort (const void *@var{a}, const void *@var{b}) @@ -478,6 +478,11 @@ Return value of is less than, equal to, or greater than zero depending on the order of the two entries @var{a} and @var{b}. @end deftypefun +@deftypefun int versionsort (const void *@var{a}, const void *@var{b}) +The @code{versionsort} function is like @code{alphasort}, excepted that it +uses the @code{strverscmp} function internally. +@end deftypefun + @node Simple Directory Lister Mark II @subsection Simple Program to List a Directory, Mark II diff --git a/manual/string.texi b/manual/string.texi index 8f09ac9728..e358b2015f 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -608,6 +608,56 @@ strncmp ("hello, world", "hello, stupid world!!!", 5) @result{} 0 /* @r{The initial 5 characters are the same.} */ @end smallexample +@comment string.h +@comment GNU +@deftypefun int strverscmp (const char *@var{s1}, const char *@var{s2}) +The @code{strverscmp} function compares the string @var{s1} against +@var{s2}, considering them as holding indices/version numbers. Return +value follows the same conventions as found in the @code{strverscmp} +function. In fact, if @var{s1} and @var{s2} contain no digits, +@code{strverscmp} behaves like @code{strcmp}. + +Basically, we compare strings normaly (character by character), until +we find a digit in each string - then we enter a special comparison +mode, where each sequence of digit is taken as a whole. If we reach the +end of these two parts without noticing a difference, we return to the +standard comparison mode. There are two types of numeric parts: +"integral" and "fractionnal" (these laters begins with a '0'). The types +of the numeric parts affect the way we sort them: + +@itemize @bullet +@item +integral/integral: we compare values as you would expect. + +@item +fractionnal/integral: the fractionnal part is less than the integral one. +Again, no surprise. + +@item +fractionnal/fractionnal: the things become a bit more complex. +if the common prefix contains only leading zeroes, the longest part is less +than the other one; else the comparison behaves normaly. +@end itemize + +@smallexample +strverscmp ("no digit", "no digit") + @result{} 0 /* @r{same behaviour as strverscmp.} */ +strverscmp ("item#99", "item#100") + @result{} <0 /* @r{same prefix, but 99 < 100.} */ +strverscmp ("alpha1", "alpha001") + @result{} >0 /* @r{fractionnal part inferior to integral one.} */ +strverscmp ("part1_f012", "part1_f01") + @result{} >0 /* @r{two fractionnal parts.} */ +strverscmp ("foo.009", "foo.0") + @result{} <0 /* @r{idem, but with leading zeroes only.} */ +@end smallexample + +This function is especially usefull when dealing with filename sorting, +because filenames frequently hold indices/version numbers. + +@code{strverscmp} is a GNU extension. +@end deftypefun + @comment string.h @comment BSD @deftypefun int bcmp (const void *@var{a1}, const void *@var{a2}, size_t @var{size}) diff --git a/manual/texinfo.tex b/manual/texinfo.tex index 72050b8e22..6bae66900a 100644 --- a/manual/texinfo.tex +++ b/manual/texinfo.tex @@ -1,5 +1,5 @@ %% TeX macros to handle Texinfo files. -%% $Id: texinfo.tex,v 2.198 1997/05/07 15:16:03 drepper Exp $ +%% $Id: texinfo.tex,v 2.199 1997/05/20 11:11:48 drepper Exp $ % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, % 94, 95, 96, 97 Free Software Foundation, Inc. @@ -36,7 +36,7 @@ % This automatically updates the version number based on RCS. \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}} -\deftexinfoversion$Revision: 2.198 $ +\deftexinfoversion$Revision: 2.199 $ \message{Loading texinfo package [Version \texinfoversion]:} % If in a .fmt file, print the version number @@ -1271,8 +1271,6 @@ where each line of input produces a line of output.} \def\ctrl #1{{\tt \rawbackslash \hat}#1} \let\file=\samp -\let\url=\samp % perhaps include a hypertex \special eventually -\def\email#1{$\langle${\tt #1}$\rangle$} % @code is a modification of @t, % which makes spaces the same size as normal in the surrounding text. @@ -1325,7 +1323,7 @@ where each line of input produces a line of output.} \def\realdash{-} \def\codedash{-\discretionary{}{}{}} -\def\codeunder{\normalunderscore\discretionary{}{}{}} +\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} \def\codex #1{\tclose{#1}\endgroup} %\let\exp=\tclose %Was temporary @@ -1339,6 +1337,12 @@ where each line of input produces a line of output.} \else{\tclose{\ttsl\look}}\fi \else{\tclose{\ttsl\look}}\fi} +% @url, @email. Quotes do not seem necessary. +\let\url=\code % perhaps include a hypertex \special eventually +% rms does not like the angle brackets --karl, 17may97. +%\def\email#1{$\langle${\tt #1}$\rangle$} +\let\email=\code + % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have @@ -3417,8 +3421,8 @@ width0pt\relax} \fi \let\.=\ptexdot \let\*=\ptexstar \let\dots=\ptexdots -\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}} -\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi} +\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% +\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% \let\bullet=\ptexbullet \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext -- cgit 1.4.1