mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
416 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7612e5c5c6 | ||
|
|
ff8d38e100 | ||
|
|
6b9ab1831f | ||
|
|
7324fba675 | ||
|
|
c586bff1c0 | ||
|
|
4015f93d30 | ||
|
|
34ef0a01f0 | ||
|
|
71a3fd73a1 | ||
|
|
9300fffcb5 | ||
|
|
61b77891c2 | ||
|
|
9f4744534f | ||
|
|
938435ee30 | ||
|
|
9af44d937e | ||
|
|
fdfc5cf0c1 | ||
|
|
ab9d2d2d46 | ||
|
|
758916b49e | ||
|
|
6483f0e1bd | ||
|
|
61d1c5cb3c | ||
|
|
2f41f563d1 | ||
|
|
b7459696dc | ||
|
|
4c286d341a | ||
|
|
77063bf819 | ||
|
|
6ad89f2233 | ||
|
|
2006aeba9d | ||
|
|
c333ff1b0c | ||
|
|
5862b677f1 | ||
|
|
d4f304d721 | ||
|
|
7a5ecae996 | ||
|
|
2c14ec962a | ||
|
|
9069af45e6 | ||
|
|
abe5c1f9bc | ||
|
|
1129cb58ba | ||
|
|
288bfea72c | ||
|
|
6067d05228 | ||
|
|
68062ca607 | ||
|
|
65b50c6cdd | ||
|
|
724e993104 | ||
|
|
3f48829c29 | ||
|
|
704eedab03 | ||
|
|
9065006ccb | ||
|
|
4727aab1b1 | ||
|
|
f57cb371fa | ||
|
|
0a238bcb87 | ||
|
|
390133df25 | ||
|
|
c12d83920f | ||
|
|
edc69f9158 | ||
|
|
2dd21704d6 | ||
|
|
95732b834e | ||
|
|
3bb942c426 | ||
|
|
42681e9e4d | ||
|
|
ea1b8bafc0 | ||
|
|
c52d220c30 | ||
|
|
437671accc | ||
|
|
0e295c88bc | ||
|
|
041c9c472a | ||
|
|
fc9d948d7e | ||
|
|
126d59542f | ||
|
|
777024889c | ||
|
|
c984948ff5 | ||
|
|
ddf6fb8686 | ||
|
|
872f6bb2ba | ||
|
|
8ce8ac9de2 | ||
|
|
0380e4c98e | ||
|
|
2ed90c4c9d | ||
|
|
6d78c2df58 | ||
|
|
4e01bd1dab | ||
|
|
9e900e81db | ||
|
|
b5f9a6a176 | ||
|
|
9899e6cd85 | ||
|
|
2050a5913b | ||
|
|
7861d74ba8 | ||
|
|
ec0d6ddb81 | ||
|
|
4e6bac4ca3 | ||
|
|
fbebc507da | ||
|
|
24f1af88c7 | ||
|
|
ad31a59a37 | ||
|
|
b877ea4b3e | ||
|
|
bdde34f958 | ||
|
|
2b49b140cc | ||
|
|
db48b36241 | ||
|
|
a2cebacf97 | ||
|
|
94615d2acf | ||
|
|
abd040180e | ||
|
|
1bf73ebb97 | ||
|
|
c8d3838681 | ||
|
|
247e239698 | ||
|
|
802542ff92 | ||
|
|
074566823e | ||
|
|
de949fc12d | ||
|
|
1563ffd2b1 | ||
|
|
001700f4a0 | ||
|
|
48faad3748 | ||
|
|
01ca128807 | ||
|
|
77428214f1 | ||
|
|
9a3c600f11 | ||
|
|
df906d2e75 | ||
|
|
47076e3c7c | ||
|
|
63b5e81648 | ||
|
|
c88cfffb6c | ||
|
|
c1d8e6e458 | ||
|
|
e5444fa2a7 | ||
|
|
e7523efb7d | ||
|
|
78e6fb0489 | ||
|
|
c580983f70 | ||
|
|
aadc67dfdb | ||
|
|
b084d6bcb5 | ||
|
|
c5e350ec56 | ||
|
|
66af887e57 | ||
|
|
4fe3860ebc | ||
|
|
4332538dbb | ||
|
|
f8574063d5 | ||
|
|
9face836f3 | ||
|
|
f6e8c18f8d | ||
|
|
335b59b962 | ||
|
|
e5ca54448e | ||
|
|
db4df7dda6 | ||
|
|
fb1a26c3f6 | ||
|
|
d5427265e3 | ||
|
|
61aae73f54 | ||
|
|
09fcf494a1 | ||
|
|
1d95457b3e | ||
|
|
98d48bb0e9 | ||
|
|
4cb8268024 | ||
|
|
f42496b72b | ||
|
|
6357909ee6 | ||
|
|
efe53cc72b | ||
|
|
d27d6d371f | ||
|
|
1af81dfb4d | ||
|
|
8aa15b2be2 | ||
|
|
7336920dd0 | ||
|
|
b062bbd947 | ||
|
|
cfee734a41 | ||
|
|
5b3adc0d42 | ||
|
|
91b7b7cf7e | ||
|
|
825a92240e | ||
|
|
13f323786c | ||
|
|
1419af8243 | ||
|
|
9f75771efb | ||
|
|
879e8261bb | ||
|
|
ceb84598d8 | ||
|
|
280b15249c | ||
|
|
d9ddd4c503 | ||
|
|
155c8148ae | ||
|
|
ea615bf8cd | ||
|
|
9e7edd8467 | ||
|
|
ad89ea6a0d | ||
|
|
04bed02096 | ||
|
|
dfad4755ca | ||
|
|
d5a5d83094 | ||
|
|
c0cfa0defe | ||
|
|
da7a704cd3 | ||
|
|
5591f19e9c | ||
|
|
78c1111c00 | ||
|
|
f385d97a41 | ||
|
|
200501052e | ||
|
|
81b7585ad1 | ||
|
|
d4201905ab | ||
|
|
5d59808a65 | ||
|
|
55db9a39a8 | ||
|
|
6bc44b5feb | ||
|
|
63761c027c | ||
|
|
fdff32e183 | ||
|
|
28488c1214 | ||
|
|
2b8ecfa6f1 | ||
|
|
1be4f180f5 | ||
|
|
9f1d4e3e6f | ||
|
|
5e82d241d0 | ||
|
|
1173dcd632 | ||
|
|
fe953ad710 | ||
|
|
9464ce2107 | ||
|
|
03f6f32c41 | ||
|
|
144d6e5f53 | ||
|
|
4f5732e27a | ||
|
|
7e978a7b2d | ||
|
|
844b2570b3 | ||
|
|
0c22e84156 | ||
|
|
d21812670b | ||
|
|
88e2f6c860 | ||
|
|
e080c8a1b0 | ||
|
|
722173444a | ||
|
|
74f07c98d4 | ||
|
|
0f741381c4 | ||
|
|
6ac165922c | ||
|
|
cab2119542 | ||
|
|
9e42ecceff | ||
|
|
ca41dcff1d | ||
|
|
7d501cdd9c | ||
|
|
ecf6d16dc7 | ||
|
|
c0e784b923 | ||
|
|
a9c542e416 | ||
|
|
d861519d2a | ||
|
|
5e9a7ae46b | ||
|
|
8b5087d4e6 | ||
|
|
7905d6d34d | ||
|
|
518a8664a2 | ||
|
|
83e4f0ca02 | ||
|
|
2191fe8f8d | ||
|
|
a4ab8d9c55 | ||
|
|
301c74865e | ||
|
|
765d67410c | ||
|
|
1d10eb8b1e | ||
|
|
c0a121c9bc | ||
|
|
c9e4ea6ee2 | ||
|
|
819265b8be | ||
|
|
a9b904a282 | ||
|
|
7dc398a30f | ||
|
|
8fc12909f6 | ||
|
|
1777d0dfe3 | ||
|
|
56fce1aed7 | ||
|
|
36cc6ac787 | ||
|
|
62dd4b63c5 | ||
|
|
3a1595a3fb | ||
|
|
f8291d0ec4 | ||
|
|
05bee6f116 | ||
|
|
584e38d8b3 | ||
|
|
c420cfef77 | ||
|
|
be9a42e7ac | ||
|
|
20a5a60c61 | ||
|
|
0ba945b050 | ||
|
|
8c4b6ba09b | ||
|
|
ac6feeb9f2 | ||
|
|
ef5758c328 | ||
|
|
0a9302e7f7 | ||
|
|
9e66806e28 | ||
|
|
f6b2f46714 | ||
|
|
f267926f2d | ||
|
|
6f6f599867 | ||
|
|
2dc09bf809 | ||
|
|
98dacf492e | ||
|
|
b48a444e35 | ||
|
|
6416762b73 | ||
|
|
a8fc4edca5 | ||
|
|
3f7091359a | ||
|
|
0f5dc96354 | ||
|
|
5ef03d6c5b | ||
|
|
8915368ee3 | ||
|
|
b4f9559537 | ||
|
|
88d4b3461e | ||
|
|
4c38625ef3 | ||
|
|
946359f101 | ||
|
|
9f793def3c | ||
|
|
628a5e16dd | ||
|
|
773d15a702 | ||
|
|
c872a1d8a5 | ||
|
|
dfe0d336a0 | ||
|
|
3dcbcf98f4 | ||
|
|
dd9df4ab02 | ||
|
|
54158a45fa | ||
|
|
da2f637888 | ||
|
|
cab29edcf1 | ||
|
|
b44d4b6b0e | ||
|
|
d75820e516 | ||
|
|
46e0137277 | ||
|
|
c403c31e88 | ||
|
|
4edb86215d | ||
|
|
64bc4f20e8 | ||
|
|
141645d9c6 | ||
|
|
0c31cdc2d1 | ||
|
|
4323ed2bde | ||
|
|
c971ed9377 | ||
|
|
998fe29301 | ||
|
|
612c2c95c3 | ||
|
|
a7b4fa01dd | ||
|
|
dae35bac98 | ||
|
|
168a6b6a0f | ||
|
|
59e2e55d0f | ||
|
|
2590389aab | ||
|
|
9a6c97eb29 | ||
|
|
0b5bd805bd | ||
|
|
f5268e2749 | ||
|
|
cba49d57da | ||
|
|
a2f81776ad | ||
|
|
11d84c10ce | ||
|
|
58c98f2342 | ||
|
|
7ae60bf26f | ||
|
|
d4de2dc83a | ||
|
|
45b46f4951 | ||
|
|
9f650d0870 | ||
|
|
ed509250a2 | ||
|
|
543696a9af | ||
|
|
86573d33a7 | ||
|
|
cea6d15720 | ||
|
|
69cc8d5cb7 | ||
|
|
dd2253f49d | ||
|
|
f53a0e1062 | ||
|
|
628b1d5e7e | ||
|
|
f86bb6967d | ||
|
|
819aa9eba7 | ||
|
|
86914603b5 | ||
|
|
6e8f368e07 | ||
|
|
5d43617e8a | ||
|
|
5d4952059f | ||
|
|
c7ecdb0fcb | ||
|
|
aad0bde0b5 | ||
|
|
0caead1ea0 | ||
|
|
9c566ad04a | ||
|
|
3e8586bc54 | ||
|
|
014fead953 | ||
|
|
e489fd04d6 | ||
|
|
31423c76e8 | ||
|
|
cd349fdca2 | ||
|
|
eccf54368f | ||
|
|
7ba0e90c55 | ||
|
|
954ef23ed9 | ||
|
|
e55d882811 | ||
|
|
f28c7d959b | ||
|
|
3b498ba141 | ||
|
|
39243f0ea8 | ||
|
|
a4da48c4f5 | ||
|
|
d89755469b | ||
|
|
b81cdbf31e | ||
|
|
0a6bbb5947 | ||
|
|
6beca4248f | ||
|
|
37b8bfda56 | ||
|
|
21a6a7f64c | ||
|
|
6454dd0f2f | ||
|
|
d0f18197fc | ||
|
|
21f4da0fb9 | ||
|
|
201ba1a203 | ||
|
|
e06e7a8331 | ||
|
|
67d3e26350 | ||
|
|
72a0a8264d | ||
|
|
f52d939014 | ||
|
|
7a1f69aae0 | ||
|
|
bbdc929602 | ||
|
|
4db2f5c6bc | ||
|
|
be6c13e7e0 | ||
|
|
dc0f5eb6a0 | ||
|
|
0faf3bf874 | ||
|
|
b7f2b51c42 | ||
|
|
84db964925 | ||
|
|
49c5b690cb | ||
|
|
157c2bc55e | ||
|
|
1aa17dc89b | ||
|
|
6c8d432b1f | ||
|
|
f1ab2e0227 | ||
|
|
4668ae8f06 | ||
|
|
b0782cb9ea | ||
|
|
f428e548e5 | ||
|
|
7e0c2b9a59 | ||
|
|
7f9e164d27 | ||
|
|
d3a4bc86cd | ||
|
|
fe062d563a | ||
|
|
2ead2365e0 | ||
|
|
2024418dc4 | ||
|
|
fd93fc3ef4 | ||
|
|
bd26efaaa3 | ||
|
|
07f15147eb | ||
|
|
ed86ca7c5e | ||
|
|
4b2b2711d9 | ||
|
|
66b15949df | ||
|
|
3d09e31e07 | ||
|
|
67bfde6668 | ||
|
|
a0d5d53a30 | ||
|
|
8506d9adb6 | ||
|
|
c85ad43ef4 | ||
|
|
8d2ecd4a3e | ||
|
|
11dc0016bb | ||
|
|
53db8d6479 | ||
|
|
4b449caf2d | ||
|
|
d98b1b35a6 | ||
|
|
01e4f003a0 | ||
|
|
54dcfab190 | ||
|
|
3593cf50b2 | ||
|
|
d64c186d8e | ||
|
|
bfcfc0ce72 | ||
|
|
bf01ac3004 | ||
|
|
5519ba24b5 | ||
|
|
e4c4d77f84 | ||
|
|
c149538652 | ||
|
|
6ee02e3d83 | ||
|
|
207a978e64 | ||
|
|
0291966175 | ||
|
|
d9ba885974 | ||
|
|
96047b77ec | ||
|
|
5a514de955 | ||
|
|
a0000ba4ae | ||
|
|
70d023b076 | ||
|
|
ca39c9c308 | ||
|
|
fc4d3f63b0 | ||
|
|
3df2108b0d | ||
|
|
829c418d67 | ||
|
|
06e9880c8e | ||
|
|
bb4cb10e89 | ||
|
|
23c0cecaa8 | ||
|
|
19b460b239 | ||
|
|
0f8bb24ca8 | ||
|
|
321d2901de | ||
|
|
f5a97b8269 | ||
|
|
73d4626134 | ||
|
|
7ac41f9950 | ||
|
|
dcff25a925 | ||
|
|
7a2b0b8f66 | ||
|
|
ae034822c5 | ||
|
|
d8cadda3b9 | ||
|
|
afd087d414 | ||
|
|
9b4b38f56e | ||
|
|
5224fbd6f9 | ||
|
|
d16a8f6c7f | ||
|
|
0dc1f4c6f3 | ||
|
|
cb775df09e | ||
|
|
b92e0455e1 | ||
|
|
3910144405 | ||
|
|
4bb812ad49 | ||
|
|
b498c58013 | ||
|
|
f9d0bb8481 | ||
|
|
ab6b27eba7 | ||
|
|
9cf9f8e1e0 | ||
|
|
ad1f07b3c4 | ||
|
|
ddea7b1078 | ||
|
|
5eb8d60e6d | ||
|
|
395b1c9375 | ||
|
|
2f2112335c | ||
|
|
30eb606ed5 | ||
|
|
f18eef3284 | ||
|
|
e246d654f3 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
*.I[12]
|
||||
*.[EIOX]
|
||||
*.bak
|
||||
*.o
|
||||
*/.deps
|
||||
*~
|
||||
@@ -39,23 +40,28 @@ coreutils-*.tar.bz2
|
||||
coreutils-*.tar.bz2.sig
|
||||
coreutils-*.tar.gz
|
||||
coreutils-*.tar.gz.sig
|
||||
coreutils-*.tar.lzma
|
||||
coreutils-*.tar.lzma.sig
|
||||
coreutils-*.tar.xz
|
||||
coreutils-*.tar.xz.sig
|
||||
gnulib-tests
|
||||
lib/.cvsignore
|
||||
lib/.gitignore
|
||||
lib/arg-nonnull.h
|
||||
lib/arpa
|
||||
lib/binary-io.h
|
||||
lib/c++defs.h
|
||||
lib/charset.alias
|
||||
lib/configmake.h
|
||||
lib/glthread
|
||||
lib/libcoreutils.a
|
||||
lib/link-warning.h
|
||||
lib/printf.c
|
||||
lib/progname.c
|
||||
lib/progname.h
|
||||
lib/selinux
|
||||
lib/unistr
|
||||
lib/uniwidth
|
||||
lib/unused-parameter.h
|
||||
lib/warn-on-use.h
|
||||
m4/.cvsignore
|
||||
m4/.gitignore
|
||||
maint.mk
|
||||
|
||||
10
.mailmap
Normal file
10
.mailmap
Normal file
@@ -0,0 +1,10 @@
|
||||
# Map git author names and email addresses to canonical/preferred form.
|
||||
<jim@meyering.net> <meyering@iou.iou>
|
||||
<jim@meyering.net> <meyering@rho.meyering.net>
|
||||
<jim@meyering.net> <meyering@vm.meyering.net.localdomain>
|
||||
Paul R. Eggert <eggert@cs.ucla.edu> <eggert@penguin.cs.ucla.edu>
|
||||
Paul R. Eggert <eggert@cs.ucla.edu> <eggert@CS.UCLA.EDU>
|
||||
# Evan's two changes listed my email address.
|
||||
Evan Hunt <ethanol@armory.com> Evan Hunt <jim@meyering.net>
|
||||
<P@draigBrady.com> <P@draigBrady.com (trivial change)>
|
||||
Pádraig Brady <p@draigbrady.com> <p@draigBrady.com>
|
||||
@@ -1 +1 @@
|
||||
8.0
|
||||
8.5
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Suppress valgrind diagnostics we don't care about.
|
||||
|
||||
# Copyright (C) 2003, 2004, 2006-2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2004, 2006-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
gl/lib/randint.c
|
||||
lib/euidaccess-stat.c
|
||||
gl/tests/.*\.c
|
||||
|
||||
1
.x-sc_prohibit_always-defined_macros
Normal file
1
.x-sc_prohibit_always-defined_macros
Normal file
@@ -0,0 +1 @@
|
||||
src/seq.c
|
||||
2
.x-sc_prohibit_always_true_header_tests
Normal file
2
.x-sc_prohibit_always_true_header_tests
Normal file
@@ -0,0 +1,2 @@
|
||||
^m4/stat-prog\.m4$
|
||||
ChangeLog
|
||||
1
.x-sc_prohibit_empty_lines_at_EOF
Normal file
1
.x-sc_prohibit_empty_lines_at_EOF
Normal file
@@ -0,0 +1 @@
|
||||
^tests/pr/
|
||||
@@ -1,3 +1,4 @@
|
||||
\.mk$
|
||||
/Makefile\.am$
|
||||
^tests/init\.sh$
|
||||
^tests/test-lib\.sh$
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
configure.ac
|
||||
*.m4
|
||||
ChangeLog*
|
||||
|
||||
@@ -11609,7 +11609,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2005, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -4033,7 +4033,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -4015,7 +4015,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -372,7 +372,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2008-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2010 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
109
HACKING
109
HACKING
@@ -233,6 +233,107 @@ Try to make the summary line fit one of the following forms:
|
||||
maint: change-description
|
||||
|
||||
|
||||
Curly braces: use judiciously
|
||||
=============================
|
||||
Omit the curly braces around an "if", "while", "for" etc. body only when
|
||||
that body occupies a single line. In every other case we require the braces.
|
||||
This ensures that it is trivially easy to identify a single-*statement* loop:
|
||||
each has only one *line* in its body.
|
||||
|
||||
Omitting braces with a single-line body is fine:
|
||||
|
||||
while (expr)
|
||||
single_line_stmt ();
|
||||
|
||||
However, the moment your loop/if/else body extends onto a second line,
|
||||
for whatever reason (even if it's just an added comment), then you should
|
||||
add braces. Otherwise, it would be too easy to insert a statement just
|
||||
before that comment (without adding braces), thinking it is already a
|
||||
multi-statement loop:
|
||||
|
||||
while (true)
|
||||
/* comment... */ // BAD: multi-line body without braces
|
||||
single_line_stmt ();
|
||||
|
||||
Do this instead:
|
||||
|
||||
while (true)
|
||||
{ /* Always put braces around a multi-line body. */
|
||||
/* explanation... */
|
||||
single_line_stmt ();
|
||||
}
|
||||
|
||||
There is one exception: when the second body line is not at the same
|
||||
indentation level as the first body line.
|
||||
|
||||
if (expr)
|
||||
error (0, 0, _("a diagnostic that would make this line"
|
||||
" extend past the 80-column limit"));
|
||||
|
||||
It is safe to omit the braces in the code above, since the
|
||||
further-indented second body line makes it obvious that this is still
|
||||
a single-statement body.
|
||||
|
||||
To reiterate, don't do this:
|
||||
|
||||
if (expr)
|
||||
while (expr_2) // BAD: multi-line body without braces
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
Do this, instead:
|
||||
|
||||
if (expr)
|
||||
{
|
||||
while (expr_2)
|
||||
{
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
However, there is one exception in the other direction, when even a
|
||||
one-line block should have braces. That occurs when that one-line,
|
||||
brace-less block is an "else" block, and the corresponding "then" block
|
||||
*does* use braces. In that case, either put braces around the "else"
|
||||
block, or negate the "if"-condition and swap the bodies, putting the
|
||||
one-line block first and making the longer, multi-line block be the
|
||||
"else" block.
|
||||
|
||||
if (expr)
|
||||
{
|
||||
...
|
||||
...
|
||||
}
|
||||
else
|
||||
x = y; // BAD: braceless "else" with braced "then"
|
||||
|
||||
This is preferred, especially when the multi-line body is more than a
|
||||
few lines long, because it is easier to read and grasp the semantics of
|
||||
an if-then-else block when the simpler block occurs first, rather than
|
||||
after the more involved block:
|
||||
|
||||
if (!expr)
|
||||
x = y; /* more readable */
|
||||
else
|
||||
{
|
||||
...
|
||||
...
|
||||
}
|
||||
|
||||
If you'd rather not negate the condition, then add braces:
|
||||
|
||||
if (expr)
|
||||
{
|
||||
...
|
||||
...
|
||||
}
|
||||
else
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
|
||||
|
||||
Use SPACE-only indentation in all[*] files
|
||||
==========================================
|
||||
We use space-only indentation in nearly all files.
|
||||
@@ -310,9 +411,9 @@ Nearly every significant change must be accompanied by a test suite
|
||||
addition that exercises it. If you fix a bug, add at least one test that
|
||||
fails without the patch, but that succeeds once your patch is applied.
|
||||
If you add a feature, add tests to exercise as much of the new code
|
||||
as possible. Note to run tests/misc/newtest in isolation you can do:
|
||||
as possible. Note to run tests/misc/new-test in isolation you can do:
|
||||
|
||||
(cd tests && make check TESTS=misc/newtest VERBOSE=yes)
|
||||
(cd tests && make check TESTS=misc/new-test VERBOSE=yes)
|
||||
|
||||
There are hundreds of tests in the tests/ directories. You can use
|
||||
tests/sample-test as a template, or one of the various Perl-based ones
|
||||
@@ -481,10 +582,10 @@ Then just open the index.html file (in the generated lcov-html directory)
|
||||
in your favorite web browser.
|
||||
|
||||
========================================================================
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Make coreutils. -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 1990, 1993-2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1990, 1993-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -46,7 +46,9 @@ syntax_check_exceptions = \
|
||||
.x-sc_obsolete_symbols \
|
||||
.x-sc_po_check \
|
||||
.x-sc_program_name \
|
||||
.x-sc_prohibit_always-defined_macros \
|
||||
.x-sc_prohibit_atoi_atof \
|
||||
.x-sc_prohibit_empty_lines_at_EOF \
|
||||
.x-sc_prohibit_fail_0 \
|
||||
.x-sc_prohibit_magic_number_exit \
|
||||
.x-sc_prohibit_stat_st_blocks \
|
||||
@@ -58,6 +60,7 @@ syntax_check_exceptions = \
|
||||
.x-sc_sun_os_names \
|
||||
.x-sc_system_h_headers \
|
||||
.x-sc_trailing_blank \
|
||||
.x-sc_prohibit_always_true_header_tests \
|
||||
.x-sc_unmarked_diagnostics \
|
||||
.x-sc_useless_cpp_parens
|
||||
|
||||
|
||||
264
NEWS
264
NEWS
@@ -1,5 +1,265 @@
|
||||
GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release 8.6 (2010-10-15) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
du no longer multiply counts a file that is a directory or whose
|
||||
link count is 1, even if the file is reached multiple times by
|
||||
following symlinks or via multiple arguments.
|
||||
|
||||
du -H and -L now consistently count pointed-to files instead of
|
||||
symbolic links, and correctly diagnose dangling symlinks.
|
||||
|
||||
du --ignore=D now ignores directory D even when that directory is
|
||||
found to be part of a directory cycle. Before, du would issue a
|
||||
"NOTIFY YOUR SYSTEM MANAGER" diagnostic and fail.
|
||||
|
||||
split now diagnoses read errors rather than silently exiting.
|
||||
[bug introduced in coreutils-4.5.8]
|
||||
|
||||
tac would perform a double-free when given an input line longer than 16KiB.
|
||||
[bug introduced in coreutils-8.3]
|
||||
|
||||
tail -F once again notices changes in a currently unavailable directory,
|
||||
and works around a Linux kernel bug where inotify runs out of resources.
|
||||
[bugs introduced in coreutils-7.5]
|
||||
|
||||
tr now consistently handles case conversion character classes.
|
||||
In some locales, valid conversion specifications caused tr to abort,
|
||||
while in all locales, some invalid specifications were undiagnosed.
|
||||
[bugs introduced in coreutils 6.9.90 and 6.9.92]
|
||||
|
||||
** New features
|
||||
|
||||
cp now accepts the --attributes-only option to not copy file data,
|
||||
which is useful for efficiently modifying files.
|
||||
|
||||
du recognizes -d N as equivalent to --max-depth=N, for compatibility
|
||||
with FreeBSD.
|
||||
|
||||
sort now accepts the --debug option, to highlight the part of the
|
||||
line significant in the sort, and warn about questionable options.
|
||||
|
||||
sort now supports -d, -f, -i, -R, and -V in any combination.
|
||||
|
||||
stat now accepts the %m format directive to output the mount point
|
||||
for a file. It also accepts the %w and %W format directives for
|
||||
outputting the birth time of a file, if one is available.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
df now consistently prints the device name for a bind mounted file,
|
||||
rather than its aliased target.
|
||||
|
||||
du now uses less than half as much memory when operating on trees
|
||||
with many hard-linked files. With --count-links (-l), or when
|
||||
operating on trees with no hard-linked files, there is no change.
|
||||
|
||||
ls -l now uses the traditional three field time style rather than
|
||||
the wider two field numeric ISO style, in locales where a style has
|
||||
not been specified. The new approach has nicer behavior in some
|
||||
locales, including English, which was judged to outweigh the disadvantage
|
||||
of generating less-predictable and often worse output in poorly-configured
|
||||
locales where there is an onus to specify appropriate non-default styles.
|
||||
[The old behavior was introduced in coreutils-6.0 and had been removed
|
||||
for English only using a different method since coreutils-8.1]
|
||||
|
||||
rm's -d now evokes an error; before, it was silently ignored.
|
||||
|
||||
sort -g now uses long doubles for greater range and precision.
|
||||
|
||||
sort -h no longer rejects numbers with leading or trailing ".", and
|
||||
no longer accepts numbers with multiple ".". It now considers all
|
||||
zeros to be equal.
|
||||
|
||||
sort now uses the number of available processors to parallelize
|
||||
the sorting operation. The number of sorts run concurrently can be
|
||||
limited with the --parallel option or with external process
|
||||
control like taskset for example.
|
||||
|
||||
stat now provides translated output when no format is specified.
|
||||
|
||||
stat no longer accepts the --context (-Z) option. Initially it was
|
||||
merely accepted and ignored, for compatibility. Starting two years
|
||||
ago, with coreutils-7.0, its use evoked a warning. Printing the
|
||||
SELinux context of a file can be done with the %C format directive,
|
||||
and the default output when no format is specified now automatically
|
||||
includes %C when context information is available.
|
||||
|
||||
stat no longer accepts the %C directive when the --file-system
|
||||
option is in effect, since security context is a file attribute
|
||||
rather than a file system attribute.
|
||||
|
||||
stat now outputs the full sub-second resolution for the atime,
|
||||
mtime, and ctime values since the Epoch, when using the %X, %Y, and
|
||||
%Z directives of the --format option. This matches the fact that
|
||||
%x, %y, and %z were already doing so for the human-readable variant.
|
||||
|
||||
touch's --file option is no longer recognized. Use --reference=F (-r)
|
||||
instead. --file has not been documented for 15 years, and its use has
|
||||
elicited a warning since coreutils-7.1.
|
||||
|
||||
truncate now supports setting file sizes relative to a reference file.
|
||||
Also errors are no longer suppressed for unsupported file types, and
|
||||
relative sizes are restricted to supported file types.
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.5 (2010-04-23) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cp and mv once again support preserving extended attributes.
|
||||
[bug introduced in coreutils-8.4]
|
||||
|
||||
cp now preserves "capabilities" when also preserving file ownership.
|
||||
|
||||
ls --color once again honors the 'NORMAL' dircolors directive.
|
||||
[bug introduced in coreutils-6.11]
|
||||
|
||||
sort -M now handles abbreviated months that are aligned using blanks
|
||||
in the locale database. Also locales with 8 bit characters are
|
||||
handled correctly, including multi byte locales with the caveat
|
||||
that multi byte characters are matched case sensitively.
|
||||
|
||||
sort again handles obsolescent key formats (+POS -POS) correctly.
|
||||
Previously if -POS was specified, 1 field too many was used in the sort.
|
||||
[bug introduced in coreutils-7.2]
|
||||
|
||||
** New features
|
||||
|
||||
join now accepts the --header option, to treat the first line of each
|
||||
file as a header line to be joined and printed unconditionally.
|
||||
|
||||
timeout now accepts the --kill-after option which sends a kill
|
||||
signal to the monitored command if it's still running the specified
|
||||
duration after the initial signal was sent.
|
||||
|
||||
who: the "+/-" --mesg (-T) indicator of whether a user/tty is accepting
|
||||
messages could be incorrectly listed as "+", when in fact, the user was
|
||||
not accepting messages (mesg no). Before, who would examine only the
|
||||
permission bits, and not consider the group of the TTY device file.
|
||||
Thus, if a login tty's group would change somehow e.g., to "root",
|
||||
that would make it unwritable (via write(1)) by normal users, in spite
|
||||
of whatever the permission bits might imply. Now, when configured
|
||||
using the --with-tty-group[=NAME] option, who also compares the group
|
||||
of the TTY device with NAME (or "tty" if no group name is specified).
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
ls --color no longer emits the final 3-byte color-resetting escape
|
||||
sequence when it would be a no-op.
|
||||
|
||||
join -t '' no longer emits an error and instead operates on
|
||||
each line as a whole (even if they contain NUL characters).
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.4 (2010-01-13) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
nproc --all is now guaranteed to be as large as the count
|
||||
of available processors, which may not have been the case
|
||||
on GNU/Linux systems with neither /proc nor /sys available.
|
||||
[bug introduced in coreutils-8.1]
|
||||
|
||||
** Build-related
|
||||
|
||||
Work around a build failure when using buggy <sys/capability.h>.
|
||||
Alternatively, configure with --disable-libcap.
|
||||
|
||||
Compilation would fail on systems using glibc-2.7..2.9 due to changes in
|
||||
gnulib's wchar.h that tickled a bug in at least those versions of glibc's
|
||||
own <wchar.h> header. Now, gnulib works around the bug in those older
|
||||
glibc <wchar.h> headers.
|
||||
|
||||
Building would fail with a link error (cp/copy.o) when XATTR headers
|
||||
were installed without the corresponding library. Now, configure
|
||||
detects that and disables xattr support, as one would expect.
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.3 (2010-01-07) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cp -p, install -p, mv, and touch -c could trigger a spurious error
|
||||
message when using new glibc coupled with an old kernel.
|
||||
[bug introduced in coreutils-6.12].
|
||||
|
||||
ls -l --color no longer prints "argetm" in front of dangling
|
||||
symlinks when the 'LINK target' directive was given to dircolors.
|
||||
[bug introduced in fileutils-4.0]
|
||||
|
||||
pr's page header was improperly formatted for long file names.
|
||||
[bug introduced in coreutils-7.2]
|
||||
|
||||
rm -r --one-file-system works once again.
|
||||
The rewrite to make rm use fts introduced a regression whereby
|
||||
a commmand of the above form would fail for all subdirectories.
|
||||
[bug introduced in coreutils-8.0]
|
||||
|
||||
stat -f recognizes more file system types: k-afs, fuseblk, gfs/gfs2, ocfs2,
|
||||
and rpc_pipefs. Also Minix V3 is displayed correctly as minix3, not minux3.
|
||||
[bug introduced in coreutils-8.1]
|
||||
|
||||
tail -f (inotify-enabled) once again works with remote files.
|
||||
The use of inotify with remote files meant that any changes to those
|
||||
files that was not done from the local system would go unnoticed.
|
||||
[bug introduced in coreutils-7.5]
|
||||
|
||||
tail -F (inotify-enabled) would abort when a tailed file is repeatedly
|
||||
renamed-aside and then recreated.
|
||||
[bug introduced in coreutils-7.5]
|
||||
|
||||
tail -F (inotify-enabled) could fail to follow renamed files.
|
||||
E.g., given a "tail -F a b" process, running "mv a b" would
|
||||
make tail stop tracking additions to "b".
|
||||
[bug introduced in coreutils-7.5]
|
||||
|
||||
touch -a and touch -m could trigger bugs in some file systems, such
|
||||
as xfs or ntfs-3g, and fail to update timestamps.
|
||||
[bug introduced in coreutils-8.1]
|
||||
|
||||
wc now prints counts atomically so that concurrent
|
||||
processes will not intersperse their output.
|
||||
[the issue dates back to the initial implementation]
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.2 (2009-12-11) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
id's use of mgetgroups no longer writes beyond the end of a malloc'd buffer
|
||||
[bug introduced in coreutils-8.1]
|
||||
|
||||
id no longer crashes on systems without supplementary group support.
|
||||
[bug introduced in coreutils-8.1]
|
||||
|
||||
rm once again handles zero-length arguments properly.
|
||||
The rewrite to make rm use fts introduced a regression whereby
|
||||
a command like "rm a '' b" would fail to remove "a" and "b", due to
|
||||
the presence of the empty string argument.
|
||||
[bug introduced in coreutils-8.0]
|
||||
|
||||
sort is now immune to the signal handling of its parent.
|
||||
Specifically sort now doesn't exit with an error message
|
||||
if it uses helper processes for compression and its parent
|
||||
ignores CHLD signals. [bug introduced in coreutils-6.9]
|
||||
|
||||
tail without -f no longer access uninitialized memory
|
||||
[bug introduced in coreutils-7.6]
|
||||
|
||||
timeout is now immune to the signal handling of its parent.
|
||||
Specifically timeout now doesn't exit with an error message
|
||||
if its parent ignores CHLD signals. [bug introduced in coreutils-7.6]
|
||||
|
||||
a user running "make distcheck" in the coreutils source directory,
|
||||
with TMPDIR unset or set to the name of a world-writable directory,
|
||||
and with a malicious user on the same system
|
||||
was vulnerable to arbitrary code execution
|
||||
[bug introduced in coreutils-5.0]
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.1 (2009-11-18) [stable]
|
||||
|
||||
** Bug fixes
|
||||
@@ -2800,10 +3060,10 @@ packages, see ./old/*/NEWS.
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 2001-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2010 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
7
README
7
README
@@ -223,16 +223,19 @@ For general documentation on the coding and usage standards
|
||||
this distribution follows, see the GNU Coding Standards,
|
||||
http://www.gnu.org/prep/standards_toc.html.
|
||||
|
||||
For any copyright year range specified as YYYY-ZZZZ in this package
|
||||
note that the range specifies every single year in that closed interval.
|
||||
|
||||
Mail suggestions and bug reports for these programs to
|
||||
the address on the last line of --help output.
|
||||
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 1998, 2002-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2002-2010 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
@@ -28,11 +28,23 @@ You can get a copy of the source repository like this:
|
||||
$ git clone git://git.sv.gnu.org/coreutils
|
||||
$ cd coreutils
|
||||
|
||||
As an optional step, if you already have a copy of the gnulib git
|
||||
repository on your hard drive, then you can use it as a reference to
|
||||
reduce download time and disk space requirements:
|
||||
|
||||
$ export GNULIB_SRCDIR=/path/to/gnulib
|
||||
|
||||
The next step is to get and check other files needed to build,
|
||||
which are extracted from other source packages:
|
||||
|
||||
$ ./bootstrap
|
||||
|
||||
To use the most-recent gnulib (as opposed to the gnulib version that
|
||||
the package last synchronized to), do this next:
|
||||
|
||||
$ git submodule foreach git pull origin master
|
||||
$ git commit -m 'build: update gnulib submodule to latest' gnulib
|
||||
|
||||
And there you are! Just
|
||||
|
||||
$ ./configure --quiet #[--enable-gcc-warnings] [*]
|
||||
@@ -54,9 +66,32 @@ to use recent system headers. If you configure with this option,
|
||||
and spot a problem, please be sure to send the report to the bug
|
||||
reporting address of this package, and not to that of gnulib, even
|
||||
if the problem seems to originate in a gnulib-provided file.
|
||||
|
||||
* Submitting patches
|
||||
|
||||
If you develop a fix or a new feature, please send it to the
|
||||
appropriate bug-reporting address as reported by the --help option of
|
||||
each program. One way to do this is to use vc-dwim
|
||||
<http://www.gnu.org/software/vc-dwim/>), as follows.
|
||||
|
||||
Run the command "vc-dwim --help", copy its definition of the
|
||||
"git-changelog-symlink-init" function into your shell, and then run
|
||||
this function at the top-level directory of the package.
|
||||
|
||||
Edit the ChangeLog file that this command creates, creating a
|
||||
properly-formatted entry according to the GNU coding standards
|
||||
<http://www.gnu.org/prep/standards/html_node/Change-Logs.html>.
|
||||
|
||||
Run the command "vc-dwim" and make sure its output looks good.
|
||||
|
||||
Run "vc-dwim --commit".
|
||||
|
||||
Run the command "git format-patch --stdout -1", and email its output
|
||||
in, using the output's subject line.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -10,9 +10,12 @@ coreutils package, see these:
|
||||
|
||||
http://mail.gnu.org/mailman/listinfo/coreutils-announce
|
||||
http://mail.gnu.org/mailman/listinfo/bug-coreutils
|
||||
http://mail.gnu.org/mailman/listinfo/coreutils
|
||||
|
||||
mailing list archives are here:
|
||||
|
||||
http://news.gmane.org/gmane.comp.gnu.coreutils.announce
|
||||
http://news.gmane.org/gmane.comp.gnu.core-utils.bugs (up to the minute)
|
||||
http://mail.gnu.org/pipermail/bug-coreutils/ (updated every 12 hours)
|
||||
http://news.gmane.org/gmane.comp.gnu.coreutils.general
|
||||
http://mail.gnu.org/pipermail/coreutils/ (updated every 12 hours)
|
||||
|
||||
@@ -14,18 +14,26 @@ I.E. the tools checked for by the bootstrap script and include:
|
||||
- Texinfo <http://www.gnu.org/software/texinfo/>
|
||||
|
||||
Note please try to install/build official packages for your system.
|
||||
If these are not available then one can make them available only to
|
||||
the coreutils build using the following instructions. Even if the
|
||||
official packages for your system are too old, please install them
|
||||
as they may be required to build the newer versions.
|
||||
If these programs are not available use the following instructions
|
||||
to build them and install the results into a directory that you will
|
||||
then use when building this package.
|
||||
|
||||
Even if the official version of a package for your system is too old,
|
||||
please install it, as it may be required to build the newer versions.
|
||||
The examples below install into $HOME/coreutils/deps/, so if you are
|
||||
going to follow these instructions, first ensure that your $PATH is
|
||||
set correctly by running this command:
|
||||
|
||||
prefix=$HOME/coreutils/deps
|
||||
export PATH=$prefix/bin:$PATH
|
||||
|
||||
* autoconf *
|
||||
|
||||
# Note Autoconf 2.62 or newer is needed to build automake-1.11
|
||||
# Note Autoconf 2.62 or newer is needed to build automake-1.11.1
|
||||
git clone --depth=1 git://git.sv.gnu.org/autoconf.git
|
||||
git checkout v2.62
|
||||
autoreconf -vi
|
||||
./configure --prefix=$HOME/coreutils/deps
|
||||
./configure --prefix=$prefix
|
||||
make install
|
||||
|
||||
* automake *
|
||||
@@ -33,12 +41,12 @@ as they may be required to build the newer versions.
|
||||
# Note help2man is required to build automake fully
|
||||
git clone git://git.sv.gnu.org/automake.git
|
||||
cd automake
|
||||
git checkout -b branch-1.11 --track origin/branch-1.11
|
||||
git checkout v1.11.1
|
||||
./bootstrap
|
||||
./configure --prefix=$HOME/coreutils/deps
|
||||
./configure --prefix=$prefix
|
||||
make install
|
||||
|
||||
coreutils uses XZ utils (successor to LZMA) to create
|
||||
This package uses XZ utils (successor to LZMA) to create
|
||||
a compressed distribution tarball. Using this feature of Automake
|
||||
requires version 1.10a or newer, as well as the xz program itself.
|
||||
|
||||
@@ -47,10 +55,7 @@ requires version 1.10a or newer, as well as the xz program itself.
|
||||
git clone git://ctrl.tukaani.org/xz.git
|
||||
cd xz
|
||||
./autogen.sh
|
||||
./configure --prefix=$HOME/coreutils/deps
|
||||
./configure --prefix=$prefix
|
||||
make install
|
||||
|
||||
Now we can build coreutils as described in README-hacking
|
||||
as long as $PATH starts with $HOME/coreutils/deps/bin, which
|
||||
one can set for the current shell like:
|
||||
$ export PATH=$HOME/coreutils/deps/bin:$PATH
|
||||
Now you can build this package as described in README-hacking.
|
||||
|
||||
@@ -13,26 +13,39 @@ Here are most of the steps we (maintainers) follow when making a release.
|
||||
* Ensure that you're on "master" with no uncommitted diffs.
|
||||
This should produce no output: git checkout master; git diff
|
||||
|
||||
* Run bootstrap: ./bootstrap
|
||||
* Ensure that you've pushed all changes that belong in the release
|
||||
and that the NixOS/Hydra autobuilder is reporting all is well:
|
||||
|
||||
http://hydra.nixos.org/jobset/gnu/coreutils-master
|
||||
|
||||
* Run bootstrap one last time. This downloads any new translations:
|
||||
|
||||
./bootstrap
|
||||
|
||||
FIXME: enable excluded programs like arch? to get their manual pages?
|
||||
|
||||
* Pre-release testing:
|
||||
Ensure that make check syntax-check succeeds.
|
||||
On at least one SELinux-enabled (enforcing) and one non-SELinux system,
|
||||
run all tests, both root-only and regular.
|
||||
Run *all* non-root tests, including expensive and very expensive ones i.e.,
|
||||
run this: make -j1 check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
|
||||
|
||||
Run the root-only tests:
|
||||
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
|
||||
Run the following on at least one SELinux-enabled (enforcing) and
|
||||
one non-SELinux system:
|
||||
|
||||
* Run "make distcheck"
|
||||
make distcheck
|
||||
make -j1 check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
|
||||
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
|
||||
|
||||
Note the -j1 above. If you use -jN, for larger N, some of the expensive
|
||||
tests are likely to interfere with concurrent performance-measuring or
|
||||
timing-sensitive tests, resulting in spurious failures.
|
||||
|
||||
If "make distcheck" doesn't run "make syntax-check" for you, then run
|
||||
it manually:
|
||||
|
||||
make syntax-check
|
||||
|
||||
* Set the date, version number, and release type [stable/alpha/beta] on
|
||||
line 3 of NEWS, commit that, and tag the release by running e.g.,
|
||||
|
||||
build-aux/do-release-commit-and-tag 8.1 beta
|
||||
build-aux/do-release-commit-and-tag X.Y stable
|
||||
|
||||
* Run the following to create release tarballs. Your choice selects the
|
||||
corresponding upload-to destination in the emitted gnupload command.
|
||||
@@ -46,31 +59,25 @@ FIXME: enable excluded programs like arch? to get their manual pages?
|
||||
it builds and passes all tests.
|
||||
|
||||
* While that's happening, write the release announcement that you will
|
||||
soon post.
|
||||
soon post. Start with the template, $HOME/announce-coreutils-X.Y
|
||||
that was just created by that "make" command.
|
||||
|
||||
Once all the builds and tests have passed,
|
||||
|
||||
* Run the gnupload command that was suggested by your "make major" run above.
|
||||
* Run the gnupload command that was suggested by your "make stable" run above.
|
||||
|
||||
* Wait a few minutes (maybe up to 30?) and then use the release URLs to
|
||||
download all tarball/signature pairs and use gpg --verify to ensure
|
||||
that they're all valid.
|
||||
|
||||
* Push the new tag:
|
||||
* Push the NEWS-updating changes and the new tag:
|
||||
|
||||
v=$(cat .prev-version)
|
||||
git push origin tag v$v
|
||||
git push origin master tag v$v
|
||||
|
||||
* Send the gpg-signed announcement mail, e.g.,
|
||||
* Announce it on Savannah first, so you can include the preferable
|
||||
savannah.org announcement link in the email message.
|
||||
|
||||
To: info-gnu@gnu.org, coreutils-announce@gnu.org
|
||||
Cc: coordinator@translationproject.org, bug-coreutils@gnu.org
|
||||
Subject: coreutils-8.0 released [beta]
|
||||
|
||||
* Approve the announcement here:
|
||||
http://lists.gnu.org/mailman/admindb/coreutils-announce
|
||||
|
||||
* Announce it on Savannah, too:
|
||||
From here:
|
||||
https://savannah.gnu.org/projects/coreutils/
|
||||
click on the "submit news", then write something like the following:
|
||||
@@ -78,13 +85,19 @@ Once all the builds and tests have passed,
|
||||
the Main -> "Select Features" menu item, or via this link:
|
||||
https://savannah.gnu.org/project/admin/editgroupfeatures.php?group=coreutils)
|
||||
|
||||
Subject: coreutils-0.0 released [beta]
|
||||
The announcement is here:
|
||||
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/54
|
||||
Subject: coreutils-X.Y released [stable]
|
||||
+verbatim+
|
||||
...paste the announcement here...
|
||||
-verbatim-
|
||||
|
||||
Then go here to approve it:
|
||||
https://savannah.gnu.org/news/approve.php?group=coreutils
|
||||
|
||||
* Send the announcement email message.
|
||||
|
||||
* Approve the announcement here:
|
||||
http://lists.gnu.org/mailman/admindb/coreutils-announce
|
||||
|
||||
* After each non-alpha release, update the on-line manual accessible via
|
||||
|
||||
http://www.gnu.org/software/coreutils/manual/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#! /bin/bash
|
||||
# Convert this package for use with valgrind.
|
||||
|
||||
# Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
22
THANKS
22
THANKS
@@ -8,14 +8,17 @@ the bug-report mailing list (as seen on last line of e.g., cp --help).
|
||||
|
||||
??? kytek@cybercomm.net
|
||||
A Costa agcosta@gis.net
|
||||
Aaron Burgemeister dajoker@gmail.com
|
||||
Aaron Hawley ashawley@uvm.edu
|
||||
Achim Blumensath blume@corona.oche.de
|
||||
Adam Jimerson vendion@charter.net
|
||||
Adam Klein aklein@debian.org
|
||||
Adam Sampson ats@offog.org
|
||||
Adrian Bunk bunk@stusta.de
|
||||
AIDA Shinra shinra@j10n.org
|
||||
Akim Demaille demaille@inf.enst.fr
|
||||
Alain Magloire alain@qnx.com
|
||||
Alan Curry pacman@kosh.dhis.org
|
||||
Alan Iwi iwi@atm.ox.ac.uk
|
||||
Albert Chin-A-Young china@thewrittenword.com
|
||||
Albert Hopkins ahopkins@dynacare.com
|
||||
@@ -101,9 +104,12 @@ Carl Roth roth@urs.us
|
||||
Carlos Canau Carlos.Canau@relay.puug.pt
|
||||
Charles Karney karney@pppl.gov
|
||||
Charles Randall crandall@matchlogic.com
|
||||
Chas. Owens chas.owens@gmail.com
|
||||
Chip Salzenberg chip@valinux.com
|
||||
Chris Clayton chris2553@googlemail.com
|
||||
Chris Faylor cgf@cygnus.com
|
||||
Chris J. Bednar cjb@AdvancedDataSolutions.com
|
||||
Chris Jones cjns1989@gmail.com
|
||||
Chris Lesniewski ctl@mit.edu
|
||||
Chris Sylvain csylvain@umm.edu
|
||||
Chris Yeo cyeo@biking.org
|
||||
@@ -126,6 +132,7 @@ Cyril Bouthors cyril@bouthors.org
|
||||
Dale Scheetz dwarf@polaris.net
|
||||
Dameon G. Rogers dgr03@uark.edu
|
||||
Dan Hagerty hag@gnu.ai.it.edu
|
||||
Dan Hipschman dsh@linux.ucla.edu
|
||||
Dan Jacobson jidanni@jidanni.org
|
||||
Dan Pascu dan@services.iiruc.ro
|
||||
Daniel Bergstrom noa@melody.se
|
||||
@@ -150,6 +157,7 @@ Dawson Engler engler@stanford.edu
|
||||
Dean Gaudet dean-savannah@arctic.org
|
||||
Deepak Goel deego@gnufans.org
|
||||
Denis Excoffier denis.excoffier@airbus.com
|
||||
Denis McKeon dmckeon@swcp.com
|
||||
Dennis Henriksen opus@flamingo.osrl.dk
|
||||
Dennis Smit ds@nerds-incorporated.org
|
||||
Derek Clegg dclegg@next.com
|
||||
@@ -174,6 +182,7 @@ Elbert Pol elbert.pol@gmail.com
|
||||
Eli Zaretskii eliz@is.elta.co.il
|
||||
Elias Pipping pipping@gentoo.org
|
||||
Emile LeBlanc leblanc@math.toronto.edu
|
||||
Emmanuel Lacour elacour@home-dn.net
|
||||
Erik Auerswald auerswal@unix-ag.uni-kl.de
|
||||
Eric Backus ericb@lsid.hp.com
|
||||
Eric Blake ebb9@byu.net
|
||||
@@ -186,6 +195,7 @@ Evan Hunt ethanol@armory.com
|
||||
Felix Lee flee@teleport.com
|
||||
Felix Rauch Valenti frauch@cse.unsw.edu.au
|
||||
Ferdinand fw@scenic.mine.nu
|
||||
Filipus Klutiero chealer@gmail.com
|
||||
Fletcher Mattox fletcher@cs.utexas.edu
|
||||
Florent Bayle florent@sarcelle.net
|
||||
Florian Schlichting fschlich@cis.fu-berlin.de
|
||||
@@ -250,6 +260,7 @@ Ilya N. Golubev gin@mo.msk.ru
|
||||
Ingo Saitz ingo@debian.org
|
||||
Ivan Labath labath3@st.fmph.uniba.sk
|
||||
Ivo Timmermans ivo@debian.org
|
||||
Jacky Fong jacky.fong@utoronto.ca
|
||||
James james@albion.glarp.com
|
||||
James Antill jmanti%essex.ac.uk@seralph21.essex.ac.uk
|
||||
James Lemley James.Lemley@acxiom.com
|
||||
@@ -300,6 +311,7 @@ John Kodis kodis@acm.org
|
||||
John Murphy jam@philabs.research.philips.com
|
||||
John Roll john@panic.harvard.edu
|
||||
John Salmon johns@mullet.anu.edu.au
|
||||
John Stanley johnstops@verizon.net
|
||||
John Summerfield summer@OS2.ami.com.au
|
||||
Jon Peatfield J.S.Peatfield@damtp.cam.ac.uk
|
||||
Joost van Baal joostvb@xs4all.nl
|
||||
@@ -330,10 +342,12 @@ Keith Owens kaos@audio.apana.org.au
|
||||
Keith Thompson kst@cts.com
|
||||
Ken Pizzini kenp@halcyon.com
|
||||
Kevin Mudrick kmudrick@healthmarketscience.com
|
||||
Kim Hansen kim@i9.dk
|
||||
Kirk Kelsey kirk.kelsey@0x4b.net
|
||||
Kristin E Thomas kristint@us.ibm.com
|
||||
Kjetil Torgrim Homme kjetilho@ifi.uio.no
|
||||
Kristoffer Rose kris@diku.dk
|
||||
Ladislav Hagara ladislav.hagara@unob.cz
|
||||
Larry McVoy lm@sgi.com
|
||||
Lars Hecking lhecking@nmrc.ucc.ie
|
||||
Leah Q eequor@earthlink.net
|
||||
@@ -489,6 +503,7 @@ Philippe Schnoebelen Philippe.Schnoebelen@imag.fr
|
||||
Phillip Jones mouse@datastacks.com
|
||||
Piergiorgio Sartor sartor@sony.de
|
||||
Pieter Bowman bowman@math.utah.edu
|
||||
Piotr Gackiewicz gacek@intertele.pl
|
||||
Piotr Kwapulinski kwap@univ.gda.pl
|
||||
Prashant TR tr@eth.net
|
||||
Priit Jõerüüt jemm4jemm@yahoo.com
|
||||
@@ -509,9 +524,12 @@ Richard Sharman rsharman@magmacom.com
|
||||
Rick Sladkey jrs@world.std.com
|
||||
Rik Faith faith@cs.unc.edu
|
||||
Risto Kankkunen kankkune@lingsoft.fi
|
||||
Rob Wortman wyrm@haell.com
|
||||
Robert H. de Vries robert@and.nl
|
||||
Robert Lindgren robert@orcafat.com
|
||||
Robert Millan zeratul2@wanadoo.es
|
||||
Robert Schwebel r.schwebel@pengutronix.de
|
||||
Robin H. Johnson robbat2@gentoo.org
|
||||
Rogier Wolff R.E.Wolff@BitWizard.nl
|
||||
Roland Huebner ro-huebner@gmx.de
|
||||
Roland Turner raz.tah.bet@raz.cx
|
||||
@@ -528,6 +546,7 @@ Samuli Karkkainen Samuli.Karkkainen@hut.fi
|
||||
Sander van Malssen svm@kozmix.ow.nl
|
||||
Santiago Vila Doncel sanvila@unex.es
|
||||
Savochkin Andrey Vladimirovich saw@msu.ru
|
||||
Scott Harrison scott.gnu.2009@scottrix.co.uk
|
||||
Scott Lurndal slurn@griffin.engr.sgi.com
|
||||
Sébastien Maret smaret@umich.edu
|
||||
Sergei Steshenko sergstesh@yahoo.com
|
||||
@@ -537,6 +556,7 @@ Solar Designer solar@owl.openwall.com
|
||||
Stanislav Ievlev inger@altlinux.ru
|
||||
Stavros Passas stabat@ics.forth.gr
|
||||
Stéphane Chazelas Stephane_CHAZELAS@yahoo.fr
|
||||
Stéphane Raimbault stephane.raimbault@makina-corpus.com
|
||||
Stephen Depooter sbdep@myrealbox.com
|
||||
Stephen Eglen eglen@pcg.wustl.edu
|
||||
Stephen Gildea gildea@stop.mail-abuse.org
|
||||
@@ -550,6 +570,7 @@ Steven Mocking ufo@quicknet.nl
|
||||
Steven Parkes smparkes@smparkes.net
|
||||
Steven Schveighoffer schveiguy@yahoo.com
|
||||
Steven P Watson steven@magelico.net
|
||||
Stuart Citrin ctrn3e8@gmail.com
|
||||
Stuart Kemp skemp@peter.bmc.com
|
||||
Stuart Shelton stuart@shelton.me
|
||||
Sven Joachim svenjoac@gmx.de
|
||||
@@ -620,6 +641,7 @@ Wolfram Kleff kleff@cs.uni-bonn.de
|
||||
Won-kyu Park wkpark@chem.skku.ac.kr
|
||||
Yanko Kaneti yaneti@declera.com
|
||||
Yann Dirson dirson@debian.org
|
||||
Yutaka Amanai yasai-itame1942@jade.plala.or.jp
|
||||
Zvi Har'El rl@math.technion.ac.il
|
||||
|
||||
;; Local Variables:
|
||||
|
||||
9
TODO
9
TODO
@@ -34,6 +34,9 @@ printf:
|
||||
platforms where the native *printf(3) is deficient.
|
||||
Suggestion from Eric Blake.
|
||||
|
||||
consider adding some implementation of the "col" utility
|
||||
Suggested by Karl Berry.
|
||||
|
||||
renice: POSIX utility, needs implementing.
|
||||
suggestion from Karl Berry (among others).
|
||||
Bob Proulx is working on this.
|
||||
@@ -59,10 +62,6 @@ Integrate use of sendfile, suggested here:
|
||||
http://mail.gnu.org/archive/html/bug-fileutils/2003-03/msg00030.html
|
||||
I don't plan to do that, since a few tests demonstrate no significant benefit.
|
||||
|
||||
Should printf '\0123' print "\n3"?
|
||||
per report from TAKAI Kousuke on Mar 27
|
||||
http://mail.gnu.org/archive/html/bug-coreutils/2003-03/index.html
|
||||
|
||||
printf: consider adapting builtins/printf.def from bash
|
||||
|
||||
tail: don't use xlseek; it *exits*.
|
||||
@@ -169,7 +168,7 @@ pr's use of nstrftime can make it malloc a very large (up to SIZE_MAX) buffer
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
154
bootstrap
154
bootstrap
@@ -1,8 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2010-10-05.15; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +19,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Paul Eggert.
|
||||
# Originally written by Paul Eggert. The canonical version of this
|
||||
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
||||
# be useful to your project, you should place a copy of it under
|
||||
# version control in the top-level directory of your project. The
|
||||
# intent is that all customization can be done with a bootstrap.conf
|
||||
# file also maintained in your version control; gnulib comes with a
|
||||
# template build-aux/bootstrap.conf to get you started.
|
||||
|
||||
# Please report bugs or propose patches to bug-gnulib@gnu.org.
|
||||
|
||||
nl='
|
||||
'
|
||||
@@ -43,7 +53,7 @@ Options:
|
||||
sources reside. Use this if you already
|
||||
have gnulib sources on your machine, and
|
||||
do not want to waste your bandwidth downloading
|
||||
them again.
|
||||
them again. Defaults to \$GNULIB_SRCDIR.
|
||||
--copy Copy files instead of creating symbolic links.
|
||||
--force Attempt to bootstrap even if the sources seem
|
||||
not to have been checked out.
|
||||
@@ -80,7 +90,8 @@ bootstrap_epilogue() { :; }
|
||||
# options because the latest/%s directory and the .po files within are
|
||||
# all symlinks.
|
||||
po_download_command_format=\
|
||||
"rsync -Lrtvz 'translationproject.org::tp/latest/%s/' '%s'"
|
||||
"rsync --delete --exclude '*.s1' -Lrtvz \
|
||||
'translationproject.org::tp/latest/%s/' '%s'"
|
||||
|
||||
extract_package_name='
|
||||
/^AC_INIT(/{
|
||||
@@ -133,7 +144,8 @@ XGETTEXT_OPTIONS='\\\
|
||||
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
|
||||
'
|
||||
|
||||
# Package bug report address for gettext files
|
||||
# Package bug report address and copyright holder for gettext files
|
||||
COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
|
||||
MSGID_BUGS_ADDRESS=bug-$package@gnu.org
|
||||
|
||||
# Files we don't want to import.
|
||||
@@ -160,7 +172,6 @@ vc_ignore=auto
|
||||
# die otherwise.
|
||||
find_tool ()
|
||||
{
|
||||
# Find sha1sum, named gsha1sum on MacPorts.
|
||||
find_tool_envvar=$1
|
||||
shift
|
||||
find_tool_names=$@
|
||||
@@ -188,8 +199,8 @@ find_tool ()
|
||||
eval "export $find_tool_envvar"
|
||||
}
|
||||
|
||||
# Find sha1sum, named gsha1sum on MacPorts.
|
||||
find_tool SHA1SUM sha1sum gsha1sum
|
||||
# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
|
||||
find_tool SHA1SUM sha1sum gsha1sum shasum
|
||||
|
||||
# Override the default configuration, if necessary.
|
||||
# Make sure that bootstrap.conf is sourced from the current directory
|
||||
@@ -314,10 +325,20 @@ get_version() {
|
||||
$app --version >/dev/null 2>&1 || return 1
|
||||
|
||||
$app --version 2>&1 |
|
||||
sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
|
||||
sed -n '# extract version within line
|
||||
s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
|
||||
t done
|
||||
|
||||
# extract version at start of line
|
||||
s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
|
||||
t done
|
||||
|
||||
d
|
||||
|
||||
:done
|
||||
#the following essentially does s/5.005/5.5/
|
||||
s/\.0*\([1-9]\)/.\1/g
|
||||
p
|
||||
q'
|
||||
}
|
||||
|
||||
@@ -325,8 +346,12 @@ check_versions() {
|
||||
ret=0
|
||||
|
||||
while read app req_ver; do
|
||||
# We only need libtoolize from the libtool package.
|
||||
if test "$app" = libtool; then
|
||||
app=libtoolize
|
||||
fi
|
||||
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
|
||||
appvar=`echo $app | tr '[a-z]' '[A-Z]'`
|
||||
appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
|
||||
test "$appvar" = TAR && appvar=AMTAR
|
||||
eval "app=\${$appvar-$app}"
|
||||
inst_ver=$(get_version $app)
|
||||
@@ -349,16 +374,30 @@ check_versions() {
|
||||
print_versions() {
|
||||
echo "Program Min_version"
|
||||
echo "----------------------"
|
||||
printf "$buildreq"
|
||||
printf %s "$buildreq"
|
||||
echo "----------------------"
|
||||
# can't depend on column -t
|
||||
}
|
||||
|
||||
use_libtool=0
|
||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
||||
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||
# but that's not portable enough (e.g., for Solaris).
|
||||
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
if test $use_libtool = 1; then
|
||||
find_tool LIBTOOLIZE glibtoolize libtoolize
|
||||
fi
|
||||
|
||||
if ! printf "$buildreq" | check_versions; then
|
||||
test -f README-prereq &&
|
||||
echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2
|
||||
echo
|
||||
print_versions
|
||||
echo >&2
|
||||
if test -f README-prereq; then
|
||||
echo "See README-prereq for notes on obtaining the prerequisite programs" >&2
|
||||
else
|
||||
echo "Please install the prerequisite programs" >&2
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -380,7 +419,7 @@ fi
|
||||
|
||||
cleanup_gnulib() {
|
||||
status=$?
|
||||
rm -fr gnulib
|
||||
rm -fr "$gnulib_path"
|
||||
exit $status
|
||||
}
|
||||
|
||||
@@ -388,6 +427,9 @@ git_modules_config () {
|
||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||
}
|
||||
|
||||
gnulib_path=`git_modules_config submodule.gnulib.path`
|
||||
: ${gnulib_path=gnulib}
|
||||
|
||||
# Get gnulib files.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
@@ -397,30 +439,44 @@ case ${GNULIB_SRCDIR--} in
|
||||
git submodule init || exit $?
|
||||
git submodule update || exit $?
|
||||
|
||||
elif [ ! -d gnulib ]; then
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
|
||||
git clone $shallow git://git.sv.gnu.org/gnulib ||
|
||||
shallow=
|
||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
|
||||
cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
GNULIB_SRCDIR=gnulib
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Redirect the gnulib submodule to the directory on the command line
|
||||
# if possible.
|
||||
# Use GNULIB_SRCDIR as a reference.
|
||||
if test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
git submodule init
|
||||
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
|
||||
git_modules_config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule update || exit $?
|
||||
GNULIB_SRCDIR=gnulib
|
||||
if git submodule -h|grep -- --reference > /dev/null; then
|
||||
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
||||
"$gnulib_path" || exit $?
|
||||
else
|
||||
# This fallback allows at least git 1.5.5.
|
||||
if test -f "$gnulib_path"/gnulib-tool; then
|
||||
# Since file already exists, assume submodule init already complete.
|
||||
git submodule update || exit $?
|
||||
else
|
||||
# Older git can't clone into an empty directory.
|
||||
rmdir "$gnulib_path" 2>/dev/null
|
||||
git clone --reference "$GNULIB_SRCDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init && git submodule update \
|
||||
|| exit $?
|
||||
fi
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -438,22 +494,24 @@ download_po_files() {
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
# Download .po files to $po_dir/.reference and copy only the new
|
||||
# Mirror .po files to $po_dir/.reference and copy only the new
|
||||
# or modified ones into $po_dir. Also update $po_dir/LINGUAS.
|
||||
# Note po files that exist locally only are left in $po_dir but will
|
||||
# not be included in LINGUAS and hence will not be distributed.
|
||||
update_po_files() {
|
||||
# Directory containing primary .po files.
|
||||
# Overwrite them only when we're sure a .po file is new.
|
||||
po_dir=$1
|
||||
domain=$2
|
||||
|
||||
# Download *.po files into this dir.
|
||||
# Mirror *.po files into this dir.
|
||||
# Usually contains *.s1 checksum files.
|
||||
ref_po_dir="$po_dir/.reference"
|
||||
|
||||
test -d $ref_po_dir || mkdir $ref_po_dir || return
|
||||
download_po_files $ref_po_dir $domain \
|
||||
&& ls "$ref_po_dir"/*.po 2>/dev/null |
|
||||
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
|
||||
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
|
||||
|
||||
langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
|
||||
test "$langs" = '*' && langs=x
|
||||
@@ -584,7 +642,6 @@ cp_mark_as_generated()
|
||||
(
|
||||
echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
|
||||
echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
|
||||
echo '#line 1' &&
|
||||
sed "s!$bt_regex/!!g" "$cp_src"
|
||||
) > $cp_dst-t &&
|
||||
if cmp -s "$cp_dst-t" "$cp_dst"; then
|
||||
@@ -627,7 +684,7 @@ slurp() {
|
||||
for excluded_file in $excluded_files; do
|
||||
test "$dir/$file" = "$excluded_file" && continue 2
|
||||
done
|
||||
if test $file = Makefile.am; then
|
||||
if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
|
||||
copied=$copied${sep}$gnulib_mk; sep=$nl
|
||||
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
|
||||
sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
|
||||
@@ -645,7 +702,7 @@ slurp() {
|
||||
rm -f $dir/$file
|
||||
sed '
|
||||
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
|
||||
AC_DEFUN([AM_INTL_SUBDIR], [
|
||||
AC_DEFUN([AM_INTL_SUBDIR], [])
|
||||
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
|
||||
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
|
||||
$a\
|
||||
@@ -697,6 +754,12 @@ gnulib_tool_options="\
|
||||
--local-dir $local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
|
||||
slurp $bt || exit
|
||||
@@ -739,20 +802,12 @@ grep -E '^[ ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
|
||||
|
||||
for command in \
|
||||
libtool \
|
||||
"${ACLOCAL-aclocal} --force -I m4" \
|
||||
"${ACLOCAL-aclocal} --force -I m4 $ACLOCAL_FLAGS" \
|
||||
"${AUTOCONF-autoconf} --force" \
|
||||
"${AUTOHEADER-autoheader} --force" \
|
||||
"${AUTOMAKE-automake} --add-missing --copy --force-missing"
|
||||
do
|
||||
if test "$command" = libtool; then
|
||||
use_libtool=0
|
||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
||||
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||
# but that's not portable enough (e.g., for Solaris).
|
||||
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
test $use_libtool = 0 \
|
||||
&& continue
|
||||
command="${LIBTOOLIZE-libtoolize} -c -f"
|
||||
@@ -778,13 +833,14 @@ if test $with_gettext = yes; then
|
||||
rm -f po/Makevars
|
||||
sed '
|
||||
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
|
||||
/^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
|
||||
/^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
|
||||
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
|
||||
/^XGETTEXT_OPTIONS *=/{
|
||||
s/$/ \\/
|
||||
a\
|
||||
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
|
||||
}
|
||||
' po/Makevars.template >po/Makevars
|
||||
' po/Makevars.template >po/Makevars || exit 1
|
||||
|
||||
if test -d runtime-po; then
|
||||
# Similarly for runtime-po/Makevars, but not quite the same.
|
||||
@@ -798,7 +854,7 @@ if test $with_gettext = yes; then
|
||||
a\
|
||||
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
|
||||
}
|
||||
' <po/Makevars.template >runtime-po/Makevars
|
||||
' po/Makevars.template >runtime-po/Makevars || exit 1
|
||||
|
||||
# Copy identical files from po to runtime-po.
|
||||
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
|
||||
@@ -808,3 +864,11 @@ fi
|
||||
bootstrap_epilogue
|
||||
|
||||
echo "$0: done. Now you can run './configure'."
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2006-2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -22,24 +22,12 @@ avoided_gnulib_modules='
|
||||
--avoid=dummy
|
||||
'
|
||||
|
||||
# These modules are obsolete and can probably be removed soon,
|
||||
# but leave them in for now to minimize changes.
|
||||
obsolete_gnulib_modules='
|
||||
atexit
|
||||
memcmp
|
||||
memcpy
|
||||
memmove
|
||||
memset
|
||||
strcspn
|
||||
strtod
|
||||
strtol
|
||||
'
|
||||
|
||||
# gnulib modules used by this package.
|
||||
gnulib_modules="
|
||||
$avoided_gnulib_modules
|
||||
$obsolete_gnulib_modules
|
||||
acl
|
||||
alignof
|
||||
alloca
|
||||
announce-gen
|
||||
areadlink-with-size
|
||||
@@ -52,7 +40,7 @@ gnulib_modules="
|
||||
c-strcase
|
||||
c-strtod
|
||||
c-strtold
|
||||
calloc
|
||||
calloc-gnu
|
||||
canon-host
|
||||
canonicalize
|
||||
chown
|
||||
@@ -68,6 +56,7 @@ gnulib_modules="
|
||||
cycle-check
|
||||
d-ino
|
||||
d-type
|
||||
di-set
|
||||
diacrit
|
||||
dirfd
|
||||
dirname
|
||||
@@ -79,10 +68,12 @@ gnulib_modules="
|
||||
exclude
|
||||
exitfail
|
||||
faccessat
|
||||
fadvise
|
||||
fchdir
|
||||
fcntl
|
||||
fcntl-safer
|
||||
fdl
|
||||
fdutimensat
|
||||
file-type
|
||||
fileblocks
|
||||
filemode
|
||||
@@ -97,9 +88,7 @@ gnulib_modules="
|
||||
fsusage
|
||||
fsync
|
||||
ftello
|
||||
ftruncate
|
||||
fts
|
||||
getdate
|
||||
getgroups
|
||||
gethrxtime
|
||||
getline
|
||||
@@ -108,7 +97,7 @@ gnulib_modules="
|
||||
getopt-gnu
|
||||
getpagesize
|
||||
getpass-gnu
|
||||
gettext
|
||||
gettext-h
|
||||
gettime
|
||||
gettimeofday
|
||||
getugroups
|
||||
@@ -123,6 +112,7 @@ gnulib_modules="
|
||||
hard-locale
|
||||
hash
|
||||
hash-pjw
|
||||
heap
|
||||
host-os
|
||||
human
|
||||
idcache
|
||||
@@ -141,7 +131,7 @@ gnulib_modules="
|
||||
long-options
|
||||
lstat
|
||||
maintainer-makefile
|
||||
malloc
|
||||
malloc-gnu
|
||||
manywarnings
|
||||
mbrtowc
|
||||
mbsalign
|
||||
@@ -160,8 +150,10 @@ gnulib_modules="
|
||||
modechange
|
||||
mountlist
|
||||
mpsort
|
||||
netinet_in
|
||||
nproc
|
||||
obstack
|
||||
parse-datetime
|
||||
pathmax
|
||||
perl
|
||||
physmem
|
||||
@@ -171,17 +163,17 @@ gnulib_modules="
|
||||
priv-set
|
||||
progname
|
||||
propername
|
||||
pthread
|
||||
putenv
|
||||
quote
|
||||
quotearg
|
||||
raise
|
||||
randint
|
||||
randperm
|
||||
readlink
|
||||
readtokens
|
||||
readtokens0
|
||||
readutmp
|
||||
realloc
|
||||
realloc-gnu
|
||||
regex
|
||||
remove
|
||||
rename
|
||||
@@ -206,13 +198,16 @@ gnulib_modules="
|
||||
stpncpy
|
||||
strdup-posix
|
||||
strftime
|
||||
strpbrk
|
||||
strsignal
|
||||
strtod
|
||||
strtoimax
|
||||
strtol
|
||||
strtoumax
|
||||
strverscmp
|
||||
symlink
|
||||
sys_ioctl
|
||||
sys_stat
|
||||
sys_wait
|
||||
termios
|
||||
timespec
|
||||
tzset
|
||||
uname
|
||||
@@ -232,7 +227,6 @@ gnulib_modules="
|
||||
verify
|
||||
verror
|
||||
version-etc-fsf
|
||||
warnings
|
||||
wcwidth
|
||||
winsz-ioctl
|
||||
winsz-termios
|
||||
@@ -312,11 +306,11 @@ gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
|
||||
|
||||
# Build prerequisites
|
||||
buildreq="\
|
||||
autoconf 2.61
|
||||
automake 1.11
|
||||
autoconf 2.62
|
||||
automake 1.11.1
|
||||
autopoint -
|
||||
bison -
|
||||
gettext -
|
||||
gettext 0.18
|
||||
git 1.4.4
|
||||
gperf -
|
||||
gzip -
|
||||
@@ -324,6 +318,7 @@ makeinfo -
|
||||
perl 5.5
|
||||
rsync -
|
||||
tar -
|
||||
xz -
|
||||
"
|
||||
|
||||
# Automake requires that ChangeLog exist.
|
||||
@@ -335,4 +330,15 @@ bootstrap_epilogue()
|
||||
m=gnulib-tests/gnulib.mk
|
||||
sed 's,\.\./\.\.,..,g' $m > $m-t
|
||||
mv -f $m-t $m
|
||||
|
||||
# Since this is a "GNU" package, replace this line
|
||||
# if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null \
|
||||
# | grep -v 'libtool:' >/dev/null; then
|
||||
# with this:
|
||||
# if true; then
|
||||
# Why? That pipeline searches all files in $(top_srcdir), and if you
|
||||
# happen to have large files (or apparently large sparse files), the
|
||||
# first grep may well run out of memory.
|
||||
perl -pi -e 's/if LC_ALL=C grep .GNU .PACKAGE.*; then/if true; then/' \
|
||||
po/Makefile.in.in
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2010 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
198
cfg.mk
198
cfg.mk
@@ -1,5 +1,5 @@
|
||||
# Customize maint.mk -*- makefile -*-
|
||||
# Copyright (C) 2003-2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -14,24 +14,12 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Use alpha.gnu.org for alpha and beta releases.
|
||||
# Use ftp.gnu.org for major releases.
|
||||
gnu_ftp_host-alpha = alpha.gnu.org
|
||||
gnu_ftp_host-beta = alpha.gnu.org
|
||||
gnu_ftp_host-major = ftp.gnu.org
|
||||
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
|
||||
|
||||
# Used in maint.mk's web-manual rule
|
||||
manual_title = Core GNU utilities
|
||||
|
||||
url_dir_list = \
|
||||
ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
|
||||
|
||||
# The GnuPG ID of the key used to sign the tarballs.
|
||||
gpg_key_ID = B9AB9A16
|
||||
|
||||
# Tests not to run as part of "make distcheck".
|
||||
local-checks-to-skip =
|
||||
local-checks-to-skip = \
|
||||
sc_texinfo_acronym
|
||||
|
||||
# Tools used to bootstrap this package, used for "announcement".
|
||||
bootstrap-tools = autoconf,automake,gnulib,bison
|
||||
@@ -39,7 +27,13 @@ bootstrap-tools = autoconf,automake,gnulib,bison
|
||||
# Now that we have better tests, make this the default.
|
||||
export VERBOSE = yes
|
||||
|
||||
old_NEWS_hash = 785e51bc9af87e7eb004f9ba24a0ca27
|
||||
old_NEWS_hash = 27e765279d5735f99114b57fa097e6bd
|
||||
|
||||
# Add an exemption for sc_makefile_at_at_check.
|
||||
_makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
|
||||
|
||||
# Our help-version script is in a slightly different location.
|
||||
_hv_file ?= $(srcdir)/tests/misc/help-version
|
||||
|
||||
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
|
||||
dd = $(srcdir)/src/dd.c
|
||||
@@ -103,7 +97,8 @@ sc_root_tests:
|
||||
# stays in sync with corresponding files in the repository.
|
||||
sce = syntax_check_exceptions
|
||||
sc_x_sc_dist_check:
|
||||
@test "$$( ($(VC_LIST) | sed -n '/^.x-sc_/p'; \
|
||||
@test "$$( ($(VC_LIST) | sed -n '/\.x-sc_/p' \
|
||||
| sed 's|^$(_dot_escaped_srcdir)/||'; \
|
||||
sed -n '/^$(sce) =[ ]*\\$$/,/[^\]$$/p' \
|
||||
$(srcdir)/Makefile.am \
|
||||
| sed 's/^ *//;/^$(sce) =/d' \
|
||||
@@ -111,40 +106,6 @@ sc_x_sc_dist_check:
|
||||
) | sort | uniq -u)" \
|
||||
&& { echo 'Makefile.am: $(sce) mismatch' >&2; exit 1; } || :;
|
||||
|
||||
headers_with_interesting_macro_defs = \
|
||||
exit.h \
|
||||
fcntl_.h \
|
||||
fnmatch_.h \
|
||||
intprops.h \
|
||||
inttypes_.h \
|
||||
lchown.h \
|
||||
openat.h \
|
||||
stat-macros.h \
|
||||
stdint_.h
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of macros that are guaranteed by parts of gnulib to be defined.
|
||||
.re-defmac:
|
||||
@(cd $(srcdir)/lib; \
|
||||
for f in $(headers_with_interesting_macro_defs); do \
|
||||
test -f $$f && \
|
||||
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
|
||||
done; \
|
||||
) | sort -u \
|
||||
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
|
||||
| sed 's/^/^# *define /' \
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
# Don't define macros that we already get from gnulib header files.
|
||||
sc_always_defined_macros: .re-defmac
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
|
||||
grep -f .re-defmac $$($(VC_LIST)) \
|
||||
&& { echo '$(ME): define the above via some gnulib .h file' \
|
||||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of files included from system.h. Exclude a couple.
|
||||
.re-list:
|
||||
@@ -154,13 +115,21 @@ sc_always_defined_macros: .re-defmac
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
define gl_trap_
|
||||
Exit () { set +e; (exit $$1); exit $$1; }; \
|
||||
for sig in 1 2 3 13 15; do \
|
||||
eval "trap 'Exit $$(expr $$sig + 128)' $$sig"; \
|
||||
done
|
||||
endef
|
||||
|
||||
# Files in src/ should not include directly any of
|
||||
# the headers already included via system.h.
|
||||
sc_system_h_headers: .re-list
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
|
||||
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0; \
|
||||
$(gl_trap_); \
|
||||
grep -nE -f .re-list \
|
||||
$$($(VC_LIST_EXCEPT) | grep '^src/') \
|
||||
$$($(VC_LIST_EXCEPT) | grep '^\($(srcdir)/\)\?src/') \
|
||||
&& { echo '$(ME): the above are already included via system.h'\
|
||||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
@@ -174,11 +143,26 @@ sc_sun_os_names:
|
||||
|
||||
ALL_RECURSIVE_TARGETS += sc_tight_scope
|
||||
sc_tight_scope:
|
||||
@$(MAKE) -C src $@
|
||||
@$(MAKE) -s -C src $@
|
||||
|
||||
ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
|
||||
sc_check-AUTHORS:
|
||||
@$(MAKE) -C src $@
|
||||
@$(MAKE) -s -C src $@
|
||||
|
||||
# Option descriptions should not start with a capital letter
|
||||
# One could grep source directly as follows:
|
||||
# grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
|
||||
# but that would miss descriptions not on the same line as the -option.
|
||||
ALL_RECURSIVE_TARGETS += sc_option_desc_uppercase
|
||||
sc_option_desc_uppercase:
|
||||
@$(MAKE) -s -C src all_programs
|
||||
@$(MAKE) -s -C man $@
|
||||
|
||||
# Ensure all man/*.[1x] files are present
|
||||
ALL_RECURSIVE_TARGETS += sc_man_file_correlation
|
||||
sc_man_file_correlation:
|
||||
@$(MAKE) -s -C src all_programs
|
||||
@$(MAKE) -s -C man $@
|
||||
|
||||
# Perl-based tests used to exec perl from a #!/bin/sh script.
|
||||
# Now they all start with #!/usr/bin/perl and the portability
|
||||
@@ -193,15 +177,15 @@ sc_no_exec_perl_coreutils:
|
||||
|
||||
# Don't use "readlink" or "readlinkat" directly
|
||||
sc_prohibit_readlink:
|
||||
@re='\<readlink(at)? \(' \
|
||||
msg='do not use readlink(at); use via xreadlink or areadlink*' \
|
||||
$(_prohibit_regexp)
|
||||
@prohibit='\<readlink(at)? \(' \
|
||||
halt='do not use readlink(at); use via xreadlink or areadlink*' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Don't use address of "stat" or "lstat" functions
|
||||
sc_prohibit_stat_macro_address:
|
||||
@re='\<l?stat '':|&l?stat\>' \
|
||||
msg='stat() and lstat() may be function-like macros' \
|
||||
$(_prohibit_regexp)
|
||||
@prohibit='\<l?stat '':|&l?stat\>' \
|
||||
halt='stat() and lstat() may be function-like macros' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Ensure that date's --help output stays in sync with the info
|
||||
# documentation for GNU strftime. The only exception is %N,
|
||||
@@ -212,7 +196,7 @@ sc_strftime_check:
|
||||
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||
| $(extract_char) > $@-src; \
|
||||
{ echo N; \
|
||||
info libc date calendar format | grep '^ `%.'\' \
|
||||
info libc date calendar format 2>/dev/null|grep '^ `%.'\'\
|
||||
| $(extract_char); } | sort > $@-info; \
|
||||
diff -u $@-src $@-info || exit 1; \
|
||||
rm -f $@-src $@-info; \
|
||||
@@ -220,22 +204,22 @@ sc_strftime_check:
|
||||
|
||||
# Indent only with spaces.
|
||||
sc_prohibit_tab_based_indentation:
|
||||
@re='^ * ' \
|
||||
msg='TAB in indentation; use only spaces' \
|
||||
$(_prohibit_regexp)
|
||||
@prohibit='^ * ' \
|
||||
halt='TAB in indentation; use only spaces' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Don't use "indent-tabs-mode: nil" anymore. No longer needed.
|
||||
sc_prohibit_emacs__indent_tabs_mode__setting:
|
||||
@re='^( *[*#] *)?indent-tabs-mode:' \
|
||||
msg='use of emacs indent-tabs-mode: setting' \
|
||||
$(_prohibit_regexp)
|
||||
@prohibit='^( *[*#] *)?indent-tabs-mode:' \
|
||||
halt='use of emacs indent-tabs-mode: setting' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Ensure that each file that contains fail=1 also contains fail=0.
|
||||
# Otherwise, setting file=1 in the environment would make tests fail unexpectedly.
|
||||
sc_prohibit_fail_0:
|
||||
@re='\<fail=0\>' \
|
||||
msg='fail=0 initialization' \
|
||||
$(_prohibit_regexp)
|
||||
@prohibit='\<fail=0\>' \
|
||||
halt='fail=0 initialization' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Ensure that "stdio--.h" is used where appropriate.
|
||||
sc_require_stdio_safer:
|
||||
@@ -249,4 +233,76 @@ sc_require_stdio_safer:
|
||||
else :; \
|
||||
fi
|
||||
|
||||
sc_prohibit_perl_hash_quotes:
|
||||
@prohibit="\{'[A-Z_]+' *[=}]" \
|
||||
halt="in Perl code, write \$$hash{KEY}, not \$$hash{'K''EY'}" \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Prefer xnanosleep over other less-precise sleep methods
|
||||
sc_prohibit_sleep:
|
||||
@prohibit='\<(nano|u)?sleep \(' \
|
||||
halt='prefer xnanosleep over other sleep interfaces' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
###########################################################
|
||||
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
|
||||
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
|
||||
_pre_anchored = ^\($(_pre)\)
|
||||
_comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
|
||||
# help font-lock mode: '
|
||||
|
||||
# A sed expression that removes ANSI C and ISO C99 comments.
|
||||
# Derived from the one in GNU gettext's 'moopp' preprocessor.
|
||||
_sed_remove_comments = \
|
||||
/[/][/*]/{ \
|
||||
ta; \
|
||||
:a; \
|
||||
s,$(_pre_anchored)//.*,\1,; \
|
||||
te; \
|
||||
s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,; \
|
||||
ta; \
|
||||
/^$(_pre)[/][*]/{ \
|
||||
s,$(_pre_anchored)/[*].*,\1 ,; \
|
||||
tu; \
|
||||
:u; \
|
||||
n; \
|
||||
s,^\($(_comment_and_close),,; \
|
||||
tv; \
|
||||
s,^.*$$,,; \
|
||||
bu; \
|
||||
:v; \
|
||||
}; \
|
||||
:e; \
|
||||
}
|
||||
# Quote all single quotes.
|
||||
_sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
|
||||
# help font-lock mode: '
|
||||
|
||||
_space_before_paren_exempt =? \\n\\$$
|
||||
_space_before_paren_exempt = \
|
||||
(^ *\#|\\n\\$$|%s\(to %s|(date|group|character)\(s\))
|
||||
# Ensure that there is a space before each open parenthesis in C code.
|
||||
sc_space_before_open_paren:
|
||||
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
||||
fail=0; \
|
||||
for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
|
||||
sed '$(_sed_rm_comments_q)' $$c 2>/dev/null \
|
||||
| grep -i '[[:alnum:]](' \
|
||||
| grep -vE '$(_space_before_paren_exempt)' \
|
||||
| grep . && { fail=1; echo "*** $$c"; }; \
|
||||
done; \
|
||||
test $$fail = 1 && \
|
||||
{ echo '$(ME): the above files lack a space-before-open-paren' \
|
||||
1>&2; exit 1; } || :; \
|
||||
else :; \
|
||||
fi
|
||||
|
||||
# Override the default Cc: used in generating an announcement.
|
||||
announcement_Cc_ = $(translation_project_), \
|
||||
coreutils@gnu.org, coreutils-announce@gnu.org
|
||||
|
||||
include $(srcdir)/dist-check.mk
|
||||
|
||||
update-copyright-env = \
|
||||
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
|
||||
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
|
||||
|
||||
24
configure.ac
24
configure.ac
@@ -1,7 +1,7 @@
|
||||
# -*- autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Copyright (C) 1991, 1993-2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 1993-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
dnl Written by Jim Meyering.
|
||||
|
||||
AC_PREREQ([2.61])
|
||||
AC_PREREQ([2.62])
|
||||
|
||||
# Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which
|
||||
# indicates that it is built from the 219th delta (in _some_ repository)
|
||||
@@ -32,7 +32,7 @@ AC_CONFIG_SRCDIR([src/ls.c])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests])
|
||||
AM_INIT_AUTOMAKE([1.11.1 dist-xz color-tests parallel-tests])
|
||||
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
|
||||
|
||||
AC_PROG_CC_STDC
|
||||
@@ -124,6 +124,13 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
nw="$nw -Wold-style-definition"
|
||||
gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
|
||||
AC_SUBST([GNULIB_WARN_CFLAGS])
|
||||
|
||||
# For gnulib-tests, the set is slightly smaller still.
|
||||
nw=
|
||||
nw="$nw -Wstrict-prototypes"
|
||||
gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
|
||||
[$GNULIB_WARN_CFLAGS], [$nw])
|
||||
AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
|
||||
fi
|
||||
|
||||
AC_FUNC_FORK
|
||||
@@ -332,7 +339,6 @@ if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
|
||||
fi
|
||||
|
||||
# Limit stdbuf to ELF systems with GCC
|
||||
optional_pkglib_progs=
|
||||
AC_MSG_CHECKING([whether this is an ELF system])
|
||||
AC_EGREP_CPP([yes], [#if __ELF__
|
||||
yes
|
||||
@@ -341,7 +347,6 @@ AC_MSG_RESULT([$elf_sys])
|
||||
if test "$elf_sys" = "yes" && \
|
||||
test "$GCC" = "yes"; then
|
||||
gl_ADD_PROG([optional_bin_progs], [stdbuf])
|
||||
gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so])
|
||||
fi
|
||||
|
||||
############################################################################
|
||||
@@ -395,6 +400,13 @@ esac
|
||||
# corresponding ./configure option argument is comma-separated on input.
|
||||
gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [arch,hostname,su])
|
||||
|
||||
# Now that we know which programs will actually be built up, figure out
|
||||
# which optional helper progs should be compiled.
|
||||
optional_pkglib_progs=
|
||||
case " $optional_bin_progs " in
|
||||
*' stdbuf '*) gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so]) ;;
|
||||
esac
|
||||
|
||||
# Set INSTALL_SU if su installation has been requested via
|
||||
# --enable-install-program=su.
|
||||
AC_SUBST([INSTALL_SU])
|
||||
@@ -432,7 +444,7 @@ AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
|
||||
# As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
|
||||
# translatable strings, we must use need-formatstring-macros here.
|
||||
AM_GNU_GETTEXT([external], [need-formatstring-macros])
|
||||
AM_GNU_GETTEXT_VERSION([0.17])
|
||||
AM_GNU_GETTEXT_VERSION([0.18])
|
||||
|
||||
# For a test of uniq: it uses the $LOCALE_FR envvar.
|
||||
gt_LOCALE_FR
|
||||
|
||||
@@ -4,36 +4,63 @@ bin=bin-$$$$
|
||||
|
||||
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
|
||||
|
||||
TMPDIR ?= /tmp
|
||||
t=$(TMPDIR)/$(PACKAGE)/test
|
||||
tmpdir = $(abs_top_builddir)/tests/torture
|
||||
|
||||
t=$(tmpdir)/$(PACKAGE)/test
|
||||
pfx=$(t)/i
|
||||
|
||||
built_programs = \
|
||||
$$(echo 'spy:;@echo $$(bin_PROGRAMS)' \
|
||||
| MAKEFLAGS= $(MAKE) -s -C src -f Makefile -f - spy \
|
||||
| fmt -1 | sed 's,$(EXEEXT)$$,,' | sort -u)
|
||||
|
||||
# More than once, tainted build and source directory names would
|
||||
# have caused at least one "make check" test to apply "chmod 700"
|
||||
# to all directories under $HOME. Make sure it doesn't happen again.
|
||||
tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
|
||||
tp = $(tmpdir)/taint
|
||||
t_prefix = $(tp)/a
|
||||
t_taint = '$(t_prefix) b'
|
||||
fake_home = $(tp)/home
|
||||
|
||||
# When extracting from a distribution tarball, extract using the fastest
|
||||
# method possible. With dist-xz, that means using the *.xz file.
|
||||
ifneq ('', $(filter *.xz, $(DIST_ARCHIVES)))
|
||||
tar_decompress_opt_ = J
|
||||
suffix_ = xz
|
||||
else
|
||||
ifneq ('', $(filter *.gz, $(DIST_ARCHIVES)))
|
||||
tar_decompress_opt_ = z
|
||||
suffix_ = gz
|
||||
else
|
||||
tar_decompress_opt_ = j
|
||||
suffix_ = bz2
|
||||
endif
|
||||
endif
|
||||
amtar_extract_ = $(AMTAR) -$(tar_decompress_opt_)xf
|
||||
preferred_tarball_ = $(distdir).tar.$(suffix_)
|
||||
|
||||
# Ensure that tests run from tainted build and src dir names work,
|
||||
# and don't affect anything in $HOME. Create witness files in $HOME,
|
||||
# record their attributes, and build/test. Then ensure that the
|
||||
# witnesses were not affected.
|
||||
# Skip this test when using libtool, since libtool-generated scripts
|
||||
# cannot deal with a space-tainted srcdir.
|
||||
ALL_RECURSIVE_TARGETS += taint-distcheck
|
||||
taint-distcheck: $(DIST_ARCHIVES)
|
||||
grep '^[ ]*LT_INIT' configure.ac >/dev/null && exit 0 || :
|
||||
test -d $(t_taint) && chmod -R 700 $(t_taint) || :
|
||||
-rm -rf $(t_taint) $(fake_home)
|
||||
mkdir -p $(t_prefix) $(t_taint) $(fake_home)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t_taint) -zxf $(distdir).tar.gz
|
||||
$(amtar_extract_) $(preferred_tarball_) -C $(t_taint)
|
||||
mkfifo $(fake_home)/fifo
|
||||
touch $(fake_home)/f
|
||||
mkdir -p $(fake_home)/d/e
|
||||
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
|
||||
HOME=$(fake_home); export HOME; \
|
||||
cd $(t_taint)/$(distdir) \
|
||||
&& ./configure \
|
||||
&& $(MAKE) \
|
||||
&& HOME=$(fake_home) $(MAKE) check \
|
||||
&& $(MAKE) check \
|
||||
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
|
||||
&& diff $(tp)/.ls-before $(tp)/.ls-after \
|
||||
&& test -d $(t_prefix)
|
||||
@@ -50,8 +77,9 @@ define install-transform-check
|
||||
endef
|
||||
|
||||
# Install, then verify that all binaries and man pages are in place.
|
||||
# Note that neither the binary, ginstall, nor the ].1 man page is installed.
|
||||
# Note that neither the binary, ginstall, nor the [.1 man page is installed.
|
||||
define my-instcheck
|
||||
echo running my-instcheck; \
|
||||
$(MAKE) prefix=$(pfx) install \
|
||||
&& test ! -f $(pfx)/bin/ginstall \
|
||||
&& { fail=0; \
|
||||
@@ -68,8 +96,16 @@ define my-instcheck
|
||||
}
|
||||
endef
|
||||
|
||||
# The hard-linking for-loop below ensures that there is a bin/ directory
|
||||
# full of all of the programs under test (except the ones that are required
|
||||
# for basic Makefile rules), all symlinked to the just-built "false" program.
|
||||
# This is to ensure that if ever a test neglects to make PATH include
|
||||
# the build srcdir, these always-failing programs will run.
|
||||
# Otherwise, it is too easy to test the wrong programs.
|
||||
# Note that "false" itself is a symlink to true, so it too will malfunction.
|
||||
define coreutils-path-check
|
||||
{ \
|
||||
echo running coreutils-path-check; \
|
||||
if test -f $(srcdir)/src/true.c; then \
|
||||
fail=1; \
|
||||
mkdir $(bin) \
|
||||
@@ -97,37 +133,38 @@ define coreutils-path-check
|
||||
}
|
||||
endef
|
||||
|
||||
# Use -Wformat -Werror to detect format-string/arg-list mismatches.
|
||||
# Also, check for shadowing problems with -Wshadow, and for pointer
|
||||
# arithmetic problems with -Wpointer-arith.
|
||||
# These CFLAGS are pretty strict. If you build this target, you probably
|
||||
# have to have a recent version of gcc and glibc headers.
|
||||
# The hard-linking for-loop below ensures that there is a bin/ directory
|
||||
# full of all of the programs under test (except the ones that are required
|
||||
# for basic Makefile rules), all symlinked to the just-built "false" program.
|
||||
# This is to ensure that if ever a test neglects to make PATH include
|
||||
# the build srcdir, these always-failing programs will run.
|
||||
# Otherwise, it is too easy to test the wrong programs.
|
||||
# Note that "false" itself is a symlink to true, so it too will malfunction.
|
||||
# Use this to make sure we don't run these programs when building
|
||||
# from a virgin compressed tarball file, below.
|
||||
null_AM_MAKEFLAGS ?= \
|
||||
ACLOCAL=false \
|
||||
AUTOCONF=false \
|
||||
AUTOMAKE=false \
|
||||
AUTOHEADER=false \
|
||||
GPERF=false \
|
||||
MAKEINFO=false
|
||||
|
||||
ALL_RECURSIVE_TARGETS += my-distcheck
|
||||
my-distcheck: $(DIST_ARCHIVES) $(local-check)
|
||||
$(MAKE) syntax-check
|
||||
$(MAKE) check
|
||||
-rm -rf $(t)
|
||||
mkdir -p $(t)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||
cd $(t)/$(distdir) \
|
||||
&& ./configure --enable-gcc-warnings --disable-nls \
|
||||
&& $(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(install-transform-check) \
|
||||
&& $(my-instcheck) \
|
||||
&& $(coreutils-path-check) \
|
||||
&& $(MAKE) distclean
|
||||
$(amtar_extract_) $(preferred_tarball_) -C $(t)
|
||||
(set -e; cd $(t)/$(distdir); \
|
||||
./configure --quiet --enable-gcc-warnings --disable-nls; \
|
||||
$(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'; \
|
||||
$(MAKE) dvi; \
|
||||
$(install-transform-check); \
|
||||
$(my-instcheck); \
|
||||
$(coreutils-path-check); \
|
||||
$(MAKE) distclean \
|
||||
)
|
||||
(cd $(t) && mv $(distdir) $(distdir).old \
|
||||
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
|
||||
&& $(amtar_extract_) - ) < $(preferred_tarball_)
|
||||
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||
-rm -rf $(t)
|
||||
rmdir $(tmpdir)/$(PACKAGE) $(tmpdir)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "ready for distribution:"; \
|
||||
for i in $(DIST_ARCHIVES); do echo " $$i"; done; \
|
||||
echo "========================"
|
||||
|
||||
2
doc/.gitignore
vendored
2
doc/.gitignore
vendored
@@ -17,6 +17,8 @@ coreutils.tp
|
||||
coreutils.vr
|
||||
fdl.texi
|
||||
gendocs_template
|
||||
get_date.texi
|
||||
getdate.texi
|
||||
parse-datetime.texi
|
||||
stamp-vti
|
||||
version.texi
|
||||
|
||||
@@ -2002,7 +2002,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2010 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Make coreutils documentation. -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 1995-1998, 2001-2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995-1998, 2001-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
info_TEXINFOS = coreutils.texi
|
||||
|
||||
EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi
|
||||
EXTRA_DIST = perm.texi parse-datetime.texi constants.texi fdl.texi
|
||||
|
||||
# The following is necessary if the package name is 8 characters or longer.
|
||||
# If the info documentation would be split into 10 or more separate files,
|
||||
@@ -30,13 +30,12 @@ EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi
|
||||
AM_MAKEINFOFLAGS = --no-split
|
||||
|
||||
constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
|
||||
LC_ALL=C \
|
||||
sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
|
||||
$(top_srcdir)/src/tail.c > t-$@
|
||||
LC_ALL=C \
|
||||
sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
|
||||
$(top_srcdir)/src/shred.c >> t-$@
|
||||
mv t-$@ $@
|
||||
$(AM_V_GEN)LC_ALL=C; export LC_ALL; \
|
||||
{ sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
|
||||
$(top_srcdir)/src/tail.c && \
|
||||
sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
|
||||
$(top_srcdir)/src/shred.c; } > t-$@ \
|
||||
&& mv t-$@ $@
|
||||
|
||||
MAINTAINERCLEANFILES = constants.texi
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
* df: (coreutils)df invocation. Report file system disk usage.
|
||||
* dir: (coreutils)dir invocation. List directories briefly.
|
||||
* dircolors: (coreutils)dircolors invocation. Color setup for ls.
|
||||
* dirname: (coreutils)dirname invocation. Strip non-directory suffix.
|
||||
* dirname: (coreutils)dirname invocation. Strip last file name component.
|
||||
* du: (coreutils)du invocation. Report on disk usage.
|
||||
* echo: (coreutils)echo invocation. Print a line of text.
|
||||
* env: (coreutils)env invocation. Modify the environment.
|
||||
@@ -139,7 +139,7 @@
|
||||
This manual documents version @value{VERSION} of the @sc{gnu} core
|
||||
utilities, including the standard programs for text and file manipulation.
|
||||
|
||||
Copyright @copyright{} 1994-1996, 2000-2009 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1994-1996, 2000-2010 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
@@ -197,7 +197,7 @@ Free Documentation License''.
|
||||
* File name manipulation:: dirname basename pathchk mktemp
|
||||
* Working context:: pwd stty printenv tty
|
||||
* User information:: id logname whoami groups users who
|
||||
* System context:: date arch uname hostname hostid uptime
|
||||
* System context:: date arch nproc uname hostname hostid uptime
|
||||
* SELinux context:: chcon runcon
|
||||
* Modified command invocation:: chroot env nice nohup stdbuf su timeout
|
||||
* Process control:: kill
|
||||
@@ -377,7 +377,7 @@ Redirection
|
||||
File name manipulation
|
||||
|
||||
* basename invocation:: Strip directory and suffix from a file name
|
||||
* dirname invocation:: Strip non-directory suffix from a file name
|
||||
* dirname invocation:: Strip last file name component
|
||||
* pathchk invocation:: Check file name validity and portability
|
||||
* mktemp invocation:: Create temporary file or directory
|
||||
|
||||
@@ -474,7 +474,7 @@ Date input formats
|
||||
* Pure numbers in date strings:: 19931219, 1440
|
||||
* Seconds since the Epoch:: @@1078100502
|
||||
* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0"
|
||||
* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al
|
||||
* Authors of parse_datetime:: Bellovin, Eggert, Salz, Berets, et al
|
||||
|
||||
Opening the software toolbox
|
||||
|
||||
@@ -1494,7 +1494,8 @@ Display a @samp{$} after the end of each line.
|
||||
@itemx --number
|
||||
@opindex -n
|
||||
@opindex --number
|
||||
Number all output lines, starting with 1.
|
||||
Number all output lines, starting with 1. This option is ignored
|
||||
if @option{-b} is in effect.
|
||||
|
||||
@item -s
|
||||
@itemx --squeeze-blank
|
||||
@@ -2770,8 +2771,10 @@ If you'd like to continue to track the end of a growing file even after
|
||||
it has been unlinked, use @option{--follow=descriptor}. This is the default
|
||||
behavior, but it is not useful if you're tracking a log file that may be
|
||||
rotated (removed or renamed, then reopened). In that case, use
|
||||
@option{--follow=name} to track the named file by reopening it periodically
|
||||
to see if it has been removed and recreated by some other program.
|
||||
@option{--follow=name} to track the named file, perhaps by reopening it
|
||||
periodically to see if it has been removed and recreated by some other program.
|
||||
Note that the inotify-based implementation handles this case without
|
||||
the need for any periodic reopening.
|
||||
|
||||
No matter which method you use, if the tracked file is determined to have
|
||||
shrunk, @command{tail} prints a message saying the file has been truncated
|
||||
@@ -3411,14 +3414,12 @@ options}.
|
||||
Note: The MD5 digest is more reliable than a simple CRC (provided by
|
||||
the @command{cksum} command) for detecting accidental file corruption,
|
||||
as the chances of accidentally having two files with identical MD5
|
||||
are vanishingly small. However, it should not be considered truly
|
||||
secure against malicious tampering: although finding a file with a
|
||||
given MD5 fingerprint, or modifying a file so as to retain its MD5 are
|
||||
considered infeasible at the moment, it is known how to produce
|
||||
different files with identical MD5 (a ``collision''), something which
|
||||
can be a security issue in certain contexts. For more secure hashes,
|
||||
consider using SHA-1 or SHA-2. @xref{sha1sum invocation}, and
|
||||
@ref{sha2 utilities}.
|
||||
are vanishingly small. However, it should not be considered secure
|
||||
against malicious tampering: although finding a file with a given MD5
|
||||
fingerprint is considered infeasible at the moment, it is known how
|
||||
to modify certain files, including digital certificates, so that they
|
||||
appear valid when signed with an MD5 digest.
|
||||
For more secure hashes, consider using SHA-2. @xref{sha2 utilities}.
|
||||
|
||||
If a @var{file} is specified as @samp{-} or if no files are given
|
||||
@command{md5sum} computes the checksum for the standard input.
|
||||
@@ -3765,8 +3766,8 @@ the final result, after the throwing away.))
|
||||
@opindex --sort
|
||||
@cindex general numeric sort
|
||||
@vindex LC_NUMERIC
|
||||
Sort numerically, using the standard C function @code{strtod} to convert
|
||||
a prefix of each line to a double-precision floating point number.
|
||||
Sort numerically, using the standard C function @code{strtold} to convert
|
||||
a prefix of each line to a long double-precision floating point number.
|
||||
This allows floating point numbers to be specified in scientific notation,
|
||||
like @code{1.0e-34} and @code{10e100}.
|
||||
The @env{LC_NUMERIC} locale determines the decimal-point character.
|
||||
@@ -3799,12 +3800,18 @@ converting to floating point.
|
||||
@opindex --sort
|
||||
@cindex human numeric sort
|
||||
@vindex LC_NUMERIC
|
||||
Sort numerically, as per the @option{--numeric-sort} option below, and in
|
||||
addition handle IEC or SI suffixes like MiB, MB etc (@ref{Block size}).
|
||||
Note a mixture of IEC and SI suffixes is not supported and will
|
||||
be flagged as an error. Also the numbers must be abbreviated uniformly.
|
||||
I.E. values with different precisions like 6000K and 5M will be sorted
|
||||
incorrectly.
|
||||
Sort numerically, first by numeric sign (negative, zero, or positive);
|
||||
then by @acronym{SI} suffix (either empty, or @samp{k} or @samp{K}, or
|
||||
one of @samp{MGTPEZY}, in that order; @pxref{Block size}); and finally
|
||||
by numeric value. For example, @samp{1023M} sorts before @samp{1G}
|
||||
because @samp{M} (mega) precedes @samp{G} (giga) as an @acronym{SI}
|
||||
suffix. This option sorts values that are consistently scaled to the
|
||||
nearest suffix, regardless of whether suffixes denote powers of 1000
|
||||
or 1024, and it therefore sorts the output of any single invocation of
|
||||
the @command{df}, @command{du}, or @command{ls} commands that are
|
||||
invoked with their @option{--human-readable} or @option{--si} options.
|
||||
The syntax for numbers is the same as for the @option{--numeric-sort}
|
||||
option; the @acronym{SI} suffix must immediately follow the number.
|
||||
|
||||
@item -i
|
||||
@itemx --ignore-nonprinting
|
||||
@@ -3862,10 +3869,9 @@ To compare such strings numerically, use the
|
||||
@opindex -V
|
||||
@opindex --version-sort
|
||||
@cindex version number sort
|
||||
@vindex LC_NUMERIC
|
||||
Sort per @code{strverscmp(3)}. This is a normal string comparison, except
|
||||
that embedded decimal numbers are sorted by numeric value
|
||||
(see @option{--numeric-sort} above).
|
||||
Sort by version name and number. It behaves like a standard sort,
|
||||
except that each sequence of decimal digits is treated numerically
|
||||
as an index/version number. (@xref{Details about version sort}.)
|
||||
|
||||
@item -r
|
||||
@itemx --reverse
|
||||
@@ -3938,6 +3944,12 @@ multiple fields.
|
||||
|
||||
Example: To sort on the second field, use @option{--key=2,2}
|
||||
(@option{-k 2,2}). See below for more notes on keys and more examples.
|
||||
See also the @option{--debug} option to help determine the part
|
||||
of the line being used in the sort.
|
||||
|
||||
@item --debug
|
||||
Highlight the portion of each line used for sorting.
|
||||
Also issue warnings about questionable usage to stderr.
|
||||
|
||||
@item --batch-size=@var{nmerge}
|
||||
@opindex --batch-size
|
||||
@@ -4060,6 +4072,14 @@ have a large sort or merge that is I/O-bound, you can often improve
|
||||
performance by using this option to specify directories on different
|
||||
disks and controllers.
|
||||
|
||||
@item --parallel=@var{n}
|
||||
@opindex --parallel
|
||||
@cindex multithreaded sort
|
||||
Limit the number of sorts run in parallel to @var{n}. By default,
|
||||
@var{n} is set to the number of available processors, and values
|
||||
greater than that are reduced to that limit. Also see
|
||||
@ref{nproc invocation}.
|
||||
|
||||
@item -u
|
||||
@itemx --unique
|
||||
@opindex -u
|
||||
@@ -4113,7 +4133,7 @@ the start and end positions of a field specification, and if it is
|
||||
inherited from the global options it will be attached to both.
|
||||
If input lines can contain leading or adjacent blanks and @option{-t}
|
||||
is not used, then @option{-k} is typically combined with @option{-b} or
|
||||
an option that implicitly ignores leading blanks (@samp{MghnV}) as otherwise
|
||||
an option that implicitly ignores leading blanks (@samp{Mghn}) as otherwise
|
||||
the varying numbers of leading blanks in fields can cause confusing results.
|
||||
|
||||
If the start position in a sort field specifier falls after the end of
|
||||
@@ -4125,6 +4145,11 @@ is counted from the first nonblank character of the field.
|
||||
@vindex POSIXLY_CORRECT
|
||||
On older systems, @command{sort} supports an obsolete origin-zero
|
||||
syntax @samp{+@var{pos1} [-@var{pos2}]} for specifying sort keys.
|
||||
The obsolete sequence @samp{sort +@var{a}.@var{x} -@var{b}.@var{y}}
|
||||
is equivalent to @samp{sort -k @var{a+1}.@var{x+1},@var{b}} if @var{y}
|
||||
is @samp{0} or absent, otherwise it is equivalent to @samp{sort -k
|
||||
@var{a+1}.@var{x+1},@var{b+1}.@var{y}}.
|
||||
|
||||
This obsolete behavior can be enabled or disabled with the
|
||||
@env{_POSIX2_VERSION} environment variable (@pxref{Standards
|
||||
conformance}); it can also be enabled when @env{POSIXLY_CORRECT} is
|
||||
@@ -4149,6 +4174,13 @@ Sort in descending (reverse) numeric order.
|
||||
sort -n -r
|
||||
@end example
|
||||
|
||||
@item
|
||||
Run no more that 4 sorts concurrently, using a buffer size of 10M.
|
||||
|
||||
@example
|
||||
sort --parallel=4 -S 10M
|
||||
@end example
|
||||
|
||||
@item
|
||||
Sort alphabetically, omitting the first and second fields
|
||||
and the blanks at the start of the third field.
|
||||
@@ -5317,7 +5349,13 @@ of selected bytes.
|
||||
Select for printing only the fields listed in @var{field-list}.
|
||||
Fields are separated by a TAB character by default. Also print any
|
||||
line that contains no delimiter character, unless the
|
||||
@option{--only-delimited} (@option{-s}) option is specified
|
||||
@option{--only-delimited} (@option{-s}) option is specified.
|
||||
Note @command{cut} does not support specifying runs of whitespace as a
|
||||
delimiter, so to achieve that common functionality one can pre-process
|
||||
with @command{tr} like:
|
||||
@example
|
||||
tr -s '[:blank:]' '\t' | cut -f@dots{}
|
||||
@end example
|
||||
|
||||
@item -d @var{input_delim_byte}
|
||||
@itemx --delimiter=@var{input_delim_byte}
|
||||
@@ -5461,6 +5499,8 @@ locales and options if the output of @command{sort} is fed to
|
||||
sort a file on its default join field, but if you select a non-default
|
||||
locale, join field, separator, or comparison options, then you should
|
||||
do so consistently between @command{join} and @command{sort}.
|
||||
If @samp{join -t ''} is specified then the whole line is considered which
|
||||
matches the default operation of sort.
|
||||
|
||||
If the input has no unpairable lines, a @acronym{GNU} extension is
|
||||
available; the sort order can be any order that considers two fields
|
||||
@@ -5514,6 +5554,15 @@ Do not check that both input files are in sorted order. This is the default.
|
||||
Replace those output fields that are missing in the input with
|
||||
@var{string}.
|
||||
|
||||
@item --header
|
||||
@opindex --header
|
||||
Treat the first line of each input file as a header line. The header lines will
|
||||
be joined and printed as the first output line. If @option{-o} is used to
|
||||
specify output format, the header line will be printed according to the
|
||||
specified format. The header lines will not be checked for ordering even if
|
||||
@option{--check-order} is specified. Also if the header lines from each file
|
||||
do not match, the heading fields from the first file will be used.
|
||||
|
||||
@item -i
|
||||
@itemx --ignore-case
|
||||
@opindex -i
|
||||
@@ -5562,7 +5611,10 @@ option---are subject to the specified @var{field-list}.
|
||||
Use character @var{char} as the input and output field separator.
|
||||
Treat as significant each occurrence of @var{char} in the input file.
|
||||
Use @samp{sort -t @var{char}}, without the @option{-b} option of
|
||||
@samp{sort}, to produce this ordering.
|
||||
@samp{sort}, to produce this ordering. If @samp{join -t ''} is specified,
|
||||
the whole line is considered, matching the default operation of sort.
|
||||
If @samp{-t '\0'} is specified then the @acronym{ASCII} @sc{nul}
|
||||
character is used to delimit the fields.
|
||||
|
||||
@item -v @var{file-number}
|
||||
Print a line for each unpairable line in file @var{file-number}
|
||||
@@ -6685,23 +6737,17 @@ after the last @samp{.}); files with no extension are sorted first.
|
||||
@node Details about version sort
|
||||
@subsection Details about version sort
|
||||
|
||||
The version sort takes into account the fact that file names frequently include
|
||||
indices or version numbers. Standard sorting functions usually do not produce
|
||||
the ordering that people expect because comparisons are made on a
|
||||
character-by-character basis. The version
|
||||
sort addresses this problem, and is especially useful when browsing
|
||||
directories that contain many files with indices/version numbers in their
|
||||
names:
|
||||
Version sorting handles the fact that file names frequently include indices or
|
||||
version numbers. Standard sorting usually does not produce the order that one
|
||||
expects because comparisons are made on a character-by-character basis.
|
||||
Version sorting is especially useful when browsing directories that contain
|
||||
many files with indices/version numbers in their names:
|
||||
|
||||
@example
|
||||
$ ls -1 $ ls -1v
|
||||
foo.zml-1.gz foo.zml-1.gz
|
||||
foo.zml-100.gz foo.zml-2.gz
|
||||
foo.zml-12.gz foo.zml-6.gz
|
||||
foo.zml-13.gz foo.zml-12.gz
|
||||
foo.zml-2.gz foo.zml-13.gz
|
||||
foo.zml-25.gz foo.zml-25.gz
|
||||
foo.zml-6.gz foo.zml-100.gz
|
||||
abc.zml-1.gz abc.zml-1.gz
|
||||
abc.zml-12.gz abc.zml-2.gz
|
||||
abc.zml-2.gz abc.zml-12.gz
|
||||
@end example
|
||||
|
||||
Version-sorted strings are compared such that if @var{ver1} and @var{ver2}
|
||||
@@ -6720,11 +6766,27 @@ abc-1.012b.tgz abc-1.007.tgz
|
||||
abc-1.01a.tgz abc-1.012b.tgz
|
||||
@end example
|
||||
|
||||
This functionality is implemented using gnulib's @code{filevercmp} function.
|
||||
One result of that implementation decision is that @samp{ls -v}
|
||||
and @samp{sort -V} do not use the locale category, @env{LC_COLLATE},
|
||||
which means non-numeric prefixes are sorted as if @env{LC_COLLATE} were set
|
||||
to @samp{C}.
|
||||
This functionality is implemented using gnulib's @code{filevercmp} function,
|
||||
which has some caveats worth noting.
|
||||
|
||||
@itemize @bullet
|
||||
@item @env{LC_COLLATE} is ignored, which means @samp{ls -v} and @samp{sort -V}
|
||||
will sort non-numeric prefixes as if the @env{LC_COLLATE} locale category
|
||||
was set to @samp{C}.
|
||||
@item Some suffixes will not be matched by the regular
|
||||
expression mentioned above. Consequently these examples may
|
||||
not sort as you expect:
|
||||
|
||||
@example
|
||||
abc-1.2.3.4.7z
|
||||
abc-1.2.3.7z
|
||||
@end example
|
||||
|
||||
@example
|
||||
abc-1.2.3.4.x86_64.rpm
|
||||
abc-1.2.3.x86_64.rpm
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@node General output formatting
|
||||
@subsection General output formatting
|
||||
@@ -6884,11 +6946,10 @@ is 80.
|
||||
@node Formatting file timestamps
|
||||
@subsection Formatting file timestamps
|
||||
|
||||
By default, file timestamps are listed in abbreviated form. Most
|
||||
locales use a timestamp like @samp{2002-03-30 23:45}. However, the
|
||||
default @acronym{POSIX} locale uses a date like @samp{Mar 30@ @ 2002}
|
||||
for non-recent timestamps, and a date-without-year and time like
|
||||
@samp{Mar 30 23:45} for recent timestamps.
|
||||
By default, file timestamps are listed in abbreviated form, using
|
||||
a date like @samp{Mar 30@ @ 2002} for non-recent timestamps, and a
|
||||
date-without-year and time like @samp{Mar 30 23:45} for recent timestamps.
|
||||
This format can change depending on the current locale as detailed below.
|
||||
|
||||
A timestamp is considered to be @dfn{recent} if it is less than six
|
||||
months old, and is not dated in the future. If a timestamp dated
|
||||
@@ -7315,6 +7376,12 @@ Try to preserve SELinux security context and extended attributes (xattr),
|
||||
but ignore any failure to do that and print no corresponding diagnostic.
|
||||
Equivalent to @option{-dR --preserve=all} with the reduced diagnostics.
|
||||
|
||||
@itemx --attributes-only
|
||||
@opindex --attributes-only
|
||||
Preserve the specified attributes of the original files in the copy,
|
||||
but do not copy any data. See the @option{--preserve} option for
|
||||
controlling which attributes to copy.
|
||||
|
||||
@item -b
|
||||
@itemx @w{@kbd{--backup}[=@var{method}]}
|
||||
@opindex -b
|
||||
@@ -7476,19 +7543,18 @@ $ mkdir b c; (cd b; : > a; ln -s a b); cp -aL b c; ls -i1 c/b
|
||||
@end smallexample
|
||||
|
||||
@itemx context
|
||||
Preserve SELinux security context of the file. @command{cp} will fail
|
||||
if the preserving of SELinux security context is not succesful.
|
||||
Preserve SELinux security context of the file, or fail with full diagnostics.
|
||||
@itemx xattr
|
||||
Preserve extended attributes if @command{cp} is built with xattr support,
|
||||
and xattrs are supported and enabled on your file system.
|
||||
If SELinux context and/or ACLs are implemented using xattrs,
|
||||
Preserve extended attributes of the file, or fail with full diagnostics.
|
||||
If @command{cp} is built without xattr support, ignore this option.
|
||||
If SELinux context, ACLs or Capabilities are implemented using xattrs,
|
||||
they are preserved by this option as well.
|
||||
@itemx all
|
||||
Preserve all file attributes.
|
||||
Equivalent to specifying all of the above, but with the difference
|
||||
that failure to preserve SELinux security context or extended attributes
|
||||
does not change @command{cp}'s exit status.
|
||||
@command{cp} does diagnose such failures.
|
||||
does not change @command{cp}'s exit status. In contrast to @option{-a},
|
||||
all but @samp{Operation not supported} warnings are output.
|
||||
@end table
|
||||
|
||||
Using @option{--preserve} with no @var{attribute_list} is equivalent
|
||||
@@ -7979,6 +8045,11 @@ followed by a multiplier: @samp{b}=512, @samp{c}=1,
|
||||
@samp{w}=2, @samp{x@var{m}}=@var{m}, or any of the
|
||||
standard block size suffixes like @samp{k}=1024 (@pxref{Block size}).
|
||||
|
||||
Any block size you specify via @samp{bs=}, @samp{ibs=}, @samp{obs=}, @samp{cbs=}
|
||||
should not be too large---values larger than a few megabytes
|
||||
are generally wasteful or (as in the gigabyte..exabyte case) downright
|
||||
counterproductive or error-inducing.
|
||||
|
||||
Use different @command{dd} invocations to use different block sizes for
|
||||
skipping and I/O@. For example, the following shell commands copy data
|
||||
in 512 KiB blocks between a disk and a tape, but do not save or restore a
|
||||
@@ -8244,7 +8315,9 @@ the destination partition and the second and third would be left on the
|
||||
original partition.
|
||||
|
||||
@cindex extended attributes, xattr
|
||||
@command{mv} always tries to copy extended attributes (xattr).
|
||||
@command{mv} always tries to copy extended attributes (xattr), which may
|
||||
include SELinux context, ACLs or Capabilities.
|
||||
Upon failure all but @samp{Operation not supported} warnings are output.
|
||||
|
||||
@cindex prompting, and @command{mv}
|
||||
If a destination file exists but is normally unwritable, standard input
|
||||
@@ -8414,6 +8487,7 @@ removal is requested. Equivalent to @option{-I}.
|
||||
When removing a hierarchy recursively, skip any directory that is on a
|
||||
file system different from that of the corresponding command line argument.
|
||||
|
||||
@cindex bind mount
|
||||
This option is useful when removing a build ``chroot'' hierarchy,
|
||||
which normally contains no valuable data. However, it is not uncommon
|
||||
to bind-mount @file{/home} into such a hierarchy, to make it easier to
|
||||
@@ -8687,7 +8761,7 @@ The intended use of this is to shred a removed temporary file.
|
||||
For example:
|
||||
|
||||
@example
|
||||
i=`tempfile -m 0600`
|
||||
i=`mktemp`
|
||||
exec 3<>"$i"
|
||||
rm -- "$i"
|
||||
echo "Hello, world" >&3
|
||||
@@ -10384,7 +10458,9 @@ This option is equivalent to @option{--block-size=1M}.
|
||||
For each symbolic links encountered by @command{du},
|
||||
consider the disk space used by the symbolic link.
|
||||
|
||||
@item -d @var{depth}
|
||||
@item --max-depth=@var{depth}
|
||||
@opindex -d @var{depth}
|
||||
@opindex --max-depth=@var{depth}
|
||||
@cindex limiting output of @command{du}
|
||||
Show the total for each directory (and file if --all) that is at
|
||||
@@ -10554,6 +10630,7 @@ Without it, @command{stat} acts on any symbolic link argument directly.
|
||||
@cindex file systems
|
||||
Report information about the file systems where the given files are located
|
||||
instead of information about the files themselves.
|
||||
This option implies the @option{-L} option.
|
||||
|
||||
@item -c
|
||||
@itemx --format=@var{format}
|
||||
@@ -10602,6 +10679,7 @@ The valid @var{format} directives for files with @option{--format} and
|
||||
@item %A - Access rights in human readable form
|
||||
@item %b - Number of blocks allocated (see @samp{%B})
|
||||
@item %B - The size in bytes of each block reported by @samp{%b}
|
||||
@item %C - The SELinux security context of a file, if available
|
||||
@item %d - Device number in decimal
|
||||
@item %D - Device number in hex
|
||||
@item %f - Raw mode in hex
|
||||
@@ -10610,6 +10688,7 @@ The valid @var{format} directives for files with @option{--format} and
|
||||
@item %G - Group name of owner
|
||||
@item %h - Number of hard links
|
||||
@item %i - Inode number
|
||||
@item %m - Mount point (See note below)
|
||||
@item %n - File name
|
||||
@item %N - Quoted file name with dereference if symbolic link
|
||||
@item %o - I/O block size
|
||||
@@ -10618,6 +10697,8 @@ The valid @var{format} directives for files with @option{--format} and
|
||||
@item %T - Minor device type in hex
|
||||
@item %u - User ID of owner
|
||||
@item %U - User name of owner
|
||||
@item %w - Time of file birth, or @samp{-} if unknown
|
||||
@item %W - Time of file birth as seconds since Epoch, or @samp{-}
|
||||
@item %x - Time of last access
|
||||
@item %X - Time of last access as seconds since Epoch
|
||||
@item %y - Time of last modification
|
||||
@@ -10626,6 +10707,23 @@ The valid @var{format} directives for files with @option{--format} and
|
||||
@item %Z - Time of last change as seconds since Epoch
|
||||
@end itemize
|
||||
|
||||
The mount point printed by @samp{%m} is similar to that output
|
||||
by @command{df}, except that:
|
||||
@itemize @bullet
|
||||
@item
|
||||
stat does not dereference symlinks by default
|
||||
(unless @option{-L} is specified)
|
||||
@item
|
||||
stat does not search for specified device nodes in the
|
||||
file system list, instead operating on them directly
|
||||
@item
|
||||
@cindex bind mount
|
||||
stat outputs the alias for a bind mounted file, rather than
|
||||
the initial mount point of its backing device.
|
||||
One can recursively call stat until there is no change in output,
|
||||
to get the current base mount point
|
||||
@end itemize
|
||||
|
||||
When listing file system information (@option{--file-system} (@option{-f})),
|
||||
you must use a different set of @var{format} directives:
|
||||
|
||||
@@ -10722,13 +10820,13 @@ Treat @var{size} as number of I/O blocks of the @var{file} rather than bytes.
|
||||
@itemx --reference=@var{rfile}
|
||||
@opindex -r
|
||||
@opindex --reference
|
||||
Set the size of each @var{file} to the same size as @var{rfile}.
|
||||
Base the size of each @var{file} on the size of @var{rfile}.
|
||||
|
||||
@item -s @var{size}
|
||||
@itemx --size=@var{size}
|
||||
@opindex -s
|
||||
@opindex --size
|
||||
Set the size of each @var{file} to this @var{size}.
|
||||
Set or adjust the size of each @var{file} according to @var{size}.
|
||||
@multiplierSuffixesNoBlocks{size}
|
||||
|
||||
@var{size} may also be prefixed by one of the following to adjust
|
||||
@@ -11877,7 +11975,7 @@ This section describes commands that manipulate file names.
|
||||
|
||||
@menu
|
||||
* basename invocation:: Strip directory and suffix from a file name.
|
||||
* dirname invocation:: Strip non-directory suffix from a file name.
|
||||
* dirname invocation:: Strip last file name component.
|
||||
* pathchk invocation:: Check file name validity and portability.
|
||||
* mktemp invocation:: Create temporary file or directory.
|
||||
@end menu
|
||||
@@ -11938,7 +12036,7 @@ basename include/stdio.h .h
|
||||
|
||||
|
||||
@node dirname invocation
|
||||
@section @command{dirname}: Strip non-directory suffix from a file name
|
||||
@section @command{dirname}: Strip last file name component
|
||||
|
||||
@pindex dirname
|
||||
@cindex directory components, printing
|
||||
@@ -11946,14 +12044,17 @@ basename include/stdio.h .h
|
||||
@cindex non-directory suffix, stripping
|
||||
|
||||
@command{dirname} prints all but the final slash-delimited component of
|
||||
a string (presumably a file name). Synopsis:
|
||||
@var{name}. Slashes on either side of the final component are also
|
||||
removed. If the string contains no slash, @command{dirname} prints
|
||||
@samp{.} (meaning the current directory). Synopsis:
|
||||
|
||||
@example
|
||||
dirname @var{name}
|
||||
@end example
|
||||
|
||||
If @var{name} is a single component, @command{dirname} prints @samp{.}
|
||||
(meaning the current directory).
|
||||
@var{name} need not be a file name, but if it is, this operation
|
||||
effectively lists the directory that contains the final component,
|
||||
including the case when the final component is itself a directory.
|
||||
|
||||
@basenameAndDirname
|
||||
|
||||
@@ -11972,6 +12073,7 @@ Examples:
|
||||
@smallexample
|
||||
# Output "/usr/bin".
|
||||
dirname /usr/bin/sort
|
||||
dirname /usr/bin//.//
|
||||
|
||||
# Output ".".
|
||||
dirname stdio.h
|
||||
@@ -15190,31 +15292,25 @@ might find this idea strange at first.
|
||||
still running after the specified time interval. Synopsis:
|
||||
|
||||
@example
|
||||
timeout [@var{option}] @var{number}[smhd] @var{command} [@var{arg}]@dots{}
|
||||
timeout [@var{option}] @var{duration} @var{command} [@var{arg}]@dots{}
|
||||
@end example
|
||||
|
||||
@cindex time units
|
||||
@var{number} is an integer followed by an optional unit; the default
|
||||
is seconds. The units are:
|
||||
|
||||
@table @samp
|
||||
@item s
|
||||
seconds
|
||||
@item m
|
||||
minutes
|
||||
@item h
|
||||
hours
|
||||
@item d
|
||||
days
|
||||
@end table
|
||||
|
||||
@var{command} must not be a special built-in utility (@pxref{Special
|
||||
built-in utilities}).
|
||||
|
||||
The program accepts the following option. Also see @ref{Common options}.
|
||||
The program accepts the following options. Also see @ref{Common options}.
|
||||
Options must precede operands.
|
||||
|
||||
@table @samp
|
||||
@item -k @var{duration}
|
||||
@itemx --kill-after=@var{duration}
|
||||
@opindex -k
|
||||
@opindex --kill-after
|
||||
Ensure the monitored @var{command} is killed by also sending a @samp{KILL}
|
||||
signal, after the specified @var{duration}. Without this option, if the
|
||||
selected signal proves not to be fatal, @command{timeout} does not kill
|
||||
the @var{command}.
|
||||
|
||||
@item -s @var{signal}
|
||||
@itemx --signal=@var{signal}
|
||||
@opindex -s
|
||||
@@ -15222,9 +15318,18 @@ Options must precede operands.
|
||||
Send this @var{signal} to @var{command} on timeout, rather than the
|
||||
default @samp{TERM} signal. @var{signal} may be a name like @samp{HUP}
|
||||
or a number. Also see @xref{Signal specifications}.
|
||||
|
||||
@end table
|
||||
|
||||
@cindex time units
|
||||
@var{duration} is an integer followed by an optional unit:
|
||||
@display
|
||||
@samp{s} for seconds (the default)
|
||||
@samp{m} for minutes
|
||||
@samp{h} for hours
|
||||
@samp{d} for days
|
||||
@end display
|
||||
A duration of 0 disables the associated timeout.
|
||||
|
||||
@cindex exit status of @command{timeout}
|
||||
Exit status:
|
||||
|
||||
@@ -15430,7 +15535,7 @@ M8=`echo 2^31-1|bc` ; M9=`echo 2^61-1|bc`
|
||||
Similarly, factoring the eighth Fermat number @math{2^{256}+1} takes
|
||||
about 20 seconds on the same machine.
|
||||
|
||||
Factoring large prime numbers is, in general, hard. The Pollard Rho
|
||||
Factoring large numbers is, in general, hard. The Pollard Rho
|
||||
algorithm used by @command{factor} is particularly effective for
|
||||
numbers with relatively small factors. If you wish to factor large
|
||||
numbers which do not have small factors (for example, numbers which
|
||||
@@ -15573,7 +15678,7 @@ outputs 1.0000000000000000007 twice and skips 1.0000000000000000008.
|
||||
@chapter File permissions
|
||||
@include perm.texi
|
||||
|
||||
@include getdate.texi
|
||||
@include parse-datetime.texi
|
||||
|
||||
@c What's GNU?
|
||||
@c Arnold Robbins
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@c File mode bits
|
||||
|
||||
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006,
|
||||
@c 2008-2009 Free Software Foundation, Inc.
|
||||
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006, 2008-2010 Free Software
|
||||
@c Foundation, Inc.
|
||||
|
||||
@c Permission is granted to copy, distribute and/or modify this document
|
||||
@c under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
237
gl/lib/di-set.c
Normal file
237
gl/lib/di-set.c
Normal file
@@ -0,0 +1,237 @@
|
||||
/* Set operations for device-inode pairs stored in a space-efficient manner.
|
||||
|
||||
Copyright 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* written by Paul Eggert and Jim Meyering */
|
||||
|
||||
#include <config.h>
|
||||
#include "di-set.h"
|
||||
|
||||
#include "hash.h"
|
||||
#include "ino-map.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* The hash package hashes "void *", but this package wants to hash
|
||||
integers. Use integers that are as large as possible, but no
|
||||
larger than void *, so that they can be cast to void * and back
|
||||
without losing information. */
|
||||
typedef size_t hashint;
|
||||
#define HASHINT_MAX ((hashint) -1)
|
||||
|
||||
/* Integers represent inode numbers. Integers in the range
|
||||
1..(LARGE_INO_MIN-1) represent inode numbers directly. (The hash
|
||||
package does not work with null pointers, so inode 0 cannot be used
|
||||
as a key.) To find the representations of other inode numbers, map
|
||||
them through INO_MAP. */
|
||||
#define LARGE_INO_MIN (HASHINT_MAX / 2)
|
||||
|
||||
/* Set operations for device-inode pairs stored in a space-efficient
|
||||
manner. Use a two-level hash table. The top level hashes by
|
||||
device number, as there are typically a small number of devices.
|
||||
The lower level hashes by mapped inode numbers. In the typical
|
||||
case where the inode number is positive and small, the inode number
|
||||
maps to itself, masquerading as a void * value; otherwise, its
|
||||
value is the result of hashing the inode value through INO_MAP. */
|
||||
|
||||
/* A pair that maps a device number to a set of inode numbers. */
|
||||
struct di_ent
|
||||
{
|
||||
dev_t dev;
|
||||
struct hash_table *ino_set;
|
||||
};
|
||||
|
||||
/* A two-level hash table that manages and indexes these pairs. */
|
||||
struct di_set
|
||||
{
|
||||
/* Map device numbers to sets of inode number representatives. */
|
||||
struct hash_table *dev_map;
|
||||
|
||||
/* If nonnull, map large inode numbers to their small
|
||||
representatives. If null, there are no large inode numbers in
|
||||
this set. */
|
||||
struct ino_map *ino_map;
|
||||
|
||||
/* Cache of the most recently allocated and otherwise-unused storage
|
||||
for probing this table. */
|
||||
struct di_ent *probe;
|
||||
};
|
||||
|
||||
/* Hash a device-inode-set entry. */
|
||||
static size_t
|
||||
di_ent_hash (void const *x, size_t table_size)
|
||||
{
|
||||
struct di_ent const *p = x;
|
||||
dev_t dev = p->dev;
|
||||
|
||||
/* When DEV is wider than size_t, exclusive-OR the words of DEV into H.
|
||||
This avoids loss of info, without applying % to the wider type,
|
||||
which could be quite slow on some systems. */
|
||||
size_t h = dev;
|
||||
unsigned int i;
|
||||
unsigned int n_words = sizeof dev / sizeof h + (sizeof dev % sizeof h != 0);
|
||||
for (i = 1; i < n_words; i++)
|
||||
h ^= dev >> CHAR_BIT * sizeof h * i;
|
||||
|
||||
return h % table_size;
|
||||
}
|
||||
|
||||
/* Return true if two device-inode-set entries are the same. */
|
||||
static bool
|
||||
di_ent_compare (void const *x, void const *y)
|
||||
{
|
||||
struct di_ent const *a = x;
|
||||
struct di_ent const *b = y;
|
||||
return a->dev == b->dev;
|
||||
}
|
||||
|
||||
/* Free a device-inode-set entry. */
|
||||
static void
|
||||
di_ent_free (void *v)
|
||||
{
|
||||
struct di_ent *a = v;
|
||||
hash_free (a->ino_set);
|
||||
free (a);
|
||||
}
|
||||
|
||||
/* Create a set of device-inode pairs. Return NULL on allocation failure. */
|
||||
struct di_set *
|
||||
di_set_alloc (void)
|
||||
{
|
||||
struct di_set *dis = malloc (sizeof *dis);
|
||||
if (dis)
|
||||
{
|
||||
enum { INITIAL_DEV_MAP_SIZE = 11 };
|
||||
dis->dev_map = hash_initialize (INITIAL_DEV_MAP_SIZE, NULL,
|
||||
di_ent_hash, di_ent_compare,
|
||||
di_ent_free);
|
||||
if (! dis->dev_map)
|
||||
{
|
||||
free (dis);
|
||||
return NULL;
|
||||
}
|
||||
dis->ino_map = NULL;
|
||||
dis->probe = NULL;
|
||||
}
|
||||
|
||||
return dis;
|
||||
}
|
||||
|
||||
/* Free a set of device-inode pairs. */
|
||||
void
|
||||
di_set_free (struct di_set *dis)
|
||||
{
|
||||
hash_free (dis->dev_map);
|
||||
free (dis->ino_map);
|
||||
free (dis->probe);
|
||||
free (dis);
|
||||
}
|
||||
|
||||
/* Hash an encoded inode number I. */
|
||||
static size_t
|
||||
di_ino_hash (void const *i, size_t table_size)
|
||||
{
|
||||
return (hashint) i % table_size;
|
||||
}
|
||||
|
||||
/* Using the DIS table, map a device to a hash table that represents
|
||||
a set of inode numbers. Return NULL on error. */
|
||||
static struct hash_table *
|
||||
map_device (struct di_set *dis, dev_t dev)
|
||||
{
|
||||
/* Find space for the probe, reusing the cache if available. */
|
||||
struct di_ent *ent;
|
||||
struct di_ent *probe = dis->probe;
|
||||
if (probe)
|
||||
{
|
||||
/* If repeating a recent query, return the cached result. */
|
||||
if (probe->dev == dev)
|
||||
return probe->ino_set;
|
||||
}
|
||||
else
|
||||
{
|
||||
dis->probe = probe = malloc (sizeof *probe);
|
||||
if (! probe)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Probe for the device. */
|
||||
probe->dev = dev;
|
||||
ent = hash_insert (dis->dev_map, probe);
|
||||
if (! ent)
|
||||
return NULL;
|
||||
|
||||
if (ent != probe)
|
||||
{
|
||||
/* Use the existing entry. */
|
||||
probe->ino_set = ent->ino_set;
|
||||
}
|
||||
else
|
||||
{
|
||||
enum { INITIAL_INO_SET_SIZE = 1021 };
|
||||
|
||||
/* Prepare to allocate a new probe next time; this one is in use. */
|
||||
dis->probe = NULL;
|
||||
|
||||
/* DEV is new; allocate an inode set for it. */
|
||||
probe->ino_set = hash_initialize (INITIAL_INO_SET_SIZE, NULL,
|
||||
di_ino_hash, NULL, NULL);
|
||||
}
|
||||
|
||||
return probe->ino_set;
|
||||
}
|
||||
|
||||
/* Using the DIS table, map an inode number to a mapped value.
|
||||
Return INO_MAP_INSERT_FAILURE on error. */
|
||||
static hashint
|
||||
map_inode_number (struct di_set *dis, ino_t ino)
|
||||
{
|
||||
if (0 < ino && ino < LARGE_INO_MIN)
|
||||
return ino;
|
||||
|
||||
if (! dis->ino_map)
|
||||
{
|
||||
dis->ino_map = ino_map_alloc (LARGE_INO_MIN);
|
||||
if (! dis->ino_map)
|
||||
return INO_MAP_INSERT_FAILURE;
|
||||
}
|
||||
|
||||
return ino_map_insert (dis->ino_map, ino);
|
||||
}
|
||||
|
||||
/* Attempt to insert the DEV,INO pair into the set DIS.
|
||||
If it matches a pair already in DIS, keep that pair and return 0.
|
||||
Otherwise, if insertion is successful, return 1.
|
||||
Upon any failure return -1. */
|
||||
int
|
||||
di_set_insert (struct di_set *dis, dev_t dev, ino_t ino)
|
||||
{
|
||||
hashint i;
|
||||
|
||||
/* Map the device number to a set of inodes. */
|
||||
struct hash_table *ino_set = map_device (dis, dev);
|
||||
if (! ino_set)
|
||||
return -1;
|
||||
|
||||
/* Map the inode number to a small representative I. */
|
||||
i = map_inode_number (dis, ino);
|
||||
if (i == INO_MAP_INSERT_FAILURE)
|
||||
return -1;
|
||||
|
||||
/* Put I into the inode set. */
|
||||
return hash_insert0 (ino_set, (void *) i, NULL);
|
||||
}
|
||||
12
gl/lib/di-set.h
Normal file
12
gl/lib/di-set.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#undef _ATTRIBUTE_NONNULL_
|
||||
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
|
||||
# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
|
||||
#else
|
||||
# define _ATTRIBUTE_NONNULL_(m)
|
||||
#endif
|
||||
|
||||
struct di_set *di_set_alloc (void);
|
||||
int di_set_insert (struct di_set *, dev_t, ino_t) _ATTRIBUTE_NONNULL_ (1);
|
||||
void di_set_free (struct di_set *) _ATTRIBUTE_NONNULL_ (1);
|
||||
37
gl/lib/fadvise.c
Normal file
37
gl/lib/fadvise.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/* Declare an access pattern hint for files.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
#include "fadvise.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include "ignore-value.h"
|
||||
|
||||
void
|
||||
fdadvise (int fd, off_t offset, off_t len, fadvice_t advice)
|
||||
{
|
||||
#if HAVE_POSIX_FADVISE
|
||||
ignore_value (posix_fadvise (fd, offset, len, advice));
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
fadvise (FILE *fp, fadvice_t advice)
|
||||
{
|
||||
if (fp)
|
||||
fdadvise (fileno (fp), 0, 0, advice);
|
||||
}
|
||||
72
gl/lib/fadvise.h
Normal file
72
gl/lib/fadvise.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/* Declare an access pattern hint for files.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* There are a few hints one can provide, which have the
|
||||
following characteristics on Linux 2.6.31 at least.
|
||||
|
||||
POSIX_FADV_SEQUENTIAL
|
||||
Doubles the size of read ahead done for file
|
||||
POSIX_FADV_WILLNEED
|
||||
_synchronously_ prepopulate the buffer cache with the file
|
||||
POSIX_FADV_NOREUSE
|
||||
Could lower priority of data in buffer caches,
|
||||
but currently does nothing.
|
||||
POSIX_FADV_DONTNEED
|
||||
Drop the file from cache.
|
||||
Note this is automatically done when files are unlinked.
|
||||
|
||||
We use this enum "type" both to make it explicit that
|
||||
these options are mutually exclusive, and to discourage
|
||||
the passing of the possibly undefined POSIX_FADV_... values.
|
||||
Note we could #undef the POSIX_FADV_ values, but that would
|
||||
preclude using the posix_fadvise() function with its standard
|
||||
constants. Using posix_fadvise() might be required if the return
|
||||
value is needed, but it must be guarded by appropriate #ifdefs. */
|
||||
|
||||
#if HAVE_POSIX_FADVISE
|
||||
typedef enum {
|
||||
FADVISE_NORMAL = POSIX_FADV_NORMAL,
|
||||
FADVISE_SEQUENTIAL = POSIX_FADV_SEQUENTIAL,
|
||||
FADVISE_NOREUSE = POSIX_FADV_NOREUSE,
|
||||
FADVISE_DONTNEED = POSIX_FADV_DONTNEED,
|
||||
FADVISE_WILLNEED = POSIX_FADV_WILLNEED,
|
||||
FADVISE_RANDOM = POSIX_FADV_RANDOM,
|
||||
} fadvice_t;
|
||||
#else
|
||||
typedef enum {
|
||||
FADVISE_NORMAL,
|
||||
FADVISE_SEQUENTIAL,
|
||||
FADVISE_NOREUSE,
|
||||
FADVISE_DONTNEED,
|
||||
FADVISE_WILLNEED,
|
||||
FADVISE_RANDOM,
|
||||
} fadvice_t;
|
||||
#endif
|
||||
|
||||
/* We ignore any errors as these hints are only advisory.
|
||||
There is the chance one can pass invalid ADVICE, which will
|
||||
not be indicated, but given the simplicity of the interface
|
||||
this is unlikely. Also not returning errors allows the
|
||||
unconditional passing of descriptors to non standard files,
|
||||
which will just be ignored if unsupported. */
|
||||
|
||||
void fdadvise (int fd, off_t offset, off_t len, fadvice_t advice);
|
||||
void fadvise (FILE *fp, fadvice_t advice);
|
||||
149
gl/lib/heap.c
Normal file
149
gl/lib/heap.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/* Barebones heap implementation supporting only insert and pop.
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Full implementation: GDSL (http://gna.org/projects/gdsl/) by Nicolas
|
||||
Darnis <ndarnis@free.fr>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "heap.h"
|
||||
#include "stdlib--.h"
|
||||
#include "xalloc.h"
|
||||
|
||||
static int heap_default_compare (void const *, void const *);
|
||||
static size_t heapify_down (void **, size_t, size_t,
|
||||
int (*) (void const *, void const *));
|
||||
static void heapify_up (void **, size_t,
|
||||
int (*) (void const *, void const *));
|
||||
|
||||
struct heap
|
||||
{
|
||||
void **array; /* array[0] is not used */
|
||||
size_t capacity; /* Array size */
|
||||
size_t count; /* Used as index to last element. Also is num of items. */
|
||||
int (*compare) (void const *, void const *);
|
||||
};
|
||||
|
||||
/* Allocate memory for the heap. */
|
||||
|
||||
struct heap *
|
||||
heap_alloc (int (*compare) (void const *, void const *), size_t n_reserve)
|
||||
{
|
||||
struct heap *heap = xmalloc (sizeof *heap);
|
||||
|
||||
if (n_reserve == 0)
|
||||
n_reserve = 1;
|
||||
|
||||
heap->array = xnmalloc (n_reserve, sizeof *(heap->array));
|
||||
|
||||
heap->array[0] = NULL;
|
||||
heap->capacity = n_reserve;
|
||||
heap->count = 0;
|
||||
heap->compare = compare ? compare : heap_default_compare;
|
||||
|
||||
return heap;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
heap_default_compare (void const *a, void const *b)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
heap_free (struct heap *heap)
|
||||
{
|
||||
free (heap->array);
|
||||
free (heap);
|
||||
}
|
||||
|
||||
/* Insert element into heap. */
|
||||
|
||||
int
|
||||
heap_insert (struct heap *heap, void *item)
|
||||
{
|
||||
if (heap->capacity - 1 <= heap->count)
|
||||
heap->array = x2nrealloc (heap->array, &heap->capacity,
|
||||
sizeof *(heap->array));
|
||||
|
||||
heap->array[++heap->count] = item;
|
||||
heapify_up (heap->array, heap->count, heap->compare);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Pop top element off heap. */
|
||||
|
||||
void *
|
||||
heap_remove_top (struct heap *heap)
|
||||
{
|
||||
if (heap->count == 0)
|
||||
return NULL;
|
||||
|
||||
void *top = heap->array[1];
|
||||
heap->array[1] = heap->array[heap->count--];
|
||||
heapify_down (heap->array, heap->count, 1, heap->compare);
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
/* Move element down into appropriate position in heap. */
|
||||
|
||||
static size_t
|
||||
heapify_down (void **array, size_t count, size_t initial,
|
||||
int (*compare) (void const *, void const *))
|
||||
{
|
||||
void *element = array[initial];
|
||||
|
||||
size_t parent = initial;
|
||||
while (parent <= count / 2)
|
||||
{
|
||||
size_t child = 2 * parent;
|
||||
|
||||
if (child < count && compare (array[child], array[child+1]) < 0)
|
||||
child++;
|
||||
|
||||
if (compare (array[child], element) <= 0)
|
||||
break;
|
||||
|
||||
array[parent] = array[child];
|
||||
parent = child;
|
||||
}
|
||||
|
||||
array[parent] = element;
|
||||
return parent;
|
||||
}
|
||||
|
||||
/* Move element up into appropriate position in heap. */
|
||||
|
||||
static void
|
||||
heapify_up (void **array, size_t count,
|
||||
int (*compare) (void const *, void const *))
|
||||
{
|
||||
size_t k = count;
|
||||
void *new_element = array[k];
|
||||
|
||||
while (k != 1 && compare (array[k/2], new_element) <= 0)
|
||||
{
|
||||
array[k] = array[k/2];
|
||||
k /= 2;
|
||||
}
|
||||
|
||||
array[k] = new_element;
|
||||
}
|
||||
26
gl/lib/heap.h
Normal file
26
gl/lib/heap.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Barebones heap implementation supporting only insert and pop.
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Full implementation: GDSL (http://gna.org/projects/gdsl/) by Nicolas
|
||||
Darnis <ndarnis@free.fr>. Adapted by Gene Auyeung. */
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct heap *heap_alloc (int (*) (void const *, void const *), size_t);
|
||||
void heap_free (struct heap *);
|
||||
int heap_insert (struct heap *heap, void *item);
|
||||
void *heap_remove_top (struct heap *heap);
|
||||
164
gl/lib/ino-map.c
Normal file
164
gl/lib/ino-map.c
Normal file
@@ -0,0 +1,164 @@
|
||||
/* Map an ino_t inode number to a small integer.
|
||||
|
||||
Copyright 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* written by Paul Eggert and Jim Meyering */
|
||||
|
||||
#include <config.h>
|
||||
#include "ino-map.h"
|
||||
|
||||
#include "hash.h"
|
||||
#include "verify.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* A pair that maps an inode number to a mapped inode number; the
|
||||
latter is a small unique ID for the former. */
|
||||
struct ino_map_ent
|
||||
{
|
||||
ino_t ino;
|
||||
size_t mapped_ino;
|
||||
};
|
||||
|
||||
/* A table that manages and indexes these pairs. */
|
||||
struct ino_map
|
||||
{
|
||||
/* A table of KEY,VAL pairs, where KEY is the raw ino_t value and
|
||||
VAL is the small number that it maps to. */
|
||||
struct hash_table *map;
|
||||
|
||||
/* The next mapped inode number to hand out. */
|
||||
size_t next_mapped_ino;
|
||||
|
||||
/* Cache of the most recently allocated and otherwise-unused storage
|
||||
for probing the table. */
|
||||
struct ino_map_ent *probe;
|
||||
};
|
||||
|
||||
/* Hash an inode map entry. */
|
||||
static size_t
|
||||
ino_hash (void const *x, size_t table_size)
|
||||
{
|
||||
struct ino_map_ent const *p = x;
|
||||
ino_t ino = p->ino;
|
||||
|
||||
/* When INO is wider than size_t, exclusive-OR the words of INO into H.
|
||||
This avoids loss of info, without applying % to the wider type,
|
||||
which could be quite slow on some systems. */
|
||||
size_t h = ino;
|
||||
unsigned int i;
|
||||
unsigned int n_words = sizeof ino / sizeof h + (sizeof ino % sizeof h != 0);
|
||||
for (i = 1; i < n_words; i++)
|
||||
h ^= ino >> CHAR_BIT * sizeof h * i;
|
||||
|
||||
return h % table_size;
|
||||
}
|
||||
|
||||
/* Return true if two inode map entries are the same. */
|
||||
static bool
|
||||
ino_compare (void const *x, void const *y)
|
||||
{
|
||||
struct ino_map_ent const *a = x;
|
||||
struct ino_map_ent const *b = y;
|
||||
return a->ino == b->ino;
|
||||
}
|
||||
|
||||
/* Allocate an inode map that will hand out integers starting with
|
||||
NEXT_MAPPED_INO. Return NULL if memory is exhausted. */
|
||||
struct ino_map *
|
||||
ino_map_alloc (size_t next_mapped_ino)
|
||||
{
|
||||
struct ino_map *im = malloc (sizeof *im);
|
||||
|
||||
if (im)
|
||||
{
|
||||
enum { INITIAL_INO_MAP_TABLE_SIZE = 1021 };
|
||||
im->map = hash_initialize (INITIAL_INO_MAP_TABLE_SIZE, NULL,
|
||||
ino_hash, ino_compare, free);
|
||||
if (! im->map)
|
||||
{
|
||||
free (im);
|
||||
return NULL;
|
||||
}
|
||||
im->next_mapped_ino = next_mapped_ino;
|
||||
im->probe = NULL;
|
||||
}
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
/* Free an inode map. */
|
||||
void
|
||||
ino_map_free (struct ino_map *map)
|
||||
{
|
||||
hash_free (map->map);
|
||||
free (map->probe);
|
||||
free (map);
|
||||
}
|
||||
|
||||
|
||||
/* Insert into MAP the inode number INO if it's not there already,
|
||||
and return its nonnegative mapped inode number.
|
||||
If INO is already in MAP, return the existing mapped inode number.
|
||||
Return INO_MAP_INSERT_FAILURE on memory or counter exhaustion. */
|
||||
size_t
|
||||
ino_map_insert (struct ino_map *im, ino_t ino)
|
||||
{
|
||||
struct ino_map_ent *ent;
|
||||
|
||||
/* Find space for the probe, reusing the cache if available. */
|
||||
struct ino_map_ent *probe = im->probe;
|
||||
if (probe)
|
||||
{
|
||||
/* If repeating a recent query, return the cached result. */
|
||||
if (probe->ino == ino)
|
||||
return probe->mapped_ino;
|
||||
}
|
||||
else
|
||||
{
|
||||
im->probe = probe = malloc (sizeof *probe);
|
||||
if (! probe)
|
||||
return INO_MAP_INSERT_FAILURE;
|
||||
}
|
||||
|
||||
probe->ino = ino;
|
||||
ent = hash_insert (im->map, probe);
|
||||
if (! ent)
|
||||
return INO_MAP_INSERT_FAILURE;
|
||||
|
||||
if (ent != probe)
|
||||
{
|
||||
/* Use the existing entry. */
|
||||
probe->mapped_ino = ent->mapped_ino;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If adding 1 to map->next_mapped_ino would cause it to
|
||||
overflow to zero, then it must equal INO_MAP_INSERT_FAILURE,
|
||||
which is the value that should be returned in that case.
|
||||
Verify that this works. */
|
||||
verify (INO_MAP_INSERT_FAILURE + 1 == 0);
|
||||
|
||||
/* Prepare to allocate a new probe next time; this one is in use. */
|
||||
im->probe = NULL;
|
||||
|
||||
/* INO is new; allocate a mapped inode number for it. */
|
||||
probe->mapped_ino = im->next_mapped_ino++;
|
||||
}
|
||||
|
||||
return probe->mapped_ino;
|
||||
}
|
||||
14
gl/lib/ino-map.h
Normal file
14
gl/lib/ino-map.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#undef _ATTRIBUTE_NONNULL_
|
||||
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
|
||||
# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
|
||||
#else
|
||||
# define _ATTRIBUTE_NONNULL_(m)
|
||||
#endif
|
||||
|
||||
#define INO_MAP_INSERT_FAILURE ((size_t) -1)
|
||||
|
||||
struct ino_map *ino_map_alloc (size_t);
|
||||
void ino_map_free (struct ino_map *) _ATTRIBUTE_NONNULL_ (1);
|
||||
size_t ino_map_insert (struct ino_map *, ino_t) _ATTRIBUTE_NONNULL_ (1);
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Align/Truncate a string in a given screen width
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <limits.h>
|
||||
#include <wchar.h>
|
||||
@@ -32,6 +33,7 @@
|
||||
#endif
|
||||
|
||||
/* Replace non printable chars.
|
||||
Note \t and \n etc. are non printable.
|
||||
Return 1 if replacement made, 0 otherwise. */
|
||||
|
||||
static bool
|
||||
@@ -119,19 +121,19 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
|
||||
ALIGNMENT specifies whether to left- or right-justify or to center.
|
||||
If SRC requires more than *WIDTH columns, truncate it to fit.
|
||||
When centering, the number of trailing spaces may be one less than the
|
||||
number of leading spaces. The FLAGS parameter is unused at present.
|
||||
number of leading spaces.
|
||||
Return the length in bytes required for the final result, not counting
|
||||
the trailing NUL. A return value of DEST_SIZE or larger means there
|
||||
wasn't enough space. DEST will be NUL terminated in any case.
|
||||
Return (size_t) -1 upon error (invalid multi-byte sequence in SRC,
|
||||
or malloc failure).
|
||||
Return SIZE_MAX upon error (invalid multi-byte sequence in SRC,
|
||||
or malloc failure), unless MBA_UNIBYTE_FALLBACK is specified.
|
||||
Update *WIDTH to indicate how many columns were used before padding. */
|
||||
|
||||
size_t
|
||||
mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
size_t *width, mbs_align_t align, int flags _UNUSED_PARAMETER_)
|
||||
size_t *width, mbs_align_t align, int flags)
|
||||
{
|
||||
size_t ret = -1;
|
||||
size_t ret = SIZE_MAX;
|
||||
size_t src_size = strlen (src) + 1;
|
||||
char *newstr = NULL;
|
||||
wchar_t *str_wc = NULL;
|
||||
@@ -148,13 +150,23 @@ mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
if (MB_CUR_MAX > 1)
|
||||
{
|
||||
size_t src_chars = mbstowcs (NULL, src, 0);
|
||||
if (src_chars == (size_t) -1)
|
||||
goto mbsalign_cleanup;
|
||||
if (src_chars == SIZE_MAX)
|
||||
{
|
||||
if (flags & MBA_UNIBYTE_FALLBACK)
|
||||
goto mbsalign_unibyte;
|
||||
else
|
||||
goto mbsalign_cleanup;
|
||||
}
|
||||
src_chars += 1; /* make space for NUL */
|
||||
str_wc = malloc (src_chars * sizeof (wchar_t));
|
||||
if (str_wc == NULL)
|
||||
goto mbsalign_cleanup;
|
||||
if (mbstowcs (str_wc, src, src_chars) > 0)
|
||||
{
|
||||
if (flags & MBA_UNIBYTE_FALLBACK)
|
||||
goto mbsalign_unibyte;
|
||||
else
|
||||
goto mbsalign_cleanup;
|
||||
}
|
||||
if (mbstowcs (str_wc, src, src_chars) != 0)
|
||||
{
|
||||
str_wc[src_chars - 1] = L'\0';
|
||||
wc_enabled = true;
|
||||
@@ -165,27 +177,36 @@ mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
|
||||
/* If we transformed or need to truncate the source string
|
||||
then create a modified copy of it. */
|
||||
if (conversion || (n_cols > *width))
|
||||
if (wc_enabled && (conversion || (n_cols > *width)))
|
||||
{
|
||||
newstr = malloc (src_size);
|
||||
if (newstr == NULL)
|
||||
goto mbsalign_cleanup;
|
||||
str_to_print = newstr;
|
||||
if (wc_enabled)
|
||||
if (conversion)
|
||||
{
|
||||
/* May have increased the size by converting
|
||||
\t to \uFFFD for example. */
|
||||
src_size = wcstombs (NULL, str_wc, 0) + 1;
|
||||
}
|
||||
newstr = malloc (src_size);
|
||||
if (newstr == NULL)
|
||||
{
|
||||
n_cols = wc_truncate (str_wc, *width);
|
||||
n_used_bytes = wcstombs (newstr, str_wc, src_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
n_cols = *width;
|
||||
n_used_bytes = n_cols;
|
||||
memcpy (newstr, src, n_cols);
|
||||
newstr[n_cols] = '\0';
|
||||
if (flags & MBA_UNIBYTE_FALLBACK)
|
||||
goto mbsalign_unibyte;
|
||||
else
|
||||
goto mbsalign_cleanup;
|
||||
}
|
||||
str_to_print = newstr;
|
||||
n_cols = wc_truncate (str_wc, *width);
|
||||
n_used_bytes = wcstombs (newstr, str_wc, src_size);
|
||||
}
|
||||
|
||||
if (*width > n_cols)
|
||||
mbsalign_unibyte:
|
||||
|
||||
if (n_cols > *width) /* Unibyte truncation required. */
|
||||
{
|
||||
n_cols = *width;
|
||||
n_used_bytes = n_cols;
|
||||
}
|
||||
|
||||
if (*width > n_cols) /* Padding required. */
|
||||
n_spaces = *width - n_cols;
|
||||
|
||||
/* indicate to caller how many cells needed (not including padding). */
|
||||
@@ -197,16 +218,11 @@ mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
/* Write as much NUL terminated output to DEST as possible. */
|
||||
if (dest_size != 0)
|
||||
{
|
||||
size_t start_spaces, end_spaces, space_left;
|
||||
char *dest_end = dest + dest_size - 1;
|
||||
size_t start_spaces = n_spaces / 2 + n_spaces % 2;
|
||||
size_t end_spaces = n_spaces / 2;
|
||||
|
||||
switch (align)
|
||||
{
|
||||
case MBS_ALIGN_CENTER:
|
||||
start_spaces = n_spaces / 2 + n_spaces % 2;
|
||||
end_spaces = n_spaces / 2;
|
||||
break;
|
||||
case MBS_ALIGN_LEFT:
|
||||
start_spaces = 0;
|
||||
end_spaces = n_spaces;
|
||||
@@ -215,10 +231,16 @@ mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
start_spaces = n_spaces;
|
||||
end_spaces = 0;
|
||||
break;
|
||||
case MBS_ALIGN_CENTER:
|
||||
default:
|
||||
start_spaces = n_spaces / 2 + n_spaces % 2;
|
||||
end_spaces = n_spaces / 2;
|
||||
break;
|
||||
}
|
||||
|
||||
dest = mbs_align_pad (dest, dest_end, start_spaces);
|
||||
dest = mempcpy(dest, str_to_print, MIN (n_used_bytes, dest_end - dest));
|
||||
space_left = dest_end - dest;
|
||||
dest = mempcpy (dest, str_to_print, MIN (n_used_bytes, space_left));
|
||||
mbs_align_pad (dest, dest_end, end_spaces);
|
||||
}
|
||||
|
||||
@@ -229,3 +251,40 @@ mbsalign_cleanup:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* A wrapper around mbsalign() to dynamically allocate the
|
||||
minimum amount of memory to store the result.
|
||||
Return NULL on failure. */
|
||||
|
||||
char *
|
||||
ambsalign (const char *src, size_t *width, mbs_align_t align, int flags)
|
||||
{
|
||||
size_t orig_width = *width;
|
||||
size_t size = *width; /* Start with enough for unibyte mode. */
|
||||
size_t req = size;
|
||||
char *buf = NULL;
|
||||
|
||||
while (req >= size)
|
||||
{
|
||||
char *nbuf;
|
||||
size = req + 1; /* Space for NUL. */
|
||||
nbuf = realloc (buf, size);
|
||||
if (nbuf == NULL)
|
||||
{
|
||||
free (buf);
|
||||
buf = NULL;
|
||||
break;
|
||||
}
|
||||
buf = nbuf;
|
||||
*width = orig_width;
|
||||
req = mbsalign (src, buf, size, width, align, flags);
|
||||
if (req == SIZE_MAX)
|
||||
{
|
||||
free (buf);
|
||||
buf = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Align/Truncate a string in a given screen width
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -18,6 +18,29 @@
|
||||
|
||||
typedef enum { MBS_ALIGN_LEFT, MBS_ALIGN_RIGHT, MBS_ALIGN_CENTER } mbs_align_t;
|
||||
|
||||
enum {
|
||||
/* Use unibyte mode for invalid multibyte strings or
|
||||
or when heap memory is exhausted. */
|
||||
MBA_UNIBYTE_FALLBACK = 0x0001
|
||||
|
||||
#if 0 /* Other possible options. */
|
||||
/* Skip invalid multibyte chars rather than failing */
|
||||
MBA_IGNORE_INVALID = 0x0002,
|
||||
|
||||
/* Align multibyte strings using "figure space" (\u2007) */
|
||||
MBA_USE_FIGURE_SPACE = 0x0004,
|
||||
|
||||
/* Don't add any padding */
|
||||
MBA_TRUNCATE_ONLY = 0x0008,
|
||||
|
||||
/* Don't truncate */
|
||||
MBA_PAD_ONLY = 0x0010,
|
||||
#endif
|
||||
};
|
||||
|
||||
size_t
|
||||
mbsalign (const char *src, char *dest, size_t dest_size,
|
||||
size_t *width, mbs_align_t align, int flags);
|
||||
|
||||
char *
|
||||
ambsalign (const char *src, size_t *width, mbs_align_t align, int flags);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Bob Jenkins's cryptographic random number generator, ISAAC.
|
||||
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
|
||||
|
||||
Copyright (C) 1999-2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2006, 2009-2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Colin Plumb.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Written by Colin Plumb. */
|
||||
Written by Colin Plumb and Paul Eggert. */
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
@@ -34,60 +34,90 @@
|
||||
|
||||
#include "rand-isaac.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "gethrxtime.h"
|
||||
|
||||
|
||||
/* This index operation is more efficient on many processors */
|
||||
#define ind(mm, x) \
|
||||
(* (uint32_t *) ((char *) (mm) \
|
||||
+ ((x) & (ISAAC_WORDS - 1) * sizeof (uint32_t))))
|
||||
|
||||
/*
|
||||
* The central step. This uses two temporaries, x and y. mm is the
|
||||
* whole state array, while m is a pointer to the current word. off is
|
||||
* the offset from m to the word ISAAC_WORDS/2 words away in the mm array,
|
||||
* i.e. +/- ISAAC_WORDS/2.
|
||||
*/
|
||||
#define isaac_step(mix, a, b, mm, m, off, r) \
|
||||
( \
|
||||
a = ((a) ^ (mix)) + (m)[off], \
|
||||
x = *(m), \
|
||||
*(m) = y = ind (mm, x) + (a) + (b), \
|
||||
*(r) = b = ind (mm, (y) >> ISAAC_LOG) + x \
|
||||
)
|
||||
|
||||
/* Use and update *S to generate random data to fill R. */
|
||||
void
|
||||
isaac_refill (struct isaac_state *s, uint32_t r[ISAAC_WORDS])
|
||||
/* The minimum of two sizes A and B. */
|
||||
static inline size_t
|
||||
min (size_t a, size_t b)
|
||||
{
|
||||
uint32_t a, b; /* Caches of a and b */
|
||||
uint32_t x, y; /* Temps needed by isaac_step macro */
|
||||
uint32_t *m = s->mm; /* Pointer into state array */
|
||||
return (a < b ? a : b);
|
||||
}
|
||||
|
||||
a = s->a;
|
||||
b = s->b + (++s->c);
|
||||
/* A if 32-bit ISAAC, B if 64-bit. This is a macro, not an inline
|
||||
function, to prevent undefined behavior if the unused argument
|
||||
shifts by more than a word width. */
|
||||
#define IF32(a, b) (ISAAC_BITS == 32 ? (a) : (b))
|
||||
|
||||
/* Discard bits outside the desired range. On typical machines, any
|
||||
decent compiler should optimize this function call away to nothing.
|
||||
But machines with pad bits in integers may need to do more work. */
|
||||
static inline isaac_word
|
||||
just (isaac_word a)
|
||||
{
|
||||
isaac_word desired_bits = ((isaac_word) 1 << 1 << (ISAAC_BITS - 1)) - 1;
|
||||
return a & desired_bits;
|
||||
}
|
||||
|
||||
/* The index operation. On typical machines whose words are exactly
|
||||
the right size, this is optimized to a mask, an addition, and an
|
||||
indirect load. Atypical machines need more work. */
|
||||
static inline isaac_word
|
||||
ind (isaac_word const *m, isaac_word x)
|
||||
{
|
||||
return (sizeof *m * CHAR_BIT == ISAAC_BITS
|
||||
? (* (isaac_word *) ((char *) m
|
||||
+ (x & ((ISAAC_WORDS - 1) * sizeof *m))))
|
||||
: m[(x / (ISAAC_BITS / CHAR_BIT)) & (ISAAC_WORDS - 1)]);
|
||||
}
|
||||
|
||||
/* Use and update *S to generate random data to fill RESULT. */
|
||||
void
|
||||
isaac_refill (struct isaac_state *s, isaac_word result[ISAAC_WORDS])
|
||||
{
|
||||
/* Caches of S->a and S->b. */
|
||||
isaac_word a = s->a;
|
||||
isaac_word b = s->b + (++s->c);
|
||||
|
||||
/* Pointers into state array and into result. */
|
||||
isaac_word *m = s->m;
|
||||
isaac_word *r = result;
|
||||
|
||||
enum { HALF = ISAAC_WORDS / 2 };
|
||||
|
||||
/* The central step. S->m is the whole state array, while M is a
|
||||
pointer to the current word. OFF is the offset from M to the
|
||||
word ISAAC_WORDS/2 words away in the SM array, i.e. +/-
|
||||
ISAAC_WORDS/2. A and B are state variables, and R the result.
|
||||
This updates A, B, M[I], and R[I]. */
|
||||
#define ISAAC_STEP(i, off, mix) \
|
||||
{ \
|
||||
isaac_word x, y; \
|
||||
a = (IF32 (a, 0) ^ (mix)) + m[off + (i)]; \
|
||||
x = m[i]; \
|
||||
m[i] = y = ind (s->m, x) + a + b; \
|
||||
r[i] = b = just (ind (s->m, y >> ISAAC_WORDS_LOG) + x); \
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
isaac_step (a << 13, a, b, s->mm, m, ISAAC_WORDS / 2, r);
|
||||
isaac_step (a >> 6, a, b, s->mm, m + 1, ISAAC_WORDS / 2, r + 1);
|
||||
isaac_step (a << 2, a, b, s->mm, m + 2, ISAAC_WORDS / 2, r + 2);
|
||||
isaac_step (a >> 16, a, b, s->mm, m + 3, ISAAC_WORDS / 2, r + 3);
|
||||
ISAAC_STEP (0, HALF, IF32 ( a << 13, ~ (a ^ (a << 21))));
|
||||
ISAAC_STEP (1, HALF, IF32 (just (a) >> 6, a ^ (just (a) >> 5)));
|
||||
ISAAC_STEP (2, HALF, IF32 ( a << 2, a ^ ( a << 12)));
|
||||
ISAAC_STEP (3, HALF, IF32 (just (a) >> 16, a ^ (just (a) >> 33)));
|
||||
r += 4;
|
||||
}
|
||||
while ((m += 4) < s->mm + ISAAC_WORDS / 2);
|
||||
while ((m += 4) < s->m + HALF);
|
||||
|
||||
do
|
||||
{
|
||||
isaac_step (a << 13, a, b, s->mm, m, -ISAAC_WORDS / 2, r);
|
||||
isaac_step (a >> 6, a, b, s->mm, m + 1, -ISAAC_WORDS / 2, r + 1);
|
||||
isaac_step (a << 2, a, b, s->mm, m + 2, -ISAAC_WORDS / 2, r + 2);
|
||||
isaac_step (a >> 16, a, b, s->mm, m + 3, -ISAAC_WORDS / 2, r + 3);
|
||||
ISAAC_STEP (0, -HALF, IF32 ( a << 13, ~ (a ^ (a << 21))));
|
||||
ISAAC_STEP (1, -HALF, IF32 (just (a) >> 6, a ^ (just (a) >> 5)));
|
||||
ISAAC_STEP (2, -HALF, IF32 ( a << 2, a ^ ( a << 12)));
|
||||
ISAAC_STEP (3, -HALF, IF32 (just (a) >> 16, a ^ (just (a) >> 33)));
|
||||
r += 4;
|
||||
}
|
||||
while ((m += 4) < s->mm + ISAAC_WORDS);
|
||||
while ((m += 4) < s->m + ISAAC_WORDS);
|
||||
|
||||
s->a = a;
|
||||
s->b = b;
|
||||
}
|
||||
@@ -96,205 +126,133 @@ isaac_refill (struct isaac_state *s, uint32_t r[ISAAC_WORDS])
|
||||
* The basic seed-scrambling step for initialization, based on Bob
|
||||
* Jenkins' 256-bit hash.
|
||||
*/
|
||||
#define mix(a,b,c,d,e,f,g,h) \
|
||||
( a ^= b << 11, d += a, \
|
||||
b += c, b ^= c >> 2, e += b, \
|
||||
c += d, c ^= d << 8, f += c, \
|
||||
d += e, d ^= e >> 16, g += d, \
|
||||
e += f, e ^= f << 10, h += e, \
|
||||
f += g, f ^= g >> 4, a += f, \
|
||||
g += h, g ^= h << 8, b += g, \
|
||||
h += a, h ^= a >> 9, c += h, \
|
||||
a += b )
|
||||
#if ISAAC_BITS == 32
|
||||
#define mix(a, b, c, d, e, f, g, h) \
|
||||
{ \
|
||||
a ^= b << 11; d += a; \
|
||||
b += c; b ^= just (c) >> 2; e += b; \
|
||||
c += d; c ^= d << 8; f += c; \
|
||||
d += e; d ^= just (e) >> 16; g += d; \
|
||||
e += f; e ^= f << 10; h += e; \
|
||||
f += g; f ^= just (g) >> 4; a += f; \
|
||||
g += h; g ^= h << 8; b += g; \
|
||||
h += a; h ^= just (a) >> 9; c += h; \
|
||||
a += b; \
|
||||
}
|
||||
#else
|
||||
#define mix(a, b, c, d, e, f, g, h) \
|
||||
{ \
|
||||
a -= e; f ^= just (h) >> 9; h += a; \
|
||||
b -= f; g ^= a << 9; a += b; \
|
||||
c -= g; h ^= just (b) >> 23; b += c; \
|
||||
d -= h; a ^= c << 15; c += d; \
|
||||
e -= a; b ^= just (d) >> 14; d += e; \
|
||||
f -= b; c ^= e << 20; e += f; \
|
||||
g -= c; d ^= just (f) >> 17; f += g; \
|
||||
h -= d; e ^= g << 14; g += h; \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* The basic ISAAC initialization pass. */
|
||||
static void
|
||||
isaac_mix (struct isaac_state *s, uint32_t const seed[/* ISAAC_WORDS */])
|
||||
{
|
||||
int i;
|
||||
uint32_t a = s->iv[0];
|
||||
uint32_t b = s->iv[1];
|
||||
uint32_t c = s->iv[2];
|
||||
uint32_t d = s->iv[3];
|
||||
uint32_t e = s->iv[4];
|
||||
uint32_t f = s->iv[5];
|
||||
uint32_t g = s->iv[6];
|
||||
uint32_t h = s->iv[7];
|
||||
|
||||
for (i = 0; i < ISAAC_WORDS; i += 8)
|
||||
{
|
||||
a += seed[i];
|
||||
b += seed[i + 1];
|
||||
c += seed[i + 2];
|
||||
d += seed[i + 3];
|
||||
e += seed[i + 4];
|
||||
f += seed[i + 5];
|
||||
g += seed[i + 6];
|
||||
h += seed[i + 7];
|
||||
|
||||
mix (a, b, c, d, e, f, g, h);
|
||||
|
||||
s->mm[i] = a;
|
||||
s->mm[i + 1] = b;
|
||||
s->mm[i + 2] = c;
|
||||
s->mm[i + 3] = d;
|
||||
s->mm[i + 4] = e;
|
||||
s->mm[i + 5] = f;
|
||||
s->mm[i + 6] = g;
|
||||
s->mm[i + 7] = h;
|
||||
}
|
||||
|
||||
s->iv[0] = a;
|
||||
s->iv[1] = b;
|
||||
s->iv[2] = c;
|
||||
s->iv[3] = d;
|
||||
s->iv[4] = e;
|
||||
s->iv[5] = f;
|
||||
s->iv[6] = g;
|
||||
s->iv[7] = h;
|
||||
}
|
||||
#define ISAAC_MIX(s, a, b, c, d, e, f, g, h, seed) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < ISAAC_WORDS; i += 8) \
|
||||
{ \
|
||||
a += seed[i]; \
|
||||
b += seed[i + 1]; \
|
||||
c += seed[i + 2]; \
|
||||
d += seed[i + 3]; \
|
||||
e += seed[i + 4]; \
|
||||
f += seed[i + 5]; \
|
||||
g += seed[i + 6]; \
|
||||
h += seed[i + 7]; \
|
||||
mix (a, b, c, d, e, f, g, h); \
|
||||
s->m[i] = a; \
|
||||
s->m[i + 1] = b; \
|
||||
s->m[i + 2] = c; \
|
||||
s->m[i + 3] = d; \
|
||||
s->m[i + 4] = e; \
|
||||
s->m[i + 5] = f; \
|
||||
s->m[i + 6] = g; \
|
||||
s->m[i + 7] = h; \
|
||||
} \
|
||||
}
|
||||
|
||||
#if 0 /* Provided for reference only; not used in this code */
|
||||
/*
|
||||
* Initialize the ISAAC RNG with the given seed material.
|
||||
* Its size MUST be a multiple of ISAAC_BYTES, and may be
|
||||
* stored in the s->mm array.
|
||||
* stored in the s->m array.
|
||||
*
|
||||
* This is a generalization of the original ISAAC initialization code
|
||||
* to support larger seed sizes. For seed sizes of 0 and ISAAC_BYTES,
|
||||
* it is identical.
|
||||
*/
|
||||
static void
|
||||
isaac_init (struct isaac_state *s, uint32_t const *seed, size_t seedsize)
|
||||
isaac_init (struct isaac_state *s, isaac_word const *seed, size_t seedsize)
|
||||
{
|
||||
static uint32_t const iv[8] =
|
||||
{
|
||||
0x1367df5a, 0x95d90059, 0xc3163e4b, 0x0f421ad8,
|
||||
0xd92a4a78, 0xa51a3c49, 0xc4efea1b, 0x30609119};
|
||||
int i;
|
||||
isaac_word a, b, c, d, e, f, g, h;
|
||||
|
||||
# if 0
|
||||
/* The initialization of iv is a precomputed form of: */
|
||||
for (i = 0; i < 7; i++)
|
||||
iv[i] = 0x9e3779b9; /* the golden ratio */
|
||||
for (i = 0; i < 4; ++i) /* scramble it */
|
||||
mix (iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
|
||||
# endif
|
||||
a = b = c = d = e = f = g = h = /* the golden ratio */
|
||||
IF32 (UINT32_C (0x9e3779b9), UINT64_C (0x9e3779b97f4a7c13));
|
||||
for (int i = 0; i < 4; i++) /* scramble it */
|
||||
mix (a, b, c, d, e, f, g, h);
|
||||
s->a = s->b = s->c = 0;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
s->iv[i] = iv[i];
|
||||
|
||||
if (seedsize)
|
||||
{
|
||||
/* First pass (as in reference ISAAC code) */
|
||||
isaac_mix (s, seed);
|
||||
ISAAC_MIX (s, a, b, c, d, e, f, g, h, seed);
|
||||
/* Second and subsequent passes (extension to ISAAC) */
|
||||
while (seedsize -= ISAAC_BYTES)
|
||||
{
|
||||
seed += ISAAC_WORDS;
|
||||
for (i = 0; i < ISAAC_WORDS; i++)
|
||||
s->mm[i] += seed[i];
|
||||
isaac_mix (s, s->mm);
|
||||
s->m[i] += seed[i];
|
||||
ISAAC_MIX (s, a, b, c, d, e, f, g, h, s->m);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The no seed case (as in reference ISAAC code) */
|
||||
for (i = 0; i < ISAAC_WORDS; i++)
|
||||
s->mm[i] = 0;
|
||||
s->m[i] = 0;
|
||||
}
|
||||
|
||||
/* Final pass */
|
||||
isaac_mix (s, s->mm);
|
||||
ISAAC_MIX (s, a, b, c, d, e, f, g, h, s->m);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize *S to a somewhat-random value. */
|
||||
static void
|
||||
isaac_seed_start (struct isaac_state *s)
|
||||
{
|
||||
static uint32_t const iv[8] =
|
||||
{
|
||||
0x1367df5a, 0x95d90059, 0xc3163e4b, 0x0f421ad8,
|
||||
0xd92a4a78, 0xa51a3c49, 0xc4efea1b, 0x30609119
|
||||
};
|
||||
|
||||
#if 0
|
||||
/* The initialization of iv is a precomputed form of: */
|
||||
int i;
|
||||
for (i = 0; i < 7; i++)
|
||||
iv[i] = 0x9e3779b9; /* the golden ratio */
|
||||
for (i = 0; i < 4; ++i) /* scramble it */
|
||||
mix (iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
|
||||
#endif
|
||||
|
||||
memset (s->mm, 0, sizeof s->mm);
|
||||
memcpy (s->iv, iv, sizeof s->iv);
|
||||
|
||||
/* s->c gets used for a data pointer during the seeding phase */
|
||||
s->a = s->b = s->c = 0;
|
||||
}
|
||||
|
||||
/* Add a buffer of seed material. */
|
||||
static void
|
||||
isaac_seed_data (struct isaac_state *s, void const *buffer, size_t size)
|
||||
{
|
||||
unsigned char const *buf = buffer;
|
||||
unsigned char *p;
|
||||
size_t avail;
|
||||
size_t i;
|
||||
|
||||
avail = sizeof s->mm - s->c; /* s->c is used as a write pointer */
|
||||
|
||||
/* Do any full buffers that are necessary */
|
||||
while (size > avail)
|
||||
{
|
||||
p = (unsigned char *) s->mm + s->c;
|
||||
for (i = 0; i < avail; i++)
|
||||
p[i] ^= buf[i];
|
||||
buf += avail;
|
||||
size -= avail;
|
||||
isaac_mix (s, s->mm);
|
||||
s->c = 0;
|
||||
avail = sizeof s->mm;
|
||||
}
|
||||
|
||||
/* And the final partial block */
|
||||
p = (unsigned char *) s->mm + s->c;
|
||||
for (i = 0; i < size; i++)
|
||||
p[i] ^= buf[i];
|
||||
s->c = size;
|
||||
}
|
||||
|
||||
|
||||
/* End of seeding phase; get everything ready to produce output. */
|
||||
static void
|
||||
isaac_seed_finish (struct isaac_state *s)
|
||||
{
|
||||
isaac_mix (s, s->mm);
|
||||
isaac_mix (s, s->mm);
|
||||
/* Now reinitialize c to start things off right */
|
||||
s->c = 0;
|
||||
}
|
||||
#define ISAAC_SEED(s,x) isaac_seed_data (s, &(x), sizeof (x))
|
||||
|
||||
/* Initialize *S to a somewhat-random value; this starts seeding,
|
||||
seeds with somewhat-random data, and finishes seeding. */
|
||||
/* Initialize *S to a somewhat-random value, derived from a seed
|
||||
stored in S->m. */
|
||||
void
|
||||
isaac_seed (struct isaac_state *s)
|
||||
{
|
||||
isaac_seed_start (s);
|
||||
isaac_word a = IF32 (UINT32_C (0x1367df5a), UINT64_C (0x647c4677a2884b7c));
|
||||
isaac_word b = IF32 (UINT32_C (0x95d90059), UINT64_C (0xb9f8b322c73ac862));
|
||||
isaac_word c = IF32 (UINT32_C (0xc3163e4b), UINT64_C (0x8c0ea5053d4712a0));
|
||||
isaac_word d = IF32 (UINT32_C (0x0f421ad8), UINT64_C (0xb29b2e824a595524));
|
||||
isaac_word e = IF32 (UINT32_C (0xd92a4a78), UINT64_C (0x82f053db8355e0ce));
|
||||
isaac_word f = IF32 (UINT32_C (0xa51a3c49), UINT64_C (0x48fe4a0fa5a09315));
|
||||
isaac_word g = IF32 (UINT32_C (0xc4efea1b), UINT64_C (0xae985bf2cbfc89ed));
|
||||
isaac_word h = IF32 (UINT32_C (0x30609119), UINT64_C (0x98f5704f6c44c0ab));
|
||||
|
||||
{ pid_t t = getpid (); ISAAC_SEED (s, t); }
|
||||
{ pid_t t = getppid (); ISAAC_SEED (s, t); }
|
||||
{ uid_t t = getuid (); ISAAC_SEED (s, t); }
|
||||
{ gid_t t = getgid (); ISAAC_SEED (s, t); }
|
||||
#if 0
|
||||
/* The initialization of a through h is a precomputed form of: */
|
||||
a = b = c = d = e = f = g = h = /* the golden ratio */
|
||||
IF32 (UINT32_C (0x9e3779b9), UINT64_C (0x9e3779b97f4a7c13));
|
||||
for (int i = 0; i < 4; i++) /* scramble it */
|
||||
mix (a, b, c, d, e, f, g, h);
|
||||
#endif
|
||||
|
||||
{
|
||||
xtime_t t = gethrxtime ();
|
||||
ISAAC_SEED (s, t);
|
||||
}
|
||||
/* Mix S->m so that every part of the seed affects every part of the
|
||||
state. */
|
||||
ISAAC_MIX (s, a, b, c, d, e, f, g, h, s->m);
|
||||
ISAAC_MIX (s, a, b, c, d, e, f, g, h, s->m);
|
||||
|
||||
isaac_seed_finish (s);
|
||||
s->a = s->b = s->c = 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Bob Jenkins's cryptographic random number generator, ISAAC.
|
||||
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
|
||||
|
||||
Copyright (C) 1999-2005, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2005, 2009-2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Colin Plumb.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -16,28 +16,50 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Written by Colin Plumb. */
|
||||
Written by Colin Plumb and Paul Eggert. */
|
||||
|
||||
#ifndef RAND_ISAAC_H
|
||||
# define RAND_ISAAC_H
|
||||
#ifndef _GL_RAND_ISAAC_H
|
||||
#define _GL_RAND_ISAAC_H
|
||||
|
||||
# include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* Size of the state tables to use. ISAAC_LOG should be at least 3,
|
||||
/* Log base 2 of the number of useful bits in an ISAAC word. It must
|
||||
be either 5 or 6. By default, this uses a value that should be
|
||||
faster for this architecture. */
|
||||
#ifndef ISAAC_BITS_LOG
|
||||
#if SIZE_MAX >> 31 >> 31 < 3 /* SIZE_MAX < 2**64 - 1 */
|
||||
#define ISAAC_BITS_LOG 5
|
||||
#else
|
||||
#define ISAAC_BITS_LOG 6
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* The number of bits in an ISAAC word. */
|
||||
#define ISAAC_BITS (1 << ISAAC_BITS_LOG)
|
||||
|
||||
#if ISAAC_BITS == 32
|
||||
typedef uint_least32_t isaac_word;
|
||||
#else
|
||||
typedef uint_least64_t isaac_word;
|
||||
#endif
|
||||
|
||||
/* Size of the state tables to use. ISAAC_WORDS_LOG should be at least 3,
|
||||
and smaller values give less security. */
|
||||
# define ISAAC_LOG 8
|
||||
# define ISAAC_WORDS (1 << ISAAC_LOG)
|
||||
# define ISAAC_BYTES (ISAAC_WORDS * sizeof (uint32_t))
|
||||
#define ISAAC_WORDS_LOG 8
|
||||
#define ISAAC_WORDS (1 << ISAAC_WORDS_LOG)
|
||||
#define ISAAC_BYTES (ISAAC_WORDS * sizeof (isaac_word))
|
||||
|
||||
/* RNG state variables. The members of this structure are private. */
|
||||
/* State variables for the random number generator. The M member
|
||||
should be seeded with nonce data before calling isaac_seed. The
|
||||
other members are private. */
|
||||
struct isaac_state
|
||||
{
|
||||
uint32_t mm[ISAAC_WORDS]; /* Main state array */
|
||||
uint32_t iv[8]; /* Seeding initial vector */
|
||||
uint32_t a, b, c; /* Extra index variables */
|
||||
isaac_word m[ISAAC_WORDS]; /* Main state array */
|
||||
isaac_word a, b, c; /* Extra variables */
|
||||
};
|
||||
|
||||
void isaac_seed (struct isaac_state *);
|
||||
void isaac_refill (struct isaac_state *, uint32_t[ISAAC_WORDS]);
|
||||
void isaac_refill (struct isaac_state *, isaac_word[ISAAC_WORDS]);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate random integers.
|
||||
|
||||
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -125,7 +125,7 @@ randint_genmax (struct randint_source *s, randint genmax)
|
||||
randint randmax = s->randmax;
|
||||
randint choices = genmax + 1;
|
||||
|
||||
for (;;)
|
||||
while (1)
|
||||
{
|
||||
if (randmax < genmax)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate random integers.
|
||||
|
||||
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate random permutations.
|
||||
|
||||
Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2007, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate buffers of random data.
|
||||
|
||||
Copyright (C) 2006, 2008-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -24,12 +24,15 @@
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <exitfail.h>
|
||||
#include <fcntl.h>
|
||||
#include <quotearg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
@@ -60,6 +63,10 @@
|
||||
# define ALIGNED_POINTER(ptr, type) ((size_t) (ptr) % alignof (type) == 0)
|
||||
#endif
|
||||
|
||||
#ifndef NAME_OF_NONCE_DEVICE
|
||||
#define NAME_OF_NONCE_DEVICE "/dev/urandom"
|
||||
#endif
|
||||
|
||||
/* The maximum buffer size used for reads of random data. Using the
|
||||
value 2 * ISAAC_BYTES makes this the largest power of two that
|
||||
would not otherwise cause struct randread_source to grow. */
|
||||
@@ -100,7 +107,7 @@ struct randread_source
|
||||
/* Up to a buffer's worth of pseudorandom data. */
|
||||
union
|
||||
{
|
||||
uint32_t w[ISAAC_WORDS];
|
||||
isaac_word w[ISAAC_WORDS];
|
||||
unsigned char b[ISAAC_BYTES];
|
||||
} data;
|
||||
} isaac;
|
||||
@@ -133,6 +140,52 @@ simple_new (FILE *source, void const *handler_arg)
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Put a nonce value into BUFFER, with size BUFSIZE, but do not get
|
||||
more than BYTES_BOUND bytes' worth of random information from any
|
||||
nonce device. */
|
||||
|
||||
static void
|
||||
get_nonce (void *buffer, size_t bufsize, size_t bytes_bound)
|
||||
{
|
||||
char *buf = buffer;
|
||||
ssize_t seeded = 0;
|
||||
|
||||
/* Get some data from FD if available. */
|
||||
int fd = open (NAME_OF_NONCE_DEVICE, O_RDONLY | O_BINARY);
|
||||
if (0 <= fd)
|
||||
{
|
||||
seeded = read (fd, buf, MIN (bufsize, bytes_bound));
|
||||
if (seeded < 0)
|
||||
seeded = 0;
|
||||
close (fd);
|
||||
}
|
||||
|
||||
/* If there's no nonce device, use a poor approximation
|
||||
by getting the time of day, etc. */
|
||||
# define ISAAC_SEED(type, initialize_v) \
|
||||
if (seeded < bufsize) \
|
||||
{ \
|
||||
type v; \
|
||||
size_t nbytes = MIN (sizeof v, bufsize - seeded); \
|
||||
initialize_v; \
|
||||
memcpy (buf + seeded, &v, nbytes); \
|
||||
seeded += nbytes; \
|
||||
}
|
||||
ISAAC_SEED (struct timeval, gettimeofday (&v, NULL));
|
||||
ISAAC_SEED (pid_t, v = getpid ());
|
||||
ISAAC_SEED (pid_t, v = getppid ());
|
||||
ISAAC_SEED (uid_t, v = getuid ());
|
||||
ISAAC_SEED (uid_t, v = getgid ());
|
||||
|
||||
#ifdef lint
|
||||
/* Normally we like having the extra randomness from uninitialized
|
||||
parts of BUFFER. However, omit this randomness if we want to
|
||||
avoid false-positives from memory-checking debugging tools. */
|
||||
memset (buf + seeded, 0, bufsize - seeded);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Create and initialize a random data source from NAME, or use a
|
||||
reasonable default source if NAME is null. BYTES_BOUND is an upper
|
||||
bound on the number of bytes that will be needed. If zero, it is a
|
||||
@@ -165,6 +218,8 @@ randread_new (char const *name, size_t bytes_bound)
|
||||
else
|
||||
{
|
||||
s->buf.isaac.buffered = 0;
|
||||
get_nonce (s->buf.isaac.state.m, sizeof s->buf.isaac.state.m,
|
||||
bytes_bound);
|
||||
isaac_seed (&s->buf.isaac.state);
|
||||
}
|
||||
|
||||
@@ -199,7 +254,7 @@ randread_set_handler_arg (struct randread_source *s, void const *handler_arg)
|
||||
static void
|
||||
readsource (struct randread_source *s, unsigned char *p, size_t size)
|
||||
{
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
size_t inbytes = fread (p, sizeof *p, size, s->source);
|
||||
int fread_errno = errno;
|
||||
@@ -221,7 +276,7 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
|
||||
{
|
||||
size_t inbytes = isaac->buffered;
|
||||
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
if (size <= inbytes)
|
||||
{
|
||||
@@ -236,9 +291,9 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
|
||||
|
||||
/* If P is aligned, write to *P directly to avoid the overhead
|
||||
of copying from the buffer. */
|
||||
if (ALIGNED_POINTER (p, uint32_t))
|
||||
if (ALIGNED_POINTER (p, isaac_word))
|
||||
{
|
||||
uint32_t *wp = (uint32_t *) p;
|
||||
isaac_word *wp = (isaac_word *) p;
|
||||
while (ISAAC_BYTES <= size)
|
||||
{
|
||||
isaac_refill (&isaac->state, wp);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate buffers of random data.
|
||||
|
||||
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
diff --git c/lib/regcomp.c i/lib/regcomp.c
|
||||
index 6472ff6..665b2ab 100644
|
||||
--- c/lib/regcomp.c
|
||||
+++ i/lib/regcomp.c
|
||||
@@ -18,6 +18,8 @@
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
+#include "intprops.h"
|
||||
+#include "verify.h"
|
||||
static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
|
||||
size_t length, reg_syntax_t syntax);
|
||||
static void re_compile_fastmap_iter (regex_t *bufp,
|
||||
@@ -541,7 +543,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
|
||||
diff --git a/lib/regcomp.c b/lib/regcomp.c
|
||||
index d5968bd..4926676 100644
|
||||
--- a/lib/regcomp.c
|
||||
+++ b/lib/regcomp.c
|
||||
@@ -541,7 +541,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
|
||||
size_t errbuf_size;
|
||||
#else /* size_t might promote */
|
||||
size_t
|
||||
@@ -20,7 +11,7 @@ index 6472ff6..665b2ab 100644
|
||||
char *_Restrict_ errbuf, size_t errbuf_size)
|
||||
#endif
|
||||
{
|
||||
@@ -1375,7 +1377,7 @@ calc_first (void *extra, bin_tree_t *node)
|
||||
@@ -1383,7 +1383,7 @@ calc_first (void *extra, bin_tree_t *node)
|
||||
|
||||
/* Pass 2: compute NEXT on the tree. Preorder visit. */
|
||||
static reg_errcode_t
|
||||
@@ -29,17 +20,7 @@ index 6472ff6..665b2ab 100644
|
||||
{
|
||||
switch (node->token.type)
|
||||
{
|
||||
@@ -2571,7 +2573,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
|
||||
/* This loop is actually executed only when end != REG_MISSING,
|
||||
to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?... We have
|
||||
already created the start+1-th copy. */
|
||||
- if ((Idx) -1 < 0 || end != REG_MISSING)
|
||||
+ verify (! TYPE_SIGNED (Idx));
|
||||
+ if (end != REG_MISSING)
|
||||
for (i = start + 2; i <= end; ++i)
|
||||
{
|
||||
elem = duplicate_tree (elem, dfa);
|
||||
@@ -2731,7 +2734,8 @@ static reg_errcode_t
|
||||
@@ -2744,7 +2744,8 @@ static reg_errcode_t
|
||||
internal_function
|
||||
build_collating_symbol (bitset_t sbcset,
|
||||
# ifdef RE_ENABLE_I18N
|
||||
@@ -49,7 +30,7 @@ index 6472ff6..665b2ab 100644
|
||||
# endif
|
||||
const unsigned char *name)
|
||||
{
|
||||
@@ -3309,7 +3313,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
|
||||
@@ -3323,7 +3324,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
|
||||
|
||||
static reg_errcode_t
|
||||
parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
|
||||
@@ -59,7 +40,7 @@ index 6472ff6..665b2ab 100644
|
||||
reg_syntax_t syntax, bool accept_hyphen)
|
||||
{
|
||||
#ifdef RE_ENABLE_I18N
|
||||
@@ -3396,8 +3401,9 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
|
||||
@@ -3410,8 +3412,9 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
|
||||
|
||||
static reg_errcode_t
|
||||
#ifdef RE_ENABLE_I18N
|
||||
@@ -71,7 +52,7 @@ index 6472ff6..665b2ab 100644
|
||||
#else /* not RE_ENABLE_I18N */
|
||||
build_equiv_class (bitset_t sbcset, const unsigned char *name)
|
||||
#endif /* not RE_ENABLE_I18N */
|
||||
@@ -3798,7 +3804,7 @@ free_token (re_token_t *node)
|
||||
@@ -3816,7 +3819,7 @@ free_token (re_token_t *node)
|
||||
and its children. */
|
||||
|
||||
static reg_errcode_t
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* root-dev-ino.c -- get the device and inode numbers for `/'.
|
||||
Copyright (C) 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2005-2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Root device and inode number checking.
|
||||
|
||||
Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -127,48 +127,48 @@ index 2da5afe..562955a 100644
|
||||
+ XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
|
||||
|
||||
switch (kind)
|
||||
{
|
||||
{
|
||||
@@ -276,7 +271,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
break;
|
||||
break;
|
||||
|
||||
case __GT_NOCREATE:
|
||||
- /* This case is backward from the other three. __gen_tempname
|
||||
+ /* This case is backward from the other three. This function
|
||||
succeeds if __xstat fails because the name does not exist.
|
||||
Note the continue to bypass the common logic at the bottom
|
||||
of the loop. */
|
||||
case __GT_NOCREATE:
|
||||
- /* This case is backward from the other three. __gen_tempname
|
||||
+ /* This case is backward from the other three. This function
|
||||
succeeds if __xstat fails because the name does not exist.
|
||||
Note the continue to bypass the common logic at the bottom
|
||||
of the loop. */
|
||||
@@ -285,11 +280,15 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
- return 0;
|
||||
+ fd = 0;
|
||||
+ goto done;
|
||||
}
|
||||
else
|
||||
- /* Give up now. */
|
||||
- return -1;
|
||||
+ {
|
||||
+ /* Give up now. */
|
||||
+ fd = -1;
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
continue;
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
- return 0;
|
||||
+ fd = 0;
|
||||
+ goto done;
|
||||
}
|
||||
else
|
||||
- /* Give up now. */
|
||||
- return -1;
|
||||
+ {
|
||||
+ /* Give up now. */
|
||||
+ fd = -1;
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
continue;
|
||||
|
||||
@@ -301,13 +300,32 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
||||
if (fd >= 0)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
- return fd;
|
||||
+ goto done;
|
||||
}
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
- return fd;
|
||||
+ goto done;
|
||||
}
|
||||
else if (errno != EEXIST)
|
||||
- return -1;
|
||||
+ {
|
||||
+ fd = -1;
|
||||
+ goto done;
|
||||
+ }
|
||||
- return -1;
|
||||
+ {
|
||||
+ fd = -1;
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
|
||||
+ randint_all_free (rand_src);
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/* a wrapper for frepoen
|
||||
Copyright (C) 2008-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
#include "xfreopen.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include "error.h"
|
||||
#include "exitfail.h"
|
||||
#include "quote.h"
|
||||
#include "stdio--.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
void
|
||||
xfreopen (char const *filename, char const *mode, FILE *fp)
|
||||
{
|
||||
if (!freopen (filename, mode, fp))
|
||||
{
|
||||
char const *f = (filename ? filename
|
||||
: (fp == stdin ? _("stdin")
|
||||
: (fp == stdout ? _("stdout")
|
||||
: (fp == stderr ? _("stderr")
|
||||
: _("unknown stream")))));
|
||||
error (exit_failure, errno, _("failed to reopen %s with mode %s"),
|
||||
quote_n (0, f), quote_n (1, mode));
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
#include <stdio.h>
|
||||
void xfreopen (char const *filename, char const *mode, FILE *fp);
|
||||
@@ -1,5 +1,5 @@
|
||||
#serial 3
|
||||
dnl Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
24
gl/modules/di-set
Normal file
24
gl/modules/di-set
Normal file
@@ -0,0 +1,24 @@
|
||||
Description:
|
||||
manipulate sets of device-inode pairs efficiently
|
||||
|
||||
Files:
|
||||
lib/di-set.c
|
||||
lib/di-set.h
|
||||
|
||||
Depends-on:
|
||||
ino-map
|
||||
hash
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += di-set.c di-set.h
|
||||
|
||||
Include:
|
||||
"di-set.h"
|
||||
|
||||
License
|
||||
GPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
10
gl/modules/di-set-tests
Normal file
10
gl/modules/di-set-tests
Normal file
@@ -0,0 +1,10 @@
|
||||
Files:
|
||||
tests/test-di-set.c
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
TESTS += test-di-set
|
||||
check_PROGRAMS += test-di-set
|
||||
24
gl/modules/fadvise
Normal file
24
gl/modules/fadvise
Normal file
@@ -0,0 +1,24 @@
|
||||
Description:
|
||||
Declare an access pattern hint for files.
|
||||
|
||||
Files:
|
||||
lib/fadvise.c
|
||||
lib/fadvise.h
|
||||
|
||||
Depends-on:
|
||||
ignore-value
|
||||
|
||||
configure.ac:
|
||||
AC_CHECK_FUNCS_ONCE([posix_fadvise])
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += fadvise.c fadvise.h
|
||||
|
||||
Include:
|
||||
"fadvise.h"
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
Pádraig Brady
|
||||
24
gl/modules/heap
Normal file
24
gl/modules/heap
Normal file
@@ -0,0 +1,24 @@
|
||||
Description:
|
||||
Binary heap with minimal number of methods. Used in sort.
|
||||
|
||||
Files:
|
||||
lib/heap.c
|
||||
lib/heap.h
|
||||
|
||||
Depends-on:
|
||||
stdlib-safer
|
||||
xalloc
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += heap.c heap.h
|
||||
|
||||
Include:
|
||||
"heap.h"
|
||||
|
||||
License
|
||||
GPL
|
||||
|
||||
Maintainer:
|
||||
Gene Auyeung
|
||||
24
gl/modules/ino-map
Normal file
24
gl/modules/ino-map
Normal file
@@ -0,0 +1,24 @@
|
||||
Description:
|
||||
maintain a mapping of ino_t numbers to small integers
|
||||
|
||||
Files:
|
||||
lib/ino-map.c
|
||||
lib/ino-map.h
|
||||
|
||||
Depends-on:
|
||||
hash
|
||||
verify
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += ino-map.c ino-map.h
|
||||
|
||||
Include:
|
||||
"ino-map.h"
|
||||
|
||||
License
|
||||
GPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
10
gl/modules/ino-map-tests
Normal file
10
gl/modules/ino-map-tests
Normal file
@@ -0,0 +1,10 @@
|
||||
Files:
|
||||
tests/test-ino-map.c
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
TESTS += test-ino-map
|
||||
check_PROGRAMS += test-ino-map
|
||||
9
gl/modules/link-tests.diff
Normal file
9
gl/modules/link-tests.diff
Normal file
@@ -0,0 +1,9 @@
|
||||
diff --git i/modules/link-tests w/modules/link-tests
|
||||
index d8e7b1a..aca0e74 100644
|
||||
--- i/modules/link-tests
|
||||
+++ w/modules/link-tests
|
||||
@@ -12,3 +12,4 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-link
|
||||
check_PROGRAMS += test-link
|
||||
+test_link_LDADD = $(LDADD) @LIBINTL@
|
||||
@@ -10,6 +10,7 @@ wchar
|
||||
wctype
|
||||
wcwidth
|
||||
mempcpy
|
||||
stdint
|
||||
|
||||
configure.ac:
|
||||
|
||||
|
||||
11
gl/modules/mbsalign-tests
Normal file
11
gl/modules/mbsalign-tests
Normal file
@@ -0,0 +1,11 @@
|
||||
Files:
|
||||
tests/test-mbsalign.c
|
||||
tests/macros.h
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
TESTS += test-mbsalign
|
||||
check_PROGRAMS += test-mbsalign
|
||||
@@ -10,8 +10,9 @@ lib/randread.h
|
||||
Depends-on:
|
||||
error
|
||||
exitfail
|
||||
inline
|
||||
fopen-safer
|
||||
gethrxtime
|
||||
gettimeofday
|
||||
quotearg
|
||||
stdbool
|
||||
stdint
|
||||
|
||||
10
gl/modules/randread-tests
Normal file
10
gl/modules/randread-tests
Normal file
@@ -0,0 +1,10 @@
|
||||
Files:
|
||||
tests/test-rand-isaac.c
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
TESTS += test-rand-isaac
|
||||
check_PROGRAMS += test-rand-isaac
|
||||
@@ -1,26 +0,0 @@
|
||||
Description:
|
||||
a wrapper for frepoen
|
||||
|
||||
Files:
|
||||
lib/xfreopen.c
|
||||
lib/xfreopen.h
|
||||
|
||||
Depends-on:
|
||||
error
|
||||
exitfail
|
||||
freopen-safer
|
||||
quote
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += xfreopen.c xfreopen.h
|
||||
|
||||
Include:
|
||||
"xfreopen.h"
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
63
gl/tests/test-di-set.c
Normal file
63
gl/tests/test-di-set.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/* Test the di-set module.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define ASSERT(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
|
||||
fflush (stderr); \
|
||||
abort (); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#include "di-set.h"
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
struct di_set *dis = di_set_alloc ();
|
||||
ASSERT (dis);
|
||||
|
||||
ASSERT (di_set_insert (dis, 2, 5) == 1); /* first insertion succeeds */
|
||||
ASSERT (di_set_insert (dis, 2, 5) == 0); /* duplicate fails */
|
||||
ASSERT (di_set_insert (dis, 3, 5) == 1); /* diff dev, duplicate inode is ok */
|
||||
ASSERT (di_set_insert (dis, 2, 8) == 1); /* same dev, different inode is ok */
|
||||
|
||||
/* very large (or negative) inode number */
|
||||
ASSERT (di_set_insert (dis, 5, (ino_t) -1) == 1);
|
||||
ASSERT (di_set_insert (dis, 5, (ino_t) -1) == 0); /* dup */
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < 3000; i++)
|
||||
ASSERT (di_set_insert (dis, 9, i) == 1);
|
||||
for (i = 0; i < 3000; i++)
|
||||
ASSERT (di_set_insert (dis, 9, i) == 0); /* duplicate fails */
|
||||
|
||||
di_set_free (dis);
|
||||
|
||||
return 0;
|
||||
}
|
||||
43
gl/tests/test-fadvise.c
Normal file
43
gl/tests/test-fadvise.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* Test that fadvise works as advertised.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Pádraig Brady. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "fadvise.h"
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
/* Valid. */
|
||||
fadvise (stdin, FADVISE_SEQUENTIAL);
|
||||
fdadvise (fileno (stdin), 0, 0, FADVISE_RANDOM);
|
||||
|
||||
/* Ignored. */
|
||||
fadvise (NULL, FADVISE_RANDOM);
|
||||
|
||||
/* Invalid. */
|
||||
fdadvise (42, 0, 0, FADVISE_RANDOM);
|
||||
/* Unfortunately C enums are not types.
|
||||
One could hack type safety by wrapping in a struct,
|
||||
but it's probably not worth the complexity in this case. */
|
||||
fadvise (stdin, FADVISE_SEQUENTIAL + FADVISE_RANDOM);
|
||||
fadvise (stdin, 4242);
|
||||
|
||||
return 0;
|
||||
}
|
||||
62
gl/tests/test-ino-map.c
Normal file
62
gl/tests/test-ino-map.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/* Test the ino-map module.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* FIXME: once/if in gnulib, use #include "macros.h" in place of this */
|
||||
#define ASSERT(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
|
||||
fflush (stderr); \
|
||||
abort (); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#include "ino-map.h"
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
enum { INO_MAP_INIT = 123 };
|
||||
struct ino_map *ino_map = ino_map_alloc (INO_MAP_INIT);
|
||||
ASSERT (ino_map != NULL);
|
||||
|
||||
ASSERT (ino_map_insert (ino_map, 42) == INO_MAP_INIT);
|
||||
ASSERT (ino_map_insert (ino_map, 42) == INO_MAP_INIT);
|
||||
ASSERT (ino_map_insert (ino_map, 398) == INO_MAP_INIT + 1);
|
||||
ASSERT (ino_map_insert (ino_map, 398) == INO_MAP_INIT + 1);
|
||||
ASSERT (ino_map_insert (ino_map, 0) == INO_MAP_INIT + 2);
|
||||
ASSERT (ino_map_insert (ino_map, 0) == INO_MAP_INIT + 2);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
ASSERT (ino_map_insert (ino_map, 10000 + i) == INO_MAP_INIT + 3 + i);
|
||||
}
|
||||
|
||||
ino_map_free (ino_map);
|
||||
|
||||
return 0;
|
||||
}
|
||||
100
gl/tests/test-mbsalign.c
Normal file
100
gl/tests/test-mbsalign.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/* Test that mbsalign works as advertised.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Pádraig Brady. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "mbsalign.h"
|
||||
#include "macros.h"
|
||||
#include <stdlib.h>
|
||||
#include <locale.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
char dest[4 * 16 + 1];
|
||||
size_t width, n;
|
||||
|
||||
/* Test unibyte truncation. */
|
||||
width = 4;
|
||||
n = mbsalign ("t\tés", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
|
||||
ASSERT (n == 4);
|
||||
|
||||
/* Test center alignment. */
|
||||
width = 4;
|
||||
n = mbsalign ("es", dest, sizeof dest, &width, MBS_ALIGN_CENTER, 0);
|
||||
ASSERT (*dest == ' ' && *(dest + n - 1) == ' ');
|
||||
|
||||
if (setlocale (LC_ALL, "en_US.UTF8"))
|
||||
{
|
||||
/* Check invalid input is flagged. */
|
||||
width = 4;
|
||||
n = mbsalign ("t\xe1\xe2s", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
|
||||
ASSERT (n == (size_t) -1);
|
||||
|
||||
/* Check invalid input is treated as unibyte */
|
||||
width = 4;
|
||||
n = mbsalign ("t\xe1\xe2s", dest, sizeof dest, &width,
|
||||
MBS_ALIGN_LEFT, MBA_UNIBYTE_FALLBACK);
|
||||
ASSERT (n == 4);
|
||||
|
||||
/* Test multibyte center alignment. */
|
||||
width = 4;
|
||||
n = mbsalign ("és", dest, sizeof dest, &width, MBS_ALIGN_CENTER, 0);
|
||||
ASSERT (*dest == ' ' && *(dest + n - 1) == ' ');
|
||||
|
||||
/* Test multibyte left alignment. */
|
||||
width = 4;
|
||||
n = mbsalign ("és", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
|
||||
ASSERT (*(dest + n - 1) == ' ' && *(dest + n - 2) == ' ');
|
||||
|
||||
/* Test multibyte right alignment. */
|
||||
width = 4;
|
||||
n = mbsalign ("és", dest, sizeof dest, &width, MBS_ALIGN_RIGHT, 0);
|
||||
ASSERT (*(dest) == ' ' && *(dest + 1) == ' ');
|
||||
|
||||
/* multibyte multicell truncation. */
|
||||
width = 4; /* cells */
|
||||
n = mbsalign ("日月火水", dest, sizeof dest, &width,
|
||||
MBS_ALIGN_LEFT, 0);
|
||||
ASSERT (n == 6); /* 2 characters */
|
||||
|
||||
/* multibyte unicell truncation. */
|
||||
width = 3; /* cells */
|
||||
n = mbsalign ("¹²³⁴", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
|
||||
ASSERT (n == 6); /* 3 characters */
|
||||
|
||||
/* Check independence from dest buffer. */
|
||||
width = 4; /* cells */
|
||||
n = mbsalign ("¹²³⁴", dest, 0, &width, MBS_ALIGN_LEFT, 0);
|
||||
ASSERT (n == 9); /* 4 characters */
|
||||
|
||||
/* Check that width is updated with cells required before padding. */
|
||||
width = 4; /* cells */
|
||||
n = mbsalign ("¹²³", dest, 0, &width, MBS_ALIGN_LEFT, 0);
|
||||
ASSERT (width == 3);
|
||||
|
||||
/* Test case where output is larger than input
|
||||
(as tab converted to multi byte replacement char). */
|
||||
width = 4;
|
||||
n = mbsalign ("t\tés" /* 6 including NUL */ , dest, sizeof dest,
|
||||
&width, MBS_ALIGN_LEFT, 0);
|
||||
ASSERT (n == 7);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
604
gl/tests/test-rand-isaac.c
Normal file
604
gl/tests/test-rand-isaac.c
Normal file
@@ -0,0 +1,604 @@
|
||||
/* Test the ISAAC or ISAAC64 pseudorandom number generator.
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "rand-isaac.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* FIXME: once/if in gnulib, use #include "macros.h" in place of this */
|
||||
#define ASSERT(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
|
||||
fflush (stderr); \
|
||||
abort (); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* This expected output was generated by running the programs in
|
||||
<http://burtleburtle.net/bob/rand/isaacafa.html>, as last modified
|
||||
on 2010-01-22. The 32-bit numbers were output by rand.c, and the
|
||||
64-bit by isaac64.c, both on x86, as those programs are not
|
||||
portable to 64-bit platforms. */
|
||||
|
||||
static isaac_word const expected[2][ISAAC_WORDS] =
|
||||
{
|
||||
#if ISAAC_BITS == 32
|
||||
{
|
||||
UINT32_C (0xf650e4c8), UINT32_C (0xe448e96d),
|
||||
UINT32_C (0x98db2fb4), UINT32_C (0xf5fad54f),
|
||||
UINT32_C (0x433f1afb), UINT32_C (0xedec154a),
|
||||
UINT32_C (0xd8370487), UINT32_C (0x46ca4f9a),
|
||||
UINT32_C (0x5de3743e), UINT32_C (0x88381097),
|
||||
UINT32_C (0xf1d444eb), UINT32_C (0x823cedb6),
|
||||
UINT32_C (0x6a83e1e0), UINT32_C (0x4a5f6355),
|
||||
UINT32_C (0xc7442433), UINT32_C (0x25890e2e),
|
||||
UINT32_C (0x7452e319), UINT32_C (0x57161df6),
|
||||
UINT32_C (0x38a824f3), UINT32_C (0x002ed713),
|
||||
UINT32_C (0x29f55449), UINT32_C (0x51c08d83),
|
||||
UINT32_C (0xd78cb99e), UINT32_C (0xa0cc74f3),
|
||||
UINT32_C (0x8f651659), UINT32_C (0xcbc8b7c2),
|
||||
UINT32_C (0xf5f71c69), UINT32_C (0x12ad6419),
|
||||
UINT32_C (0xe5792e1b), UINT32_C (0x860536b8),
|
||||
UINT32_C (0x09b3ce98), UINT32_C (0xd45d6d81),
|
||||
UINT32_C (0xf3b26129), UINT32_C (0x17e38f85),
|
||||
UINT32_C (0x29cf72ce), UINT32_C (0x349947b0),
|
||||
UINT32_C (0xc998f9ff), UINT32_C (0xb5e13dae),
|
||||
UINT32_C (0x32ae2a2b), UINT32_C (0xf7cf814c),
|
||||
UINT32_C (0x8ebfa303), UINT32_C (0xcf22e064),
|
||||
UINT32_C (0x0b923200), UINT32_C (0xeca4d58a),
|
||||
UINT32_C (0xef53cec4), UINT32_C (0xd0f7b37d),
|
||||
UINT32_C (0x9c411a2a), UINT32_C (0xffdf8a80),
|
||||
UINT32_C (0xb40e27bc), UINT32_C (0xb4d2f976),
|
||||
UINT32_C (0x44b89b08), UINT32_C (0xf37c71d5),
|
||||
UINT32_C (0x1a70e7e9), UINT32_C (0x0bdb9c30),
|
||||
UINT32_C (0x60dc5207), UINT32_C (0xb3c3f24b),
|
||||
UINT32_C (0xd7386806), UINT32_C (0x229749b5),
|
||||
UINT32_C (0x4e232cd0), UINT32_C (0x91dabc65),
|
||||
UINT32_C (0xa70e1101), UINT32_C (0x8b87437e),
|
||||
UINT32_C (0x5781414f), UINT32_C (0xcdbc62e2),
|
||||
UINT32_C (0x8107c9ff), UINT32_C (0x69d2e4ae),
|
||||
UINT32_C (0x3b18e752), UINT32_C (0xb143b688),
|
||||
UINT32_C (0x6f4e0772), UINT32_C (0x95138769),
|
||||
UINT32_C (0x943c3c74), UINT32_C (0xafc17a97),
|
||||
UINT32_C (0x0fd43963), UINT32_C (0x6a529b0b),
|
||||
UINT32_C (0xd8c58a6a), UINT32_C (0xa8bcc22d),
|
||||
UINT32_C (0x2db35dfe), UINT32_C (0xa7a2f402),
|
||||
UINT32_C (0x6cb167db), UINT32_C (0x538e1f4e),
|
||||
UINT32_C (0x7275e277), UINT32_C (0x1d3b8e97),
|
||||
UINT32_C (0xecc5dc91), UINT32_C (0x15e3a5b9),
|
||||
UINT32_C (0x03696614), UINT32_C (0x30ab93ec),
|
||||
UINT32_C (0xac9fe69d), UINT32_C (0x7bc76811),
|
||||
UINT32_C (0x60eda8da), UINT32_C (0x28833522),
|
||||
UINT32_C (0xd5295ebc), UINT32_C (0x5adb60e7),
|
||||
UINT32_C (0xf7e1cdd0), UINT32_C (0x97166d14),
|
||||
UINT32_C (0xb67ec13a), UINT32_C (0x210f3925),
|
||||
UINT32_C (0x64af0fef), UINT32_C (0x0d028684),
|
||||
UINT32_C (0x3aea3dec), UINT32_C (0xb058bafb),
|
||||
UINT32_C (0xb8b0ccfc), UINT32_C (0xf2b5cc05),
|
||||
UINT32_C (0xe3a662d9), UINT32_C (0x814bc24c),
|
||||
UINT32_C (0x2364a1aa), UINT32_C (0x37c0ed05),
|
||||
UINT32_C (0x2b36505c), UINT32_C (0x451e7ec8),
|
||||
UINT32_C (0x5d2a542f), UINT32_C (0xe43d0fbb),
|
||||
UINT32_C (0x91c8d925), UINT32_C (0x60d4d5f8),
|
||||
UINT32_C (0x12a0594b), UINT32_C (0x9e8a51da),
|
||||
UINT32_C (0xcd49ebdb), UINT32_C (0x1b0dcdc1),
|
||||
UINT32_C (0xcd57c7f7), UINT32_C (0xe6344451),
|
||||
UINT32_C (0x7ded386f), UINT32_C (0x2f36fa86),
|
||||
UINT32_C (0xa6d12101), UINT32_C (0x33bc405d),
|
||||
UINT32_C (0xb388d96c), UINT32_C (0xdb6dbe96),
|
||||
UINT32_C (0xfe29661c), UINT32_C (0x13edc0cb),
|
||||
UINT32_C (0xcb0eee4a), UINT32_C (0x70cc94ae),
|
||||
UINT32_C (0xde11ed34), UINT32_C (0x0606cf9f),
|
||||
UINT32_C (0x3a6ce389), UINT32_C (0x23d74f4e),
|
||||
UINT32_C (0xa37f63ff), UINT32_C (0x917bdec2),
|
||||
UINT32_C (0xd73f72d4), UINT32_C (0x0e7e0e67),
|
||||
UINT32_C (0x3d77d9a2), UINT32_C (0x13add922),
|
||||
UINT32_C (0x8891b3db), UINT32_C (0x01a9bd70),
|
||||
UINT32_C (0x56a001e3), UINT32_C (0xd51f093d),
|
||||
UINT32_C (0xcc033ce3), UINT32_C (0x5ad0d3b0),
|
||||
UINT32_C (0x34105a8c), UINT32_C (0x6a123f57),
|
||||
UINT32_C (0xbd2e5024), UINT32_C (0x7364944b),
|
||||
UINT32_C (0xe89b1a3b), UINT32_C (0x21835c4d),
|
||||
UINT32_C (0x9f39e2d9), UINT32_C (0xd405ded8),
|
||||
UINT32_C (0x294d37e5), UINT32_C (0xbccaaeed),
|
||||
UINT32_C (0x35a124b5), UINT32_C (0x6708a2bc),
|
||||
UINT32_C (0xb00960ba), UINT32_C (0x2a98121a),
|
||||
UINT32_C (0x4d8fae82), UINT32_C (0x0bb3263f),
|
||||
UINT32_C (0x12595a19), UINT32_C (0x6a107589),
|
||||
UINT32_C (0x0809e494), UINT32_C (0x21c171ec),
|
||||
UINT32_C (0x884d6825), UINT32_C (0x14c8009b),
|
||||
UINT32_C (0xb0b84e7b), UINT32_C (0x03fb88f4),
|
||||
UINT32_C (0x28e7cb78), UINT32_C (0x9388b13b),
|
||||
UINT32_C (0xdd2dc1d5), UINT32_C (0x848f520a),
|
||||
UINT32_C (0x07c28cd1), UINT32_C (0x68a39358),
|
||||
UINT32_C (0x72c9137d), UINT32_C (0x127dd430),
|
||||
UINT32_C (0xc613f157), UINT32_C (0x8c2f0d55),
|
||||
UINT32_C (0xf7d3f39f), UINT32_C (0x309bfb78),
|
||||
UINT32_C (0x8406b137), UINT32_C (0x46c0a6f5),
|
||||
UINT32_C (0x3718d597), UINT32_C (0x08607f04),
|
||||
UINT32_C (0x76904b6d), UINT32_C (0x04db4e13),
|
||||
UINT32_C (0xcd7411a7), UINT32_C (0xb510ce0e),
|
||||
UINT32_C (0xbfc7f7cc), UINT32_C (0xb83f957a),
|
||||
UINT32_C (0xfdfef62d), UINT32_C (0xc35e4580),
|
||||
UINT32_C (0x3ff1e524), UINT32_C (0x4112d96c),
|
||||
UINT32_C (0x02c9b944), UINT32_C (0xd5990dfb),
|
||||
UINT32_C (0xe7e26581), UINT32_C (0x0d9c7e7e),
|
||||
UINT32_C (0x826dfa89), UINT32_C (0x66f1e0ab),
|
||||
UINT32_C (0x30bcc764), UINT32_C (0xeadebeac),
|
||||
UINT32_C (0xed35e5ee), UINT32_C (0x0c571a7d),
|
||||
UINT32_C (0xe4f3a26a), UINT32_C (0xf7f58f7b),
|
||||
UINT32_C (0xadf6bc23), UINT32_C (0x5d023e65),
|
||||
UINT32_C (0x1ed3ff4e), UINT32_C (0xec46b0b6),
|
||||
UINT32_C (0xd2a93b51), UINT32_C (0xe75b41c9),
|
||||
UINT32_C (0x7e315aeb), UINT32_C (0x61119a5a),
|
||||
UINT32_C (0x53245b79), UINT32_C (0x33f6d7b1),
|
||||
UINT32_C (0xcae8deba), UINT32_C (0x50fc8194),
|
||||
UINT32_C (0xafa92a6d), UINT32_C (0xc87c8006),
|
||||
UINT32_C (0x4188bfcd), UINT32_C (0x8bace62e),
|
||||
UINT32_C (0x78ffa568), UINT32_C (0x5597ec0f),
|
||||
UINT32_C (0xb4415f7d), UINT32_C (0x08294766),
|
||||
UINT32_C (0xad567643), UINT32_C (0x09c36f90),
|
||||
UINT32_C (0x3dde9f39), UINT32_C (0x4a0a283c),
|
||||
UINT32_C (0x18080c8e), UINT32_C (0x080c79ec),
|
||||
UINT32_C (0x79ae4c10), UINT32_C (0xcb9e1563),
|
||||
UINT32_C (0x7cdd662f), UINT32_C (0x62d31911),
|
||||
UINT32_C (0xa4ca0cf1), UINT32_C (0x5cf824cd),
|
||||
UINT32_C (0x3b708f99), UINT32_C (0x1e16614c),
|
||||
UINT32_C (0xb6b9d766), UINT32_C (0x5de87abb),
|
||||
UINT32_C (0x7229ea81), UINT32_C (0xd5b2d750),
|
||||
UINT32_C (0x56e6cd21), UINT32_C (0xfe1e42d5),
|
||||
UINT32_C (0x96da2655), UINT32_C (0xc2b9aa36),
|
||||
UINT32_C (0xb8f6fd4a), UINT32_C (0x6a158d10),
|
||||
UINT32_C (0x01913fd3), UINT32_C (0xaf7d1fb8),
|
||||
UINT32_C (0x0b5e435f), UINT32_C (0x90c10757),
|
||||
UINT32_C (0x6554abda), UINT32_C (0x7a68710f)
|
||||
},
|
||||
{
|
||||
UINT32_C (0x82ac484f), UINT32_C (0xd7e1c7be),
|
||||
UINT32_C (0x95c85eaa), UINT32_C (0x94a302f4),
|
||||
UINT32_C (0x4d3cfbda), UINT32_C (0x786b2908),
|
||||
UINT32_C (0x1010b275), UINT32_C (0x82d53d12),
|
||||
UINT32_C (0x21e2a51c), UINT32_C (0x3d1e9150),
|
||||
UINT32_C (0xb059261d), UINT32_C (0xd0638e1a),
|
||||
UINT32_C (0x31860f05), UINT32_C (0x81f2864d),
|
||||
UINT32_C (0xff4cfc35), UINT32_C (0x0451516d),
|
||||
UINT32_C (0xbd086f26), UINT32_C (0xbc5654c1),
|
||||
UINT32_C (0x65dfa427), UINT32_C (0xa82427f5),
|
||||
UINT32_C (0x582e3014), UINT32_C (0xb8d2486d),
|
||||
UINT32_C (0xc79a1749), UINT32_C (0x9a1d7745),
|
||||
UINT32_C (0x8766bb54), UINT32_C (0x1e04a7f7),
|
||||
UINT32_C (0x3d3dff8a), UINT32_C (0xd5ec6bf4),
|
||||
UINT32_C (0xdbef7d9f), UINT32_C (0x36ec0ea3),
|
||||
UINT32_C (0x1feb2e4f), UINT32_C (0x15cfcc5c),
|
||||
UINT32_C (0xd8c423fb), UINT32_C (0xd0ef3cc9),
|
||||
UINT32_C (0xeb244925), UINT32_C (0xba5590c8),
|
||||
UINT32_C (0xa5f48ac4), UINT32_C (0x33c5321c),
|
||||
UINT32_C (0x613b67b2), UINT32_C (0x479c3a22),
|
||||
UINT32_C (0xe21339cc), UINT32_C (0x10d210aa),
|
||||
UINT32_C (0x931dd7e2), UINT32_C (0xef05ee06),
|
||||
UINT32_C (0xb82f2703), UINT32_C (0xa385cb2c),
|
||||
UINT32_C (0x5d67133c), UINT32_C (0x877eb7b4),
|
||||
UINT32_C (0x1e3437f7), UINT32_C (0x5afb43ae),
|
||||
UINT32_C (0x53c078f3), UINT32_C (0x94d90481),
|
||||
UINT32_C (0x1d964589), UINT32_C (0x08063a85),
|
||||
UINT32_C (0xe1322228), UINT32_C (0x1956b1e5),
|
||||
UINT32_C (0x31860f13), UINT32_C (0x2e7b022f),
|
||||
UINT32_C (0x21182ca3), UINT32_C (0x96f703ac),
|
||||
UINT32_C (0x46819e2e), UINT32_C (0x0d28fe52),
|
||||
UINT32_C (0x3724d4dc), UINT32_C (0xa0eabe6b),
|
||||
UINT32_C (0xc66699fd), UINT32_C (0xc6112fdd),
|
||||
UINT32_C (0x19c1e69c), UINT32_C (0x04d3658a),
|
||||
UINT32_C (0x4b55dd99), UINT32_C (0x31907d62),
|
||||
UINT32_C (0xf854b522), UINT32_C (0x4d678f26),
|
||||
UINT32_C (0x22ae0582), UINT32_C (0xeafed133),
|
||||
UINT32_C (0xe4a51d21), UINT32_C (0x84bd6dd6),
|
||||
UINT32_C (0xc1a51375), UINT32_C (0x3f28ee63),
|
||||
UINT32_C (0xfb737b1a), UINT32_C (0x70a1660e),
|
||||
UINT32_C (0x8a8dfaa3), UINT32_C (0x1be79937),
|
||||
UINT32_C (0xf7476978), UINT32_C (0x513c1764),
|
||||
UINT32_C (0x531ac6bf), UINT32_C (0x12c06908),
|
||||
UINT32_C (0x001cdb95), UINT32_C (0x1a4b6a53),
|
||||
UINT32_C (0xd067fce5), UINT32_C (0x12b2cfb6),
|
||||
UINT32_C (0x9ddb477f), UINT32_C (0x740e0066),
|
||||
UINT32_C (0x39ddf25a), UINT32_C (0xcc8bfa2d),
|
||||
UINT32_C (0xf1b20eaf), UINT32_C (0x64f2632c),
|
||||
UINT32_C (0x9783cdee), UINT32_C (0x63bfd4d8),
|
||||
UINT32_C (0x0084cfe5), UINT32_C (0x75f4e9e2),
|
||||
UINT32_C (0x19b48fd0), UINT32_C (0x6c48ddd8),
|
||||
UINT32_C (0x7a36af93), UINT32_C (0x71865c4c),
|
||||
UINT32_C (0x9ce0199d), UINT32_C (0x867027d7),
|
||||
UINT32_C (0x2cb7b77f), UINT32_C (0x84ef01da),
|
||||
UINT32_C (0x72f5972f), UINT32_C (0x040f7074),
|
||||
UINT32_C (0xdf9afa29), UINT32_C (0xc921f94e),
|
||||
UINT32_C (0x75c08a36), UINT32_C (0x18c1ef9a),
|
||||
UINT32_C (0xd649a428), UINT32_C (0xc5b71937),
|
||||
UINT32_C (0x8a30738a), UINT32_C (0xd97cd348),
|
||||
UINT32_C (0x858129a6), UINT32_C (0x239e3b0a),
|
||||
UINT32_C (0xbbb8abc4), UINT32_C (0x80fac4c2),
|
||||
UINT32_C (0xecfcf20b), UINT32_C (0xd9d711f9),
|
||||
UINT32_C (0xe2a4ef71), UINT32_C (0xb5fe87c0),
|
||||
UINT32_C (0xbe8b06b2), UINT32_C (0xaafef5a7),
|
||||
UINT32_C (0x9c15db3b), UINT32_C (0x0aeb8165),
|
||||
UINT32_C (0x4389a84a), UINT32_C (0x253b1d7a),
|
||||
UINT32_C (0x19047c79), UINT32_C (0x7cdc78a2),
|
||||
UINT32_C (0xd20adf03), UINT32_C (0x56f55a71),
|
||||
UINT32_C (0x3e730fa8), UINT32_C (0xfd8650d8),
|
||||
UINT32_C (0x959e234e), UINT32_C (0xb7546681),
|
||||
UINT32_C (0xdad1b22a), UINT32_C (0x142a6e85),
|
||||
UINT32_C (0x8ef4bce6), UINT32_C (0x68235b9d),
|
||||
UINT32_C (0x85a13f85), UINT32_C (0x74096ae7),
|
||||
UINT32_C (0xa949bea2), UINT32_C (0x29322d0d),
|
||||
UINT32_C (0xd5683858), UINT32_C (0x82846526),
|
||||
UINT32_C (0x403dae08), UINT32_C (0x6dd1943a),
|
||||
UINT32_C (0xe1279bff), UINT32_C (0x9e7e4f04),
|
||||
UINT32_C (0x1c3a4524), UINT32_C (0x484525e4),
|
||||
UINT32_C (0x81d4cc5f), UINT32_C (0xe24124c0),
|
||||
UINT32_C (0x037464c0), UINT32_C (0xbf1bd691),
|
||||
UINT32_C (0x26ceb003), UINT32_C (0x275ead3a),
|
||||
UINT32_C (0xc5bde908), UINT32_C (0x26414ff3),
|
||||
UINT32_C (0xa30519ad), UINT32_C (0xd7b43abe),
|
||||
UINT32_C (0x2ce5d3d5), UINT32_C (0x88412761),
|
||||
UINT32_C (0x97ca2070), UINT32_C (0xe5fbb9c7),
|
||||
UINT32_C (0x276df0b4), UINT32_C (0x308f751f),
|
||||
UINT32_C (0x37a97df6), UINT32_C (0xc9cd808c),
|
||||
UINT32_C (0xfe4cb380), UINT32_C (0x3d469303),
|
||||
UINT32_C (0xaee19096), UINT32_C (0xc0d5d42a),
|
||||
UINT32_C (0x4e823ad3), UINT32_C (0xf5f9cc3b),
|
||||
UINT32_C (0x4286619c), UINT32_C (0x9ca45e1c),
|
||||
UINT32_C (0x66c97340), UINT32_C (0x891aec49),
|
||||
UINT32_C (0x45bae606), UINT32_C (0xc798f047),
|
||||
UINT32_C (0x52649d6c), UINT32_C (0xce86fdfc),
|
||||
UINT32_C (0x80c6e402), UINT32_C (0xd6ec2f2b),
|
||||
UINT32_C (0x27c82282), UINT32_C (0x1fe26ce0),
|
||||
UINT32_C (0x92f57ea7), UINT32_C (0xde462f4d),
|
||||
UINT32_C (0x07497cae), UINT32_C (0x5a48755c),
|
||||
UINT32_C (0x721502dd), UINT32_C (0x6cbe7935),
|
||||
UINT32_C (0x836d8003), UINT32_C (0x9ead7f70),
|
||||
UINT32_C (0x9ab3a42f), UINT32_C (0x4c8652d6),
|
||||
UINT32_C (0x32e39273), UINT32_C (0xe8fa3860),
|
||||
UINT32_C (0x1da4f25a), UINT32_C (0x0cd6ef81),
|
||||
UINT32_C (0x02503f7d), UINT32_C (0x8854a0a1),
|
||||
UINT32_C (0x9a30c4e8), UINT32_C (0x88157153),
|
||||
UINT32_C (0x05efe294), UINT32_C (0x57c4c925),
|
||||
UINT32_C (0x2887d96f), UINT32_C (0xc1a71e3c),
|
||||
UINT32_C (0xe9f84163), UINT32_C (0x2d0985de),
|
||||
UINT32_C (0xd21e796c), UINT32_C (0x6fb5ce56),
|
||||
UINT32_C (0x02614abf), UINT32_C (0xc3c7be2c),
|
||||
UINT32_C (0xb54fed6f), UINT32_C (0xa617a083),
|
||||
UINT32_C (0xc3142d8f), UINT32_C (0x6079e4ce),
|
||||
UINT32_C (0xceffc147), UINT32_C (0x1d0cb81b),
|
||||
UINT32_C (0xdc153e5f), UINT32_C (0xe36ef5bb),
|
||||
UINT32_C (0xd531161a), UINT32_C (0x165b1015),
|
||||
UINT32_C (0x7aa114ed), UINT32_C (0x3f7579b3),
|
||||
UINT32_C (0xf7f395f1), UINT32_C (0xbc6172c7),
|
||||
UINT32_C (0xa86f875e), UINT32_C (0x0e6c51b3),
|
||||
UINT32_C (0xcdfec2af), UINT32_C (0x73c0e762),
|
||||
UINT32_C (0x824c2009), UINT32_C (0xc5a87748),
|
||||
UINT32_C (0x94d40125), UINT32_C (0x8aba3ffb),
|
||||
UINT32_C (0xd32be060), UINT32_C (0x8c17eff0),
|
||||
UINT32_C (0x21e2547e), UINT32_C (0x07cffad9),
|
||||
UINT32_C (0x05340e15), UINT32_C (0xf3310c92),
|
||||
UINT32_C (0x9d8d1908), UINT32_C (0x86ba527f),
|
||||
UINT32_C (0xf943f672), UINT32_C (0xef73fbf0),
|
||||
UINT32_C (0x46d95ca5), UINT32_C (0xc54cd95b),
|
||||
UINT32_C (0x9d855e89), UINT32_C (0x4bb5af29)
|
||||
}
|
||||
#else
|
||||
{
|
||||
UINT64_C (0x12a8f216af9418c2), UINT64_C (0xd4490ad526f14431),
|
||||
UINT64_C (0xb49c3b3995091a36), UINT64_C (0x5b45e522e4b1b4ef),
|
||||
UINT64_C (0xa1e9300cd8520548), UINT64_C (0x49787fef17af9924),
|
||||
UINT64_C (0x03219a39ee587a30), UINT64_C (0xebe9ea2adf4321c7),
|
||||
UINT64_C (0x804456af10f5fb53), UINT64_C (0xd74bbe77e6116ac7),
|
||||
UINT64_C (0x7c0828dd624ec390), UINT64_C (0x14a195640116f336),
|
||||
UINT64_C (0x2eab8ca63ce802d7), UINT64_C (0xc6e57a78fbd986e0),
|
||||
UINT64_C (0x58efc10b06a2068d), UINT64_C (0xabeeddb2dde06ff1),
|
||||
UINT64_C (0x0b090a7560a968e3), UINT64_C (0x2cf9c8ca052f6e9f),
|
||||
UINT64_C (0x116d0016cb948f09), UINT64_C (0xa59e0bd101731a28),
|
||||
UINT64_C (0x63767572ae3d6174), UINT64_C (0xab4f6451cc1d45ec),
|
||||
UINT64_C (0xc2a1e7b5b459aeb5), UINT64_C (0x2472f6207c2d0484),
|
||||
UINT64_C (0xe699ed85b0dfb40d), UINT64_C (0xd4347f66ec8941c3),
|
||||
UINT64_C (0xf4d14597e660f855), UINT64_C (0x8b889d624d44885d),
|
||||
UINT64_C (0x258e5a80c7204c4b), UINT64_C (0xaf0c317d32adaa8a),
|
||||
UINT64_C (0x9c4cd6257c5a3603), UINT64_C (0xeb3593803173e0ce),
|
||||
UINT64_C (0x36f60e2ba4fa6800), UINT64_C (0x38b6525c21a42b0e),
|
||||
UINT64_C (0xf4f5d05c10cab243), UINT64_C (0xcf3f4688801eb9aa),
|
||||
UINT64_C (0x1ddc0325259b27de), UINT64_C (0xb9571fa04dc089c8),
|
||||
UINT64_C (0xd7504dfa8816edbb), UINT64_C (0x1fe2cca76517db90),
|
||||
UINT64_C (0x261e4e4c0a333a9d), UINT64_C (0x219b97e26ffc81bd),
|
||||
UINT64_C (0x66b4835d9eafea22), UINT64_C (0x4cc317fb9cddd023),
|
||||
UINT64_C (0x50b704cab602c329), UINT64_C (0xedb454e7badc0805),
|
||||
UINT64_C (0x9e17e49642a3e4c1), UINT64_C (0x66c1a2a1a60cd889),
|
||||
UINT64_C (0x7983eed3740847d5), UINT64_C (0x298af231c85bafab),
|
||||
UINT64_C (0x2680b122baa28d97), UINT64_C (0x734de8181f6ec39a),
|
||||
UINT64_C (0x53898e4c3910da55), UINT64_C (0x1761f93a44d5aefe),
|
||||
UINT64_C (0xe4dbf0634473f5d2), UINT64_C (0x4ed0fe7e9dc91335),
|
||||
UINT64_C (0xd18d8549d140caea), UINT64_C (0x1cfc8bed0d681639),
|
||||
UINT64_C (0xca1e3785a9e724e5), UINT64_C (0xb67c1fa481680af8),
|
||||
UINT64_C (0xdfea21ea9e7557e3), UINT64_C (0xd6b6d0ecc617c699),
|
||||
UINT64_C (0xfa7e393983325753), UINT64_C (0xa09e8c8c35ab96de),
|
||||
UINT64_C (0x8fe88b57305e2ab6), UINT64_C (0x89039d79d6fc5c5c),
|
||||
UINT64_C (0x9bfb227ebdf4c5ce), UINT64_C (0x7f7cc39420a3a545),
|
||||
UINT64_C (0x3f6c6af859d80055), UINT64_C (0xc8763c5b08d1908c),
|
||||
UINT64_C (0x469356c504ec9f9d), UINT64_C (0x26e6db8ffdf5adfe),
|
||||
UINT64_C (0x3a938fee32d29981), UINT64_C (0x2c5e9deb57ef4743),
|
||||
UINT64_C (0x1e99b96e70a9be8b), UINT64_C (0x764dbeae7fa4f3a6),
|
||||
UINT64_C (0xaac40a2703d9bea0), UINT64_C (0x1a8c1e992b941148),
|
||||
UINT64_C (0x73aa8a564fb7ac9e), UINT64_C (0x604d51b25fbf70e2),
|
||||
UINT64_C (0xdd69a0d8ab3b546d), UINT64_C (0x65ca5b96b7552210),
|
||||
UINT64_C (0x2fd7e4b9e72cd38c), UINT64_C (0x51d2b1ab2ddfb636),
|
||||
UINT64_C (0x9d1d84fcce371425), UINT64_C (0xa44cfe79ae538bbe),
|
||||
UINT64_C (0xde68a2355b93cae6), UINT64_C (0x9fc10d0f989993e0),
|
||||
UINT64_C (0x94ebc8abcfb56dae), UINT64_C (0xd7a023a73260b45c),
|
||||
UINT64_C (0x72c8834a5957b511), UINT64_C (0x8f8419a348f296bf),
|
||||
UINT64_C (0x1e152328f3318dea), UINT64_C (0x4838d65f6ef6748f),
|
||||
UINT64_C (0xd6bf7baee43cac40), UINT64_C (0x13328503df48229f),
|
||||
UINT64_C (0x7440fb816508c4fe), UINT64_C (0x9d266d6a1cc0542c),
|
||||
UINT64_C (0x4dda48153c94938a), UINT64_C (0x74c04bf1790c0efe),
|
||||
UINT64_C (0xe1925c71285279f5), UINT64_C (0x8a8e849eb32781a5),
|
||||
UINT64_C (0x073973751f12dd5e), UINT64_C (0xa319ce15b0b4db31),
|
||||
UINT64_C (0x6dd856d94d259236), UINT64_C (0x67378d8eccef96cb),
|
||||
UINT64_C (0x9fc477de4ed681da), UINT64_C (0xf3b8b6675a6507ff),
|
||||
UINT64_C (0xc3a9dc228caac9e9), UINT64_C (0xc37b45b3f8d6f2ba),
|
||||
UINT64_C (0xb559eb1d04e5e932), UINT64_C (0x1b0cab936e65c744),
|
||||
UINT64_C (0xaf08da9177dda93d), UINT64_C (0xac12fb171817eee7),
|
||||
UINT64_C (0x1fff7ac80904bf45), UINT64_C (0xa9119b60369ffebd),
|
||||
UINT64_C (0xbfced1b0048eac50), UINT64_C (0xb67b7896167b4c84),
|
||||
UINT64_C (0x9b3cdb65f82ca382), UINT64_C (0xdbc27ab5447822bf),
|
||||
UINT64_C (0x10dcd78e3851a492), UINT64_C (0xb438c2b67f98e5e9),
|
||||
UINT64_C (0x43954b3252dc25e5), UINT64_C (0xab9090168dd05f34),
|
||||
UINT64_C (0xce68341f79893389), UINT64_C (0x36833336d068f707),
|
||||
UINT64_C (0xdcdd7d20903d0c25), UINT64_C (0xda3a361b1c5157b1),
|
||||
UINT64_C (0x7f9d1a2e1ebe1327), UINT64_C (0x5d0a12f27ad310d1),
|
||||
UINT64_C (0x3bc36e078f7515d7), UINT64_C (0x4da8979a0041e8a9),
|
||||
UINT64_C (0x950113646d1d6e03), UINT64_C (0x7b4a38e32537df62),
|
||||
UINT64_C (0x8a1b083821f40cb4), UINT64_C (0x3d5774a11d31ab39),
|
||||
UINT64_C (0x7a76956c3eafb413), UINT64_C (0x7f5126dbba5e0ca7),
|
||||
UINT64_C (0x12153635b2c0cf57), UINT64_C (0x7b3f0195fc6f290f),
|
||||
UINT64_C (0x5544f7d774b14aef), UINT64_C (0x56c074a581ea17fe),
|
||||
UINT64_C (0xe7f28ecd2d49eecd), UINT64_C (0xe479ee5b9930578c),
|
||||
UINT64_C (0x9ff38fed72e9052f), UINT64_C (0x9f65789a6509a440),
|
||||
UINT64_C (0x0981dcd296a8736d), UINT64_C (0x5873888850659ae7),
|
||||
UINT64_C (0xc678b6d860284a1c), UINT64_C (0x63e22c147b9c3403),
|
||||
UINT64_C (0x92fae24291f2b3f1), UINT64_C (0x829626e3892d95d7),
|
||||
UINT64_C (0xcffe1939438e9b24), UINT64_C (0x79999cdff70902cb),
|
||||
UINT64_C (0x8547eddfb81ccb94), UINT64_C (0x7b77497b32503b12),
|
||||
UINT64_C (0x97fcaacbf030bc24), UINT64_C (0x6ced1983376fa72b),
|
||||
UINT64_C (0x7e75d99d94a70f4d), UINT64_C (0xd2733c4335c6a72f),
|
||||
UINT64_C (0xdbc0d2b6ab90a559), UINT64_C (0x94628d38d0c20584),
|
||||
UINT64_C (0x64972d68dee33360), UINT64_C (0xb9c11d5b1e43a07e),
|
||||
UINT64_C (0x2de0966daf2f8b1c), UINT64_C (0x2e18bc1ad9704a68),
|
||||
UINT64_C (0xd4dba84729af48ad), UINT64_C (0xb7a0b174cff6f36e),
|
||||
UINT64_C (0xe94c39a54a98307f), UINT64_C (0xaa70b5b4f89695a2),
|
||||
UINT64_C (0x3bdbb92c43b17f26), UINT64_C (0xcccb7005c6b9c28d),
|
||||
UINT64_C (0x18a6a990c8b35ebd), UINT64_C (0xfc7c95d827357afa),
|
||||
UINT64_C (0x1fca8a92fd719f85), UINT64_C (0x1dd01aafcd53486a),
|
||||
UINT64_C (0x49353fea39ba63b1), UINT64_C (0xf85b2b4fbcde44b7),
|
||||
UINT64_C (0xbe7444e39328a0ac), UINT64_C (0x3e2b8bcbf016d66d),
|
||||
UINT64_C (0x964e915cd5e2b207), UINT64_C (0x1725cabfcb045b00),
|
||||
UINT64_C (0x7fbf21ec8a1f45ec), UINT64_C (0x11317ba87905e790),
|
||||
UINT64_C (0x2fe4b17170e59750), UINT64_C (0xe8d9ecbe2cf3d73f),
|
||||
UINT64_C (0xb57d2e985e1419c7), UINT64_C (0x0572b974f03ce0bb),
|
||||
UINT64_C (0xa8d7e4dab780a08d), UINT64_C (0x4715ed43e8a45c0a),
|
||||
UINT64_C (0xc330de426430f69d), UINT64_C (0x23b70edb1955c4bf),
|
||||
UINT64_C (0x098954d51fff6580), UINT64_C (0x8107fccf064fcf56),
|
||||
UINT64_C (0x852f54934da55cc9), UINT64_C (0x09c7e552bc76492f),
|
||||
UINT64_C (0xe9f6760e32cd8021), UINT64_C (0xa3bc941d0a5061cb),
|
||||
UINT64_C (0xba89142e007503b8), UINT64_C (0xdc842b7e2819e230),
|
||||
UINT64_C (0xbbe83f4ecc2bdecb), UINT64_C (0xcd454f8f19c5126a),
|
||||
UINT64_C (0xc62c58f97dd949bf), UINT64_C (0x693501d628297551),
|
||||
UINT64_C (0xb9ab4ce57f2d34f3), UINT64_C (0x9255abb50d532280),
|
||||
UINT64_C (0xebfafa33d7254b59), UINT64_C (0xe9f6082b05542e4e),
|
||||
UINT64_C (0x35dd37d5871448af), UINT64_C (0xb03031a8b4516e84),
|
||||
UINT64_C (0xb3f256d8aca0b0b9), UINT64_C (0x0fd22063edc29fca),
|
||||
UINT64_C (0xd9a11fbb3d9808e4), UINT64_C (0x3a9bf55ba91f81ca),
|
||||
UINT64_C (0xc8c93882f9475f5f), UINT64_C (0x947ae053ee56e63c),
|
||||
UINT64_C (0xc7d9f16864a76e94), UINT64_C (0x7bd94e1d8e17debc),
|
||||
UINT64_C (0xd873db391292ed4f), UINT64_C (0x30f5611484119414),
|
||||
UINT64_C (0x565c31f7de89ea27), UINT64_C (0xd0e4366228b03343),
|
||||
UINT64_C (0x325928ee6e6f8794), UINT64_C (0x6f423357e7c6a9f9),
|
||||
UINT64_C (0x99170a5dc3115544), UINT64_C (0x59b97885e2f2ea28),
|
||||
UINT64_C (0xbc4097b116c524d2), UINT64_C (0x7a13f18bbedc4ff5),
|
||||
UINT64_C (0x071582401c38434d), UINT64_C (0xb422061193d6f6a7),
|
||||
UINT64_C (0xb4b81b3fa97511e2), UINT64_C (0x65d34954daf3cebd),
|
||||
UINT64_C (0xb344c470397bba52), UINT64_C (0xbac7a9a18531294b),
|
||||
UINT64_C (0xecb53939887e8175), UINT64_C (0x565601c0364e3228),
|
||||
UINT64_C (0xef1955914b609f93), UINT64_C (0x16f50edf91e513af),
|
||||
UINT64_C (0x56963b0dca418fc0), UINT64_C (0xd60f6dcedc314222),
|
||||
UINT64_C (0x364f6ffa464ee52e), UINT64_C (0x6c3b8e3e336139d3),
|
||||
UINT64_C (0xf943aee7febf21b8), UINT64_C (0x088e049589c432e0),
|
||||
UINT64_C (0xd49503536abca345), UINT64_C (0x3a6c27934e31188a),
|
||||
UINT64_C (0x957baf61700cff4e), UINT64_C (0x37624ae5a48fa6e9),
|
||||
UINT64_C (0x501f65edb3034d07), UINT64_C (0x907f30421d78c5de),
|
||||
UINT64_C (0x1a804aadb9cfa741), UINT64_C (0x0ce2a38c344a6eed),
|
||||
UINT64_C (0xd363eff5f0977996), UINT64_C (0x2cd16e2abd791e33),
|
||||
UINT64_C (0x58627e1a149bba21), UINT64_C (0x7f9b6af1ebf78baf)
|
||||
},
|
||||
{
|
||||
UINT64_C (0xd20d8c88c8ffe65f), UINT64_C (0x917f1dd5f8886c61),
|
||||
UINT64_C (0x56986e2ef3ed091b), UINT64_C (0x5fa7867caf35e149),
|
||||
UINT64_C (0x81a1549fd6573da5), UINT64_C (0x96fbf83a12884624),
|
||||
UINT64_C (0xe728e8c83c334074), UINT64_C (0xf1bcc3d275afe51a),
|
||||
UINT64_C (0x71f1ce2490d20b07), UINT64_C (0xe6c42178c4bbb92e),
|
||||
UINT64_C (0x0a9c32d5eae45305), UINT64_C (0x0c335248857fa9e7),
|
||||
UINT64_C (0x142de49fff7a7c3d), UINT64_C (0x64a53dc924fe7ac9),
|
||||
UINT64_C (0x9f6a419d382595f4), UINT64_C (0x150f361dab9dec26),
|
||||
UINT64_C (0xc61bb3a141e50e8c), UINT64_C (0x2785338347f2ba08),
|
||||
UINT64_C (0x7ca9723fbb2e8988), UINT64_C (0xce2f8642ca0712dc),
|
||||
UINT64_C (0x59300222b4561e00), UINT64_C (0xc2b5a03f71471a6f),
|
||||
UINT64_C (0xd5f9e858292504d5), UINT64_C (0x65fa4f227a2b6d79),
|
||||
UINT64_C (0x93cbe0b699c2585d), UINT64_C (0x1d95b0a5fcf90bc6),
|
||||
UINT64_C (0x17efee45b0dee640), UINT64_C (0x9e4c1269baa4bf37),
|
||||
UINT64_C (0xd79476a84ee20d06), UINT64_C (0x0a56a5f0bfe39272),
|
||||
UINT64_C (0x7eba726d8c94094b), UINT64_C (0x5e5637885f29bc2b),
|
||||
UINT64_C (0xd586bd01c5c217f6), UINT64_C (0x233003b5a6cfe6ad),
|
||||
UINT64_C (0x24c0e332b70019b0), UINT64_C (0x9da058c67844f20c),
|
||||
UINT64_C (0xe4d9429322cd065a), UINT64_C (0x1fab64ea29a2ddf7),
|
||||
UINT64_C (0x8af38731c02ba980), UINT64_C (0x7dc7785b8efdfc80),
|
||||
UINT64_C (0x486289ddcc3d6780), UINT64_C (0x222bbfae61725606),
|
||||
UINT64_C (0x2bc60a63a6f3b3f2), UINT64_C (0x177e00f9fc32f791),
|
||||
UINT64_C (0x522e23f3925e319e), UINT64_C (0x9c2ed44081ce5fbd),
|
||||
UINT64_C (0x964781ce734b3c84), UINT64_C (0xf05d129681949a4c),
|
||||
UINT64_C (0x046e3ecaaf453ce9), UINT64_C (0x962aceefa82e1c84),
|
||||
UINT64_C (0xf5b4b0b0d2deeeb4), UINT64_C (0x1af3dbe25d8f45da),
|
||||
UINT64_C (0xf9f4892ed96bd438), UINT64_C (0xc4c118bfe78feaae),
|
||||
UINT64_C (0x07a69afdcc42261a), UINT64_C (0xf8549e1a3aa5e00d),
|
||||
UINT64_C (0x2102ae466ebb1148), UINT64_C (0xe87fbb46217a360e),
|
||||
UINT64_C (0x310cb380db6f7503), UINT64_C (0xb5fdfc5d3132c498),
|
||||
UINT64_C (0xdaf8e9829fe96b5f), UINT64_C (0xcac09afbddd2cdb4),
|
||||
UINT64_C (0xb862225b055b6960), UINT64_C (0x55b6344cf97aafae),
|
||||
UINT64_C (0xff577222c14f0a3a), UINT64_C (0x4e4b705b92903ba4),
|
||||
UINT64_C (0x730499af921549ff), UINT64_C (0x13ae978d09fe5557),
|
||||
UINT64_C (0xd9e92aa246bf719e), UINT64_C (0x7a4c10ec2158c4a6),
|
||||
UINT64_C (0x49cad48cebf4a71e), UINT64_C (0xcf05daf5ac8d77b0),
|
||||
UINT64_C (0xabbdcdd7ed5c0860), UINT64_C (0x9853eab63b5e0b35),
|
||||
UINT64_C (0x352787baa0d7c22f), UINT64_C (0xc7f6aa2de59aea61),
|
||||
UINT64_C (0x03727073c2e134b1), UINT64_C (0x5a0f544dd2b1fb18),
|
||||
UINT64_C (0x74f85198b05a2e7d), UINT64_C (0x963ef2c96b33be31),
|
||||
UINT64_C (0x4659d2b743848a2c), UINT64_C (0x19ebb029435dcb0f),
|
||||
UINT64_C (0x4e9d2827355fc492), UINT64_C (0xccec0a73b49c9921),
|
||||
UINT64_C (0x46c9feb55d120902), UINT64_C (0x8d2636b81555a786),
|
||||
UINT64_C (0x30c05b1ba332f41c), UINT64_C (0xf6f7fd1431714200),
|
||||
UINT64_C (0x1a4ff12616eefc89), UINT64_C (0x990a98fd5071d263),
|
||||
UINT64_C (0x84547ddc3e203c94), UINT64_C (0x07a3aec79624c7da),
|
||||
UINT64_C (0x8a328a1cedfe552c), UINT64_C (0xd1e649de1e7f268b),
|
||||
UINT64_C (0x2d8d5432157064c8), UINT64_C (0x4ae7d6a36eb5dbcb),
|
||||
UINT64_C (0x57e3306d881edb4f), UINT64_C (0x0a804d18b7097475),
|
||||
UINT64_C (0xe74733427b72f0c1), UINT64_C (0x24b33c9d7ed25117),
|
||||
UINT64_C (0xe805a1e290cf2456), UINT64_C (0x3b544ebe544c19f9),
|
||||
UINT64_C (0x3e666e6f69ae2c15), UINT64_C (0xfb152fe3ff26da89),
|
||||
UINT64_C (0xb49b52e587a1ee60), UINT64_C (0xac042e70f8b383f2),
|
||||
UINT64_C (0x89c350c893ae7dc1), UINT64_C (0xb592bf39b0364963),
|
||||
UINT64_C (0x190e714fada5156e), UINT64_C (0xec8177f83f900978),
|
||||
UINT64_C (0x91b534f885818a06), UINT64_C (0x81536d601170fc20),
|
||||
UINT64_C (0xd4c718bc4ae8ae5f), UINT64_C (0x9eedeca8e272b933),
|
||||
UINT64_C (0x10e8b35af3eeab37), UINT64_C (0x0e09b88e1914f7af),
|
||||
UINT64_C (0x3fa9ddfb67e2f199), UINT64_C (0xb10bb459132d0a26),
|
||||
UINT64_C (0x2c046f22062dc67d), UINT64_C (0x5e90277e7cb39e2d),
|
||||
UINT64_C (0xd6b04d3b7651dd7e), UINT64_C (0xe34a1d250e7a8d6b),
|
||||
UINT64_C (0x53c065c6c8e63528), UINT64_C (0x1bdea12e35f6a8c9),
|
||||
UINT64_C (0x21874b8b4d2dbc4f), UINT64_C (0x3a88a0fbbcb05c63),
|
||||
UINT64_C (0x43ed7f5a0fae657d), UINT64_C (0x230e343dfba08d33),
|
||||
UINT64_C (0xb5b4071dbfc73a66), UINT64_C (0x8f9887e6078735a1),
|
||||
UINT64_C (0x08de8a1c7797da9b), UINT64_C (0xfcb6be43a9f2fe9b),
|
||||
UINT64_C (0x049a7f41061a9e60), UINT64_C (0x9f91508bffcfc14a),
|
||||
UINT64_C (0xe3273522064480ca), UINT64_C (0xcd04f3ff001a4778),
|
||||
UINT64_C (0x6bfa9aae5ec05779), UINT64_C (0x371f77e76bb8417e),
|
||||
UINT64_C (0x3550c2321fd6109c), UINT64_C (0xfb4a3d794a9a80d2),
|
||||
UINT64_C (0xf43c732873f24c13), UINT64_C (0xaa9119ff184cccf4),
|
||||
UINT64_C (0xb69e38a8965c6b65), UINT64_C (0x1f2b1d1f15f6dc9c),
|
||||
UINT64_C (0x67fef95d92607890), UINT64_C (0x31865ced6120f37d),
|
||||
UINT64_C (0x3a6853c7e70757a7), UINT64_C (0x32ab0edb696703d3),
|
||||
UINT64_C (0xee97f453f06791ed), UINT64_C (0x6dc93d9526a50e68),
|
||||
UINT64_C (0x78edefd694af1eed), UINT64_C (0x9c1169fa2777b874),
|
||||
UINT64_C (0x50065e535a213cf6), UINT64_C (0xde0c89a556b9ae70),
|
||||
UINT64_C (0xd1e0ccd25bb9c169), UINT64_C (0x6b17b224bad6bf27),
|
||||
UINT64_C (0x6b02e63195ad0cf8), UINT64_C (0x455a4b4cfe30e3f5),
|
||||
UINT64_C (0x9338e69c052b8e7b), UINT64_C (0x5092ef950a16da0b),
|
||||
UINT64_C (0x7c45d833aff07862), UINT64_C (0xa5b1cfdba0ab4067),
|
||||
UINT64_C (0x6ad047c430a12104), UINT64_C (0x6c47bec883a7de39),
|
||||
UINT64_C (0x944f6de09134dfb6), UINT64_C (0x9aeba33ac6ecc6b0),
|
||||
UINT64_C (0x52e762596bf68235), UINT64_C (0x22af003ab672e811),
|
||||
UINT64_C (0xb5635c95ff7296e2), UINT64_C (0xed2df21216235097),
|
||||
UINT64_C (0x4a29c6465a314cd1), UINT64_C (0xd83cc2687a19255f),
|
||||
UINT64_C (0x506c11b9d90e8b1d), UINT64_C (0x57277707199b8175),
|
||||
UINT64_C (0xcaf21ecd4377b28c), UINT64_C (0xc0c0f5a60ef4cdcf),
|
||||
UINT64_C (0x93b633abfa3469f8), UINT64_C (0xe846963877671a17),
|
||||
UINT64_C (0x59ac2c7873f910a3), UINT64_C (0x660d3257380841ee),
|
||||
UINT64_C (0xd813f2fab7f5c5ca), UINT64_C (0x4112cf68649a260e),
|
||||
UINT64_C (0x443f64ec5a371195), UINT64_C (0xb0774d261cc609db),
|
||||
UINT64_C (0x720bf5f26f4d2eaa), UINT64_C (0x1c2559e30f0946be),
|
||||
UINT64_C (0xe328e230e3e2b3fb), UINT64_C (0x087e79e5a57d1d13),
|
||||
UINT64_C (0x08dd9bdfd96b9f63), UINT64_C (0x64d0e29eea8838b3),
|
||||
UINT64_C (0xddf957bc36d8b9ca), UINT64_C (0x6ffe73e81b637fb3),
|
||||
UINT64_C (0x1a4e4822eb4d7a59), UINT64_C (0x5d94337fbfaf7f5b),
|
||||
UINT64_C (0xd30c088ba61ea5ef), UINT64_C (0x9d765e419fb69f6d),
|
||||
UINT64_C (0x9e21f4f903b33fd9), UINT64_C (0xb4d8f77bc3e56167),
|
||||
UINT64_C (0x733ea705fae4fa77), UINT64_C (0xa4ec0132764ca04b),
|
||||
UINT64_C (0x7976033a39f7d952), UINT64_C (0x106f72fe81e2c590),
|
||||
UINT64_C (0x8c90fd9b083f4558), UINT64_C (0xfd080d236da814ba),
|
||||
UINT64_C (0x7b64978555326f9f), UINT64_C (0x60e8ed72c0dff5d1),
|
||||
UINT64_C (0xb063e962e045f54d), UINT64_C (0x959f587d507a8359),
|
||||
UINT64_C (0x758f450c88572e0b), UINT64_C (0x1b6baca2ae4e125b),
|
||||
UINT64_C (0x61cf4f94c97df93d), UINT64_C (0x2738259634305c14),
|
||||
UINT64_C (0xd39bb9c3a48db6cf), UINT64_C (0x8215e577001332c8),
|
||||
UINT64_C (0xa1082c0466df6c0a), UINT64_C (0xef02cdd06ffdb432),
|
||||
UINT64_C (0xfc87614baf287e07), UINT64_C (0x240ab57a8b888b20),
|
||||
UINT64_C (0xbf8d5108e27e0d48), UINT64_C (0x61bdd1307c66e300),
|
||||
UINT64_C (0xb925a6cd0421aff3), UINT64_C (0x3e003e616a6591e9),
|
||||
UINT64_C (0x94c3251f06f90cf3), UINT64_C (0xbf84470805e69b5f),
|
||||
UINT64_C (0x98f076a4f7a2322e), UINT64_C (0x70cb6af7c2d5bcf0),
|
||||
UINT64_C (0xb64be8d8b25396c1), UINT64_C (0xa9aa4d20db084e9b),
|
||||
UINT64_C (0x2e6d02c36017f67f), UINT64_C (0xefed53d75fd64e6b),
|
||||
UINT64_C (0xd9f1f30ccd97fb09), UINT64_C (0xa2ebee47e2fbfce1),
|
||||
UINT64_C (0xb8d91274b9e9d4fb), UINT64_C (0x1db956e450275779),
|
||||
UINT64_C (0x4fc8e9560f91b123), UINT64_C (0x63573ff03e224774),
|
||||
UINT64_C (0x0647dfedcd894a29), UINT64_C (0x7884d9bc6cb569d8),
|
||||
UINT64_C (0x7fba195410e5ca30), UINT64_C (0x106c09b972d2e822),
|
||||
UINT64_C (0x241260ed4ad1e87d), UINT64_C (0x64c8e531bff53b55),
|
||||
UINT64_C (0xca672b91e9e4fa16), UINT64_C (0x3871700761b3f743),
|
||||
UINT64_C (0xf95cffa23af5f6f4), UINT64_C (0x8d14dedb30be846e),
|
||||
UINT64_C (0x3b097adaf088f94e), UINT64_C (0x21e0bd5026c619bf),
|
||||
UINT64_C (0x1bda0492e7e4586e), UINT64_C (0xd23c8e176d113600),
|
||||
UINT64_C (0x252f59cf0d9f04bb), UINT64_C (0xb3598080ce64a656),
|
||||
UINT64_C (0x993e1de72d36d310), UINT64_C (0xa2853b80f17f58ee),
|
||||
UINT64_C (0x1877b51e57a764d5), UINT64_C (0x001f837cc7350524)
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
unsigned int i;
|
||||
isaac_word r[ISAAC_WORDS];
|
||||
int iterations;
|
||||
|
||||
/* Seed with zeros, and discard the first buffer of output,
|
||||
as that's what the standard programs do. */
|
||||
static struct isaac_state s;
|
||||
isaac_seed (&s);
|
||||
isaac_refill (&s, r);
|
||||
|
||||
for (i = 0; i < sizeof expected / sizeof expected[0]; i++)
|
||||
{
|
||||
isaac_refill (&s, r);
|
||||
ASSERT (memcmp (r, expected[i], sizeof r) == 0);
|
||||
}
|
||||
|
||||
/* If invoked with a positive argument, run a benchmark;
|
||||
if with a negative, run a do-nothing benchmark. */
|
||||
for (iterations = argc <= 1 ? 0 : strtol (argv[1], NULL, 10);
|
||||
iterations != 0;
|
||||
iterations += (iterations < 0 ? 1 : -1))
|
||||
if (0 <= iterations)
|
||||
isaac_refill (&s, r);
|
||||
|
||||
return 0;
|
||||
}
|
||||
2
gnulib
2
gnulib
Submodule gnulib updated: 0883405cc7...78c0415acc
@@ -1,3 +1,17 @@
|
||||
include gnulib.mk
|
||||
|
||||
AM_CFLAGS = $(GNULIB_WARN_CFLAGS) # $(WERROR_CFLAGS)
|
||||
AM_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS) # $(WERROR_CFLAGS)
|
||||
|
||||
# A few tests are inherently warning-evoking.
|
||||
# Since we require -Werror, exempt the few offenders.
|
||||
|
||||
# test-xvasprintf.c: In function 'test_xasprintf':
|
||||
# test-xvasprintf.c:100: error: format not a string literal and no \
|
||||
# format arguments [-Wformat-security]
|
||||
test_xvasprintf_CFLAGS = $(AM_CFLAGS) -Wno-format-security
|
||||
|
||||
# test-lock.c: In function 'lock_mutator_thread':
|
||||
# test-lock.c:148: error: cast from function call of type 'pthread_t' to \
|
||||
# non-matching type 'void *' [-Wbad-function-cast]
|
||||
test_lock_CFLAGS = $(AM_CFLAGS) -Wno-bad-function-cast
|
||||
test_tls_CFLAGS = $(AM_CFLAGS) -Wno-bad-function-cast
|
||||
|
||||
@@ -8746,7 +8746,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2000-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2010 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Makefile for gnulib/lib -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 1995-2007, 2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995-2007, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@@ -20,8 +20,7 @@ include gnulib.mk
|
||||
AM_CFLAGS += $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||
|
||||
libcoreutils_a_SOURCES += \
|
||||
buffer-lcm.c buffer-lcm.h \
|
||||
xmemxfrm.c xmemxfrm.h
|
||||
buffer-lcm.c buffer-lcm.h
|
||||
|
||||
libcoreutils_a_LIBADD += $(LIBOBJS)
|
||||
libcoreutils_a_DEPENDENCIES += $(LIBOBJS)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* buffer-lcm.c - compute a good buffer size for dealing with two files
|
||||
|
||||
Copyright (C) 2002, 2005, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2005, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
This function is probably useful only for choosing whether to issue
|
||||
a prompt in an implementation of POSIX-specified rm.
|
||||
|
||||
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Invoke open, but return either a desired file descriptor or -1.
|
||||
|
||||
Copyright (C) 2005, 2006, 2008-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Invoke open, but return either a desired file descriptor or -1.
|
||||
|
||||
Copyright (C) 2005, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
105
lib/memxfrm.c
105
lib/memxfrm.c
@@ -1,105 +0,0 @@
|
||||
/* Locale-specific memory transformation
|
||||
|
||||
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert <eggert@cs.ucla.edu>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "memxfrm.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Store into DEST (of size DESTSIZE) the text in SRC (of size SRCSIZE)
|
||||
transformed so that the result of memcmp on two transformed texts
|
||||
(with ties going to the longer text) is the same as the result of
|
||||
memcoll on the two texts before their transformation. Perhaps
|
||||
temporarily modify the byte after SRC, but restore its original
|
||||
contents before returning.
|
||||
|
||||
Return the size of the resulting text, or an indeterminate value if
|
||||
there is an error. Set errno to an error number if there is an
|
||||
error, and to zero otherwise. DEST contains an indeterminate value
|
||||
if there is an error or if the resulting size is greater than
|
||||
DESTSIZE. */
|
||||
|
||||
size_t
|
||||
memxfrm (char *restrict dest, size_t destsize,
|
||||
char *restrict src, size_t srcsize)
|
||||
{
|
||||
#if HAVE_STRXFRM
|
||||
|
||||
size_t di = 0;
|
||||
size_t si = 0;
|
||||
size_t result = 0;
|
||||
|
||||
char ch = src[srcsize];
|
||||
src[srcsize] = '\0';
|
||||
|
||||
while (si < srcsize)
|
||||
{
|
||||
size_t slen = strlen (src + si);
|
||||
|
||||
size_t result0 = result;
|
||||
errno = 0;
|
||||
result += strxfrm (dest + di, src + si, destsize - di) + 1;
|
||||
if (errno != 0)
|
||||
break;
|
||||
if (result <= result0)
|
||||
{
|
||||
errno = ERANGE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (result == destsize + 1 && si + slen == srcsize)
|
||||
{
|
||||
/* The destination is exactly the right size, but strxfrm wants
|
||||
room for a trailing null. Work around the problem with a
|
||||
temporary buffer. */
|
||||
size_t bufsize = destsize - di + 1;
|
||||
char stackbuf[4000];
|
||||
char *buf = stackbuf;
|
||||
if (sizeof stackbuf < bufsize)
|
||||
{
|
||||
buf = malloc (bufsize);
|
||||
if (! buf)
|
||||
break;
|
||||
}
|
||||
strxfrm (buf, src + si, bufsize);
|
||||
memcpy (dest + di, buf, destsize - di);
|
||||
if (sizeof stackbuf < bufsize)
|
||||
free (buf);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
di = (result < destsize ? result : destsize);
|
||||
si += slen + 1;
|
||||
}
|
||||
|
||||
src[srcsize] = ch;
|
||||
return result - (si != srcsize);
|
||||
|
||||
#else
|
||||
|
||||
if (srcsize < destsize)
|
||||
memcpy (dest, src, srcsize);
|
||||
errno = 0;
|
||||
return srcsize;
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
#include <stddef.h>
|
||||
size_t memxfrm (char *restrict, size_t, char *restrict, size_t);
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Compare integer strings.
|
||||
|
||||
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Compare numeric strings. This is an internal include file.
|
||||
|
||||
Copyright (C) 1988, 1991, 1992, 1993, 1995, 1996, 1998, 1999, 2000,
|
||||
2003, 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988, 1991-1993, 1995-1996, 1998-2000, 2003-2006, 2009-2010
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Compare numeric strings.
|
||||
|
||||
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Exercise chdir-long's sample main program.
|
||||
|
||||
# Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
31
lib/xfts.c
31
lib/xfts.c
@@ -1,6 +1,6 @@
|
||||
/* xfts.c -- a wrapper for fts_open
|
||||
|
||||
Copyright (C) 2003, 2005-2007, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2005-2007, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -21,13 +21,9 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
#include "quote.h"
|
||||
#include "xalloc.h"
|
||||
#include "xfts.h"
|
||||
|
||||
@@ -40,23 +36,10 @@ xfts_open (char * const *argv, int options,
|
||||
FTS *fts = fts_open (argv, options | FTS_CWDFD, compar);
|
||||
if (fts == NULL)
|
||||
{
|
||||
/* This can fail in three ways: out of memory, invalid bit_flags,
|
||||
and one or more of the FILES is an empty string. We could try
|
||||
to decipher that errno==EINVAL means invalid bit_flags and
|
||||
errno==ENOENT means there's an empty string, but that seems wrong.
|
||||
Ideally, fts_open would return a proper error indicator. For now,
|
||||
we'll presume that the bit_flags are valid and just check for
|
||||
empty strings. */
|
||||
bool invalid_arg = false;
|
||||
for (; *argv; ++argv)
|
||||
{
|
||||
if (**argv == '\0')
|
||||
invalid_arg = true;
|
||||
}
|
||||
if (invalid_arg)
|
||||
error (EXIT_FAILURE, 0, _("invalid argument: %s"), quote (""));
|
||||
else
|
||||
xalloc_die ();
|
||||
/* This can fail in two ways: out of memory or with errno==EINVAL,
|
||||
which indicates it was called with invalid bit_flags. */
|
||||
assert (errno != EINVAL);
|
||||
xalloc_die ();
|
||||
}
|
||||
|
||||
return fts;
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/* Locale-specific memory transformation
|
||||
|
||||
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert <eggert@cs.ucla.edu>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "xmemxfrm.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
#include "error.h"
|
||||
#include "exitfail.h"
|
||||
#include "memxfrm.h"
|
||||
#include "quotearg.h"
|
||||
|
||||
/* Store into DEST (of size DESTSIZE) the text in SRC (of size
|
||||
SRCSIZE) transformed so that the result of memcmp on two
|
||||
transformed texts (with ties going to the longer text) is the same
|
||||
as the result of memcoll on the two texts before their
|
||||
transformation. Perhaps temporarily modify the byte after SRC, but
|
||||
restore its original contents before returning.
|
||||
|
||||
Return the size of the resulting text. DEST contains an
|
||||
indeterminate value if the resulting size is greater than DESTSIZE.
|
||||
Report an error and exit if there is an error. */
|
||||
|
||||
size_t
|
||||
xmemxfrm (char *restrict dest, size_t destsize,
|
||||
char *restrict src, size_t srcsize)
|
||||
{
|
||||
size_t translated_size = memxfrm (dest, destsize, src, srcsize);
|
||||
|
||||
if (errno)
|
||||
{
|
||||
error (0, errno, _("string transformation failed"));
|
||||
error (0, 0, _("set LC_ALL='C' to work around the problem"));
|
||||
error (exit_failure, 0,
|
||||
_("the untransformed string was %s"),
|
||||
quotearg_n_style_mem (0, locale_quoting_style, src, srcsize));
|
||||
}
|
||||
|
||||
return translated_size;
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
#include <stddef.h>
|
||||
size_t xmemxfrm (char *restrict, size_t, char *restrict, size_t);
|
||||
@@ -5004,8 +5004,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2006, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# boottime.m4 serial 4
|
||||
# Determine whether this system has infrastructure for obtaining the boot time.
|
||||
|
||||
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008-2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008-2010 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#serial 26
|
||||
# Check declarations for this package.
|
||||
|
||||
dnl Copyright (C) 1997-2001, 2003-2006, 2008-2009 Free Software
|
||||
dnl Foundation, Inc.
|
||||
dnl Copyright (C) 1997-2001, 2003-2006, 2008-2010 Free Software Foundation,
|
||||
dnl Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# serial 1
|
||||
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Invoke open, but return either a desired file descriptor or -1.
|
||||
|
||||
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Tests for GNU GMP (or any compatible replacement).
|
||||
|
||||
dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user