mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
271 Commits
FILEUTILS-
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e1b0b2ea2 | ||
|
|
a46e9f0919 | ||
|
|
22438d75ce | ||
|
|
9b18c35ac9 | ||
|
|
33f1edc571 | ||
|
|
e9e376d85f | ||
|
|
81f10fbd43 | ||
|
|
a44e5341bb | ||
|
|
08b1c573cd | ||
|
|
d858c3c433 | ||
|
|
39b53154ca | ||
|
|
214a8623eb | ||
|
|
e1356e7fe7 | ||
|
|
0760dc7412 | ||
|
|
f3a6e69b4e | ||
|
|
6d722e99e2 | ||
|
|
2cac22f76f | ||
|
|
983cd11143 | ||
|
|
aea44f3fa0 | ||
|
|
f8038b425a | ||
|
|
ff6e48f61e | ||
|
|
a5565c08a3 | ||
|
|
b510774dbb | ||
|
|
e10f361193 | ||
|
|
dfe9af3d61 | ||
|
|
49d7e8c71f | ||
|
|
eb53331d93 | ||
|
|
4d3c9a170d | ||
|
|
ee2d8446f4 | ||
|
|
1021e06a20 | ||
|
|
8dc1b2caf4 | ||
|
|
d19f921653 | ||
|
|
cf83af7c10 | ||
|
|
4bdc0991b0 | ||
|
|
fc1e3ad166 | ||
|
|
901ef41f7f | ||
|
|
50326157d9 | ||
|
|
9e9f0846f8 | ||
|
|
09917b2b9a | ||
|
|
02080dd37e | ||
|
|
039653dde5 | ||
|
|
144bbe26ac | ||
|
|
933e0997e2 | ||
|
|
8f90ed0f42 | ||
|
|
96380f703c | ||
|
|
40709c446a | ||
|
|
c8da0cbba6 | ||
|
|
575f5c2f24 | ||
|
|
662a4f705c | ||
|
|
ae53a3e4da | ||
|
|
a5385f0a5f | ||
|
|
b8e83dda2b | ||
|
|
577627b257 | ||
|
|
7e7943c979 | ||
|
|
1734d51c53 | ||
|
|
8686e2bf77 | ||
|
|
5a6effff70 | ||
|
|
a5810cd3de | ||
|
|
3a1f0aa8d5 | ||
|
|
462d532cd5 | ||
|
|
3adf8ab9c6 | ||
|
|
16b7a20d01 | ||
|
|
f32a1186bc | ||
|
|
2689e0a07c | ||
|
|
9d7b428daa | ||
|
|
f177ed1332 | ||
|
|
ad3a1fbb82 | ||
|
|
82cd6af9bc | ||
|
|
971d190dc4 | ||
|
|
05fc0219ad | ||
|
|
aeb6f5e5f3 | ||
|
|
f055dbe669 | ||
|
|
55408e0307 | ||
|
|
0dd327c851 | ||
|
|
1f60246c8b | ||
|
|
76be42eef0 | ||
|
|
018d1056e0 | ||
|
|
17b6fd61c3 | ||
|
|
03e6d30ae7 | ||
|
|
78abfe5da3 | ||
|
|
ffb5b5a2ad | ||
|
|
12eea70d7d | ||
|
|
9ffd4ae3df | ||
|
|
c487c2b929 | ||
|
|
fe62a85366 | ||
|
|
4b4c8534e6 | ||
|
|
e716f459a5 | ||
|
|
013d63bb67 | ||
|
|
f604c52243 | ||
|
|
e321b0bd06 | ||
|
|
007b5b4ba8 | ||
|
|
c58f8e0f80 | ||
|
|
328bfd1fb7 | ||
|
|
a3f0f65334 | ||
|
|
0a2ef3619c | ||
|
|
5854bc4e0c | ||
|
|
429ea1bad3 | ||
|
|
efde89cc27 | ||
|
|
d4d8f86b15 | ||
|
|
69254ed7d2 | ||
|
|
7b86692737 | ||
|
|
c82dbabbea | ||
|
|
3bd2a88618 | ||
|
|
4c5cf8b144 | ||
|
|
d1033dc2b9 | ||
|
|
a36e91c826 | ||
|
|
e9bcabbf05 | ||
|
|
20d893e3e2 | ||
|
|
3610481c97 | ||
|
|
b4c60a84e1 | ||
|
|
a67cbceb5a | ||
|
|
71a47cd7bb | ||
|
|
8f945ecf3a | ||
|
|
d7bb6bd985 | ||
|
|
37c05b6267 | ||
|
|
37bcdce62a | ||
|
|
52a97ad805 | ||
|
|
cc785dc620 | ||
|
|
0f44320b83 | ||
|
|
3032dfa4ef | ||
|
|
f199ae5181 | ||
|
|
c2c9db2056 | ||
|
|
13a9a251d8 | ||
|
|
f0da6c980d | ||
|
|
6673e992d4 | ||
|
|
141a1086a2 | ||
|
|
f74e9bb483 | ||
|
|
a2bbbeb38f | ||
|
|
f3e058b838 | ||
|
|
9ed4fe029a | ||
|
|
49ac3c60d0 | ||
|
|
d9ef180ae5 | ||
|
|
9d29159931 | ||
|
|
342d5997cc | ||
|
|
e63e45a195 | ||
|
|
6b4ccb9ba3 | ||
|
|
22e86fcb3c | ||
|
|
faf5915f7d | ||
|
|
d538aba94d | ||
|
|
26f187aa36 | ||
|
|
7e87cd0d6e | ||
|
|
a20eb902b8 | ||
|
|
da66e2e769 | ||
|
|
963388111d | ||
|
|
7499ea8154 | ||
|
|
79f359ff8a | ||
|
|
6a19cbc61b | ||
|
|
9e546891f1 | ||
|
|
171aba014f | ||
|
|
ed3d57b572 | ||
|
|
81e231a46d | ||
|
|
0622127ac6 | ||
|
|
a76f632427 | ||
|
|
bf660d1331 | ||
|
|
7bb9c7382f | ||
|
|
6e955cb84a | ||
|
|
f08ced6c34 | ||
|
|
c66278dffc | ||
|
|
ed2d4df754 | ||
|
|
1bc1a37f86 | ||
|
|
674233fb72 | ||
|
|
1f2219cabf | ||
|
|
f0d9306c78 | ||
|
|
28c6609c86 | ||
|
|
43c38af6a1 | ||
|
|
7cbb85937a | ||
|
|
8c61ed9ff1 | ||
|
|
6ba06cf611 | ||
|
|
957f363d1d | ||
|
|
38856139ea | ||
|
|
206ffe5898 | ||
|
|
34b462a936 | ||
|
|
82495b5d26 | ||
|
|
cf806f5d2d | ||
|
|
148e5d1b4d | ||
|
|
8a149d2242 | ||
|
|
b84871a279 | ||
|
|
807e464dec | ||
|
|
1f3a6e1eb8 | ||
|
|
a48426382d | ||
|
|
77ad7205cb | ||
|
|
c599760ff1 | ||
|
|
e563a1a5b5 | ||
|
|
4e329a1473 | ||
|
|
fd717e8d45 | ||
|
|
13e80acf07 | ||
|
|
51e2ffc524 | ||
|
|
379688e35d | ||
|
|
4d2231d02c | ||
|
|
c344de8d9b | ||
|
|
fb5e934c73 | ||
|
|
09ad98374b | ||
|
|
6864ceca11 | ||
|
|
ef43db1c4b | ||
|
|
b9dbd94712 | ||
|
|
9ff69c8035 | ||
|
|
c03498f2e7 | ||
|
|
e45c3dba07 | ||
|
|
bc6477ff72 | ||
|
|
e46f105350 | ||
|
|
6ab7032952 | ||
|
|
a5301cb3e2 | ||
|
|
9bab244d20 | ||
|
|
3b5b337246 | ||
|
|
3b60294bd9 | ||
|
|
7243403b27 | ||
|
|
d478d6efec | ||
|
|
dbfbb93424 | ||
|
|
29a4bf90d3 | ||
|
|
fe5cad6b29 | ||
|
|
39520407ef | ||
|
|
2e4b629e21 | ||
|
|
eaca68c289 | ||
|
|
7e02b6c989 | ||
|
|
32dfed954f | ||
|
|
55f43f7915 | ||
|
|
6cca23cec4 | ||
|
|
0be2660d96 | ||
|
|
a8bf544803 | ||
|
|
c841079462 | ||
|
|
ad06715030 | ||
|
|
66a4baa8a6 | ||
|
|
ae2b7961cf | ||
|
|
6f84766d19 | ||
|
|
fd00df9c4d | ||
|
|
d15557db96 | ||
|
|
b31c11e46b | ||
|
|
bdb5516fdd | ||
|
|
c8c93cfefa | ||
|
|
640221896f | ||
|
|
d73ea5f65a | ||
|
|
d72623052b | ||
|
|
a5b38192d0 | ||
|
|
5681a0705f | ||
|
|
04f6bb2648 | ||
|
|
ad09410b04 | ||
|
|
cc4722e802 | ||
|
|
f8e66794d9 | ||
|
|
e2b45cb9fe | ||
|
|
2170a48956 | ||
|
|
beebc69168 | ||
|
|
daf9d41918 | ||
|
|
105cbe3ea3 | ||
|
|
f14dbb1710 | ||
|
|
ec8df1d330 | ||
|
|
d7232f8ca7 | ||
|
|
c217428f39 | ||
|
|
41939d7bfe | ||
|
|
e7f9f83fa1 | ||
|
|
77eb8604f1 | ||
|
|
f8d8ad4e94 | ||
|
|
52e7fcc46c | ||
|
|
96cde75480 | ||
|
|
55b181511c | ||
|
|
6ce74d5d36 | ||
|
|
588d70c624 | ||
|
|
6a8e993550 | ||
|
|
087520e781 | ||
|
|
8879e63dee | ||
|
|
1a37445686 | ||
|
|
d6ce71fb68 | ||
|
|
65e65dbf30 | ||
|
|
ec00767a8e | ||
|
|
f443264116 | ||
|
|
6292a2bb96 | ||
|
|
2371d8faaf | ||
|
|
2dc45ff0c8 | ||
|
|
d2a170a785 | ||
|
|
2da0b15537 | ||
|
|
9191f089b9 | ||
|
|
5f201a38b6 |
@@ -11,10 +11,15 @@ maintainer-check:
|
||||
$(MAKE) distcheck
|
||||
$(MAKE) my-distcheck
|
||||
|
||||
prev-version := $(shell echo $(VERSION)|tr a-z Xa-y)
|
||||
prev_version_file = .prev-version
|
||||
|
||||
THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||
PREV_VERSION := $(shell cat $(prev_version_file))
|
||||
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
|
||||
|
||||
tag-package = $(shell echo "$(PACKAGE)" | tr a-z A-Z)
|
||||
tag-this-version = $(subst .,_,$(VERSION))
|
||||
tag-prev-version = $(subst .,_,$(prev-version))
|
||||
tag-prev-version = $(subst .,_,$(PREV_VERSION))
|
||||
this-cvs-tag = $(tag-package)-$(tag-this-version)
|
||||
prev-cvs-tag = $(tag-package)-$(tag-prev-version)
|
||||
|
||||
@@ -70,12 +75,6 @@ my-distcheck: writable-files po-check
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
|
||||
THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||
# FIXME: this works only for Gnits-style test releases.
|
||||
PREV_VERSION := $(shell echo $(VERSION)|tr b-z a-y|sed 's/a$$//')
|
||||
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
|
||||
v = Version
|
||||
|
||||
a_host = alpha.gnu.org
|
||||
b_host = freefriends.org
|
||||
|
||||
@@ -84,7 +83,7 @@ a_url_dir = $(alpha_subdir)
|
||||
b_url_dir = $(alpha_subdir)
|
||||
|
||||
a_real_dir = /fs/share/ftp/$(alpha_subdir)
|
||||
b_real_dir = /home/ftp/$(alpha_subdir)
|
||||
b_real_dir = fetish-ftp
|
||||
|
||||
url_dir_list = $(foreach x,a b,ftp://$($(x)_host)/$($(x)_url_dir))
|
||||
|
||||
@@ -129,7 +128,7 @@ announcement: NEWS ChangeLog $(distdir).tar.gz
|
||||
find . -name ChangeLog \
|
||||
| xargs cvs diff -up -r$(prev-cvs-tag) -rHEAD \
|
||||
| sed -n 's/^+//p' \
|
||||
| perl -ne 'm!^\+\+ (\./)?! or print,next;' \
|
||||
| perl -ne 'm!^\+\+ (\./)?! or print,next;' \
|
||||
-e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
|
||||
)
|
||||
|
||||
@@ -162,6 +161,8 @@ alpha: writable-files po-check
|
||||
&& xdelta delta -9 $(prev-tgz) $(distdir).tar.gz $(xd-delta) || :
|
||||
ln $(release-archive-dir)/$(xd-delta) .
|
||||
chmod a-w $(release-archive-dir)/$(xd-delta)
|
||||
echo $(VERSION) > $(prev_version_file)
|
||||
cvs ci -m. $(prev_version_file)
|
||||
@echo =====================================
|
||||
@echo =====================================
|
||||
@echo 'scp $(xd-delta) $(distdir).tar.gz \'
|
||||
|
||||
10
THANKS
10
THANKS
@@ -14,8 +14,10 @@ Alan Iwi iwi@atm.ox.ac.uk
|
||||
Alberto Accomazzi alberto@cfa0.harvard.edu
|
||||
aldomel aldomel@ix.netcom.com
|
||||
Alen Muzinic zveki@fly.cc.fer.hr
|
||||
Alexandre Duret-Lutz duret_g@epita.fr
|
||||
Alexey Solovyov alekso@math.uu.se
|
||||
Andre Novaes Cunha Andre.Cunha@br.global-one.net
|
||||
Andreas Gruenbacher ag@bestbits.at
|
||||
Andreas Jaeger jaeger@gnu.org
|
||||
Andreas Luik luik@isa.de
|
||||
Andreas Schwab schwab@suse.de
|
||||
@@ -52,7 +54,8 @@ Charles Randall crandall@matchlogic.com
|
||||
Chip Salzenberg chip@valinux.com
|
||||
Chris Yeo cyeo@biking.org
|
||||
Christi Alice Scarborough christi@chiark.greenend.org.uk
|
||||
Christian Krackowizer kra1@technodat.co.at
|
||||
Christian Krackowizer ckrackowiz@std.schuler-ag.com
|
||||
Christian Rose menthos@menthos.com
|
||||
Christian von Roques roques@pond.sub.org
|
||||
Chuck Hedrick hedrick@klinzhai.rutgers.edu
|
||||
Clark Morgan cmorgan@aracnet.com
|
||||
@@ -119,6 +122,8 @@ James Sneeringer jvs@ocslink.com
|
||||
James Tanis jtt@soscorp.com
|
||||
James Youngman james+usenet@free-lunch.demon.co.uk
|
||||
Jamie Lokier jamie@imbolc.ucc.ie
|
||||
Jan Fedak J.Fedak@sh.cvut.cz
|
||||
Jan Nieuwenhuizen janneke@gnu.org
|
||||
Janos Farkas chexum@shadow.banki.hu
|
||||
Jarkko Hietaniemi jhi@epsilon.hut.fi
|
||||
Jeff Moore jbm@mordor.com
|
||||
@@ -152,6 +157,7 @@ Kalle Olavi Niemitalo tosi@stekt.oulu.fi
|
||||
Kamal Paul Nigam Kamal_Paul_Nigam@gs35.sp.cs.cmu.edu
|
||||
Karl Eichwalder keichwa@gmx.net
|
||||
Karl Heuer kwzh@gnu.org
|
||||
Karl-Michael Schneider schneide@phil.uni-passau.de
|
||||
Karsten Thygesen karthy@kom.auc.dk
|
||||
Kaveh R. Ghazi ghazi@caip.rutgers.edu
|
||||
Keith Owens kaos@audio.apana.org.au
|
||||
@@ -163,6 +169,7 @@ Lars Hecking lhecking@nmrc.ucc.ie
|
||||
Lehti Rami rammer@cs.tut.fi
|
||||
Leonard N. Zubkoff lnz@dandelion.com
|
||||
Lorne Baker lbaker@nitro.avint.net
|
||||
M. P. Suzuki mpsuzuki@hiroshima-u.ac.jp
|
||||
Maciej Kwapulinski pikpok@univ.gda.pl
|
||||
Manas Garg manas@cygsoft.com
|
||||
Manfred Hollstein manfred@s-direktnet.de
|
||||
@@ -268,6 +275,7 @@ Torbjorn Lindgren tl@funcom.no
|
||||
Torsten Landschoff torsten@pclab.ifg.uni-kiel.de
|
||||
Ulrich Drepper drepper@gnu.org
|
||||
Urs Thuermann urs@isnogud.escape.de
|
||||
Vesselin Atanasov vesselin@bgnet.bg
|
||||
Vin Shelton acs@alumni.princeton.edu
|
||||
Volker Borchert bt@teknon.de
|
||||
Wayne Stewart wstewa@atl.com
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
186
doc/getdate.texi
186
doc/getdate.texi
@@ -30,25 +30,30 @@ or a week from Sunday, with feelings of helpless confusion. @dots{}
|
||||
--- Robert Grudin, @cite{Time and the Art of Living}.
|
||||
@end quotation
|
||||
|
||||
This section describes the textual date representations that GNU
|
||||
This section describes the textual date representations that @sc{gnu}
|
||||
programs accept. These are the strings you, as a user, can supply as
|
||||
arguments to the various programs. The C interface (via the
|
||||
@code{getdate} function) is not described here.
|
||||
|
||||
@cindex beginning of time, for Unix
|
||||
@cindex epoch, for Unix
|
||||
Although the date syntax here can represent any possible time since zero
|
||||
A.D., computer integers are not big enough for such a (comparatively)
|
||||
long time. The earliest date semantically allowed on Unix systems is
|
||||
midnight, 1 January 1970 UCT.
|
||||
@cindex beginning of time, for @sc{posix}
|
||||
@cindex epoch, for @sc{posix}
|
||||
Although the date syntax here can represent any possible time since the
|
||||
year zero, computer integers often cannot represent such a wide range of
|
||||
time. On @sc{posix} systems, the clock starts at 1970-01-01 00:00:00
|
||||
@sc{utc}: @sc{posix} does not require support for times before the
|
||||
@sc{posix} Epoch and times far in the future. Traditional Unix systems
|
||||
have 32-bit signed @code{time_t} and can represent times from 1901-12-13
|
||||
20:45:52 through 2038-01-19 03:14:07 @sc{utc}. Systems with 64-bit
|
||||
signed @code{time_t} can represent all the times in the known
|
||||
lifetime of the universe.
|
||||
|
||||
@menu
|
||||
* General date syntax:: Common rules.
|
||||
* Calendar date items:: 19 Dec 1994.
|
||||
* Time of day items:: 9:20pm.
|
||||
* Time zone items:: EST, DST, BST, UTC, ...
|
||||
* Day of week items:: Monday and others.
|
||||
* Relative items in date strings:: next tuesday, 2 years ago.
|
||||
* Calendar date items:: 19 Dec 1994.
|
||||
* Time of day items:: 9:20pm.
|
||||
* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}, ...
|
||||
* Day of week items:: Monday and others.
|
||||
* Relative items in date strings:: next tuesday, 2 years ago.
|
||||
* Pure numbers in date strings:: 19931219, 1440.
|
||||
* Authors of getdate:: Bellovin, Salz, Berets, et al.
|
||||
@end menu
|
||||
@@ -113,7 +118,7 @@ specified differently, depending on whether the month is specified
|
||||
numerically or literally. All these strings specify the same calendar date:
|
||||
|
||||
@example
|
||||
1972-09-24 # ISO 8601.
|
||||
1972-09-24 # @sc{iso} 8601.
|
||||
72-9-24 # Assume 19xx for 69 through 99,
|
||||
# 20xx for 00 through 68.
|
||||
72-09-24 # Leading zeros are ignored.
|
||||
@@ -136,9 +141,9 @@ sep 24
|
||||
|
||||
Here are the rules.
|
||||
|
||||
@cindex ISO 8601 date format
|
||||
@cindex date format, ISO 8601
|
||||
For numeric months, the ISO 8601 format
|
||||
@cindex @sc{iso} 8601 date format
|
||||
@cindex date format, @sc{iso} 8601
|
||||
For numeric months, the @sc{iso} 8601 format
|
||||
@samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is
|
||||
any positive number, @var{month} is a number between 01 and 12, and
|
||||
@var{day} is a number between 01 and 31. A leading zero must be present
|
||||
@@ -186,7 +191,7 @@ day. Here are some examples, all of which represent the same time:
|
||||
20:02:0
|
||||
20:02
|
||||
8:02pm
|
||||
20:02-0500 # In EST (Eastern U.S. Standard Time).
|
||||
20:02-0500 # In @sc{est} (U.S. Eastern Standard Time).
|
||||
@end example
|
||||
|
||||
More generally, the time of the day may be given as
|
||||
@@ -206,6 +211,9 @@ or @samp{p.m.}), @var{hour} is restricted to run from 1 to 12, and
|
||||
indicates the first half of the day, @samp{pm} indicates the second
|
||||
half of the day. In this notation, 12 is the predecessor of 1:
|
||||
midnight is @samp{12am} while noon is @samp{12pm}.
|
||||
(This is the zero-oriented interpretation of @samp{12am} and @samp{12pm},
|
||||
as opposed to the old tradition derived from Latin
|
||||
which uses @samp{12m} for noon and @samp{12pm} for midnight.)
|
||||
|
||||
@cindex time zone correction
|
||||
@cindex minutes, time zone correction by
|
||||
@@ -214,10 +222,10 @@ expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+}
|
||||
or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number
|
||||
of zone minutes. When a time zone correction is given this way, it
|
||||
forces interpretation of the time relative to
|
||||
Coordinated Universal Time (UTC), overriding any previous
|
||||
Coordinated Universal Time (@sc{utc}), overriding any previous
|
||||
specification for the time zone or the local time zone. The @var{minute}
|
||||
part of the time of the day may not be elided when a time zone correction
|
||||
is used. This is the only way to specify a time zone correction by
|
||||
is used. This is the best way to specify a time zone correction by
|
||||
fractional parts of an hour.
|
||||
|
||||
Either @samp{am}/@samp{pm} or a time zone correction may be specified,
|
||||
@@ -229,119 +237,18 @@ but not both.
|
||||
|
||||
@cindex time zone item
|
||||
|
||||
A @dfn{time zone item} specifies an international time zone, indicated by
|
||||
a small set of letters. They are supported for backward compatibility reasons,
|
||||
but they are not recommended because they are ambiguous in practice:
|
||||
for example, the abbreviation @samp{EST} has different meanings in
|
||||
Australia and the United States. Any included period is ignored. Military
|
||||
time zone designations use a single letter. Currently, only integral
|
||||
zone hours may be represented in a time zone item. See the previous
|
||||
section for a finer control over the time zone correction.
|
||||
A @dfn{time zone item} specifies an international time zone, indicated
|
||||
by a small set of letters, e.g., @samp{UTC} for Coordinated Universal
|
||||
Time. Any included periods are ignored. By following a
|
||||
non-daylight-saving time zone by the string @samp{DST} in a separate
|
||||
word (that is, separated by some white space), the corresponding
|
||||
daylight saving time zone may be specified.
|
||||
|
||||
Here are many non-daylight-saving-time time zones, indexed by the zone
|
||||
hour value.
|
||||
|
||||
@table @asis
|
||||
@item -1200
|
||||
@samp{Y} for militaries.
|
||||
@item -1100
|
||||
@samp{X} for militaries.
|
||||
@item -1000
|
||||
@samp{W} for militaries.
|
||||
@item -0900
|
||||
@samp{V} for militaries.
|
||||
@item -0800
|
||||
@samp{PST} for Pacific Standard, and
|
||||
@samp{U} for militaries.
|
||||
@item -0700
|
||||
@samp{MST} for Mountain Standard, and
|
||||
@samp{T} for militaries.
|
||||
@item -0600
|
||||
@samp{CST} for Central Standard, and
|
||||
@samp{S} for militaries.
|
||||
@item -0500
|
||||
@samp{EST} for Eastern Standard, and
|
||||
@samp{R} for militaries.
|
||||
@item -0400
|
||||
@samp{AST} for Atlantic Standard, and
|
||||
@samp{Q} for militaries.
|
||||
@item -0300
|
||||
@samp{P} for militaries.
|
||||
@item -0200
|
||||
@samp{O} for militaries.
|
||||
@item -0100
|
||||
@samp{N} for militaries.
|
||||
@item +0000
|
||||
@cindex Greenwich Mean Time
|
||||
@cindex Coordinated Universal Time
|
||||
@cindex Universal Coordinated Time
|
||||
@cindex Universal Time (Coordinated)
|
||||
@samp{GMT} for Greenwich Mean,
|
||||
@samp{UT} for Universal,
|
||||
@samp{UTC} for Coordinated Universal,
|
||||
@samp{WET} for Western European, and
|
||||
@samp{Z} for ISO 8601 and militaries.
|
||||
@item +0100
|
||||
@samp{A} for militaries,
|
||||
@samp{CET} for Central European,
|
||||
@samp{MET} for Midden Europesche Tijd (Dutch), and
|
||||
@samp{MEZ} for Mittel-Europ@"aische Zeit (German).
|
||||
@item +0200
|
||||
@samp{B} for militaries, and
|
||||
@samp{EET} for Eastern European.
|
||||
@item +0300
|
||||
@samp{C} for militaries.
|
||||
@item +0400
|
||||
@samp{D} for militaries.
|
||||
@item +0500
|
||||
@samp{E} for militaries.
|
||||
@item +0600
|
||||
@samp{F} for militaries.
|
||||
@item +0700
|
||||
@samp{G} for militaries.
|
||||
@item +0800
|
||||
@samp{H} for militaries.
|
||||
@item +0900
|
||||
@samp{I} for militaries, and
|
||||
@samp{JST} for Japan Standard.
|
||||
@item +1000
|
||||
@samp{GST} for Guam Standard, and
|
||||
@samp{K} for militaries.
|
||||
@item +1100
|
||||
@samp{L} for militaries.
|
||||
@item +1200
|
||||
@samp{M} for militaries, and
|
||||
@samp{NZST} for New Zealand Standard.
|
||||
@end table
|
||||
|
||||
@cindex daylight-saving time
|
||||
Here are many daylight-saving time (DST) time zones,
|
||||
indexed by the zone hour value. Also, by
|
||||
following a non-DST time zone by the string @samp{DST} in a separate word
|
||||
(that is, separated by some whitespace), the corresponding DST time zone
|
||||
may be specified.
|
||||
|
||||
@table @asis
|
||||
@item -0700
|
||||
@samp{PDT} for Pacific Daylight.
|
||||
@item -0600
|
||||
@samp{MDT} for Mountain Daylight.
|
||||
@item -0500
|
||||
@samp{CDT} for Central Daylight.
|
||||
@item -0400
|
||||
@samp{EDT} for Eastern Daylight.
|
||||
@item -0300
|
||||
@samp{ADT} for Atlantic Daylight.
|
||||
@item +0100
|
||||
@samp{BST} for British Summer, and
|
||||
@samp{WEST} for Western European Summer.
|
||||
@item +0200
|
||||
@samp{CEST} for Central European Summer,
|
||||
@samp{MEST} for Midden Europesche S. Tijd (Dutch), and
|
||||
@samp{MESZ} for Mittel-Europ@"aische Sommerzeit (German).
|
||||
@item +1300
|
||||
@samp{NZDT} for New Zealand Daylight.
|
||||
@end table
|
||||
Time zone items are obsolescent and are not recommended, because they
|
||||
are ambiguous; for example, @samp{EST} has a different meaning in
|
||||
Australia than in the United States. Instead, it's better to use
|
||||
unambiguous numeric time zone corrections like @samp{-0500}, as
|
||||
described in the previous section.
|
||||
|
||||
|
||||
@node Day of week items
|
||||
@@ -409,7 +316,7 @@ The unit of time may be preceded by a multiplier, given as an optionally
|
||||
signed number. Unsigned numbers are taken as positively signed. No
|
||||
number at all implies 1 for a multiplier. Following a relative item by
|
||||
the string @samp{ago} is equivalent to preceding the unit by a
|
||||
multiplicator with value @math{-1}.
|
||||
multiplier with value @math{-1}.
|
||||
|
||||
@findex day @r{in date strings}
|
||||
@findex tomorrow @r{in date strings}
|
||||
@@ -429,9 +336,9 @@ items, like in @samp{12:00 today}. The string @samp{this} also has
|
||||
the meaning of a zero-valued time displacement, but is preferred in
|
||||
date strings like @samp{this thursday}.
|
||||
|
||||
When a relative item causes the resulting date to cross the boundary
|
||||
between DST and non-DST (or vice-versa), the hour is adjusted according
|
||||
to the local time.
|
||||
When a relative item causes the resulting date to cross a boundary
|
||||
where the clocks were adjusted, typically for daylight-saving time,
|
||||
the resulting date and time are adjusted accordingly.
|
||||
|
||||
|
||||
@node Pure numbers in date strings
|
||||
@@ -439,8 +346,8 @@ to the local time.
|
||||
|
||||
@cindex pure numbers in date strings
|
||||
|
||||
The precise intepretation of a pure decimal number depends
|
||||
the context in the date string.
|
||||
The precise interpretation of a pure decimal number depends
|
||||
on the context in the date string.
|
||||
|
||||
If the decimal number is of the form @var{yyyy}@var{mm}@var{dd} and no
|
||||
other calendar date item (@pxref{Calendar date items}) appears before it
|
||||
@@ -468,13 +375,14 @@ year.
|
||||
@cindex Berets, Jim
|
||||
@cindex MacKenzie, David
|
||||
@cindex Meyering, Jim
|
||||
@cindex Eggert, Paul
|
||||
@code{getdate} was originally implemented by Steven M. Bellovin
|
||||
(@email{smb@@research.att.com}) while at the University of North Carolina
|
||||
at Chapel Hill. The code was later tweaked by a couple of people on
|
||||
Usenet, then completely overhauled by Rich $alz (@email{rsalz@@bbn.com})
|
||||
and Jim Berets (@email{jberets@@bbn.com}) in August, 1990. Various
|
||||
revisions for the GNU system were made by David MacKenzie, Jim Meyering,
|
||||
and others.
|
||||
revisions for the @sc{gnu} system were made by David MacKenzie, Jim Meyering,
|
||||
Paul Eggert and others.
|
||||
|
||||
@cindex Pinard, F.
|
||||
@cindex Berry, K.
|
||||
|
||||
@@ -64,7 +64,7 @@ END-INFO-DIR-ENTRY
|
||||
@ifinfo
|
||||
This file documents the GNU shell utilities.
|
||||
|
||||
Copyright (C) 1994, 95, 96 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1995, 1996, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
@@ -96,7 +96,7 @@ by the Foundation.
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1994, 95, 96 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1994, 1995, 1996, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
@@ -350,6 +350,7 @@ independent way. For example, a string containing the Euro currency symbol
|
||||
$ /usr/local/bin/printf '\u20AC 14.95'
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
will be output correctly in all locales supporting the Euro symbol
|
||||
(ISO-8859-15, UTF-8, and others). Similarly, a Chinese string
|
||||
|
||||
@@ -357,18 +358,19 @@ will be output correctly in all locales supporting the Euro symbol
|
||||
$ /usr/local/bin/printf '\u4e2d\u6587'
|
||||
@end example
|
||||
|
||||
will be output correctly in all chinese locales (GB2312, BIG5, UTF-8, etc).
|
||||
@noindent
|
||||
will be output correctly in all Chinese locales (GB2312, BIG5, UTF-8, etc).
|
||||
|
||||
Note that in these examples, the full pathname of @code{printf} has been
|
||||
given, to distinguish it from the GNU @code{bash} builtin function
|
||||
@code{printf}.
|
||||
|
||||
For larger strings, you don't need to look up the hexadecimal code values of
|
||||
each character one by one. ASCII characters mixed with \u escape sequences
|
||||
is also known as the JAVA source file encoding. You can use GNU recode 3.5c
|
||||
(or newer) to convert strings to this encoding. Here is how to convert a
|
||||
piece of text into a shell script which will output this text in a locale-
|
||||
independent way:
|
||||
For larger strings, you don't need to look up the hexadecimal code
|
||||
values of each character one by one. ASCII characters mixed with \u
|
||||
escape sequences is also known as the JAVA source file encoding. You can
|
||||
use GNU recode 3.5c (or newer) to convert strings to this encoding. Here
|
||||
is how to convert a piece of text into a shell script which will output
|
||||
this text in a locale-independent way:
|
||||
|
||||
@smallexample
|
||||
$ LC_CTYPE=zh_CN.big5 /usr/local/bin/printf \
|
||||
@@ -2258,7 +2260,7 @@ Note that this value is the number of seconds between the epoch
|
||||
and the current date as defined by the localtime system call.
|
||||
It isn't changed by the @samp{--date} option.
|
||||
@item %S
|
||||
second (00@dots{}61)
|
||||
second (00@dots{}60)
|
||||
@item %T
|
||||
time, 24-hour (hh:mm:ss)
|
||||
@item %X
|
||||
@@ -2479,16 +2481,14 @@ Append the hours, minutes, and seconds.
|
||||
@end table
|
||||
|
||||
If showing any time terms, then include the time zone using the format
|
||||
@samp{%z}. If @samp{--utc} is also specified, use @samp{%Z} in place of
|
||||
@samp{%z}.
|
||||
|
||||
@item -R
|
||||
@itemx --rfc-822
|
||||
@opindex -R
|
||||
@opindex --rfc-822
|
||||
Display the time and date using the RFC-822-specified
|
||||
Display the time and date using the RFC-822-conforming
|
||||
format, @samp{%a, %_d %b %Y %H:%M:%S %z}.
|
||||
If @samp{--utc} is also specified, use @samp{GMT} in place of @samp{%z}.
|
||||
|
||||
@item -r @var{file}
|
||||
@itemx --reference=@var{file}
|
||||
@@ -2501,7 +2501,7 @@ time of @var{file}, instead of the current time and date.
|
||||
@itemx --set=@var{datestr}
|
||||
@opindex -s
|
||||
@opindex --set
|
||||
Set the time and date to @var{datestr}, See @samp{-d} above.
|
||||
Set the time and date to @var{datestr}. See @samp{-d} above.
|
||||
|
||||
@item -u
|
||||
@itemx --utc
|
||||
@@ -2509,11 +2509,16 @@ Set the time and date to @var{datestr}, See @samp{-d} above.
|
||||
@opindex -u
|
||||
@opindex --utc
|
||||
@opindex --universal
|
||||
@cindex coordinated universal time
|
||||
@cindex Coordinated Universal Time
|
||||
@cindex UTC
|
||||
@cindex Greenwich Mean Time
|
||||
Print or set the time and date in Universal Coordinated Time instead of
|
||||
in local (wall clock) time.
|
||||
|
||||
@cindex GMT
|
||||
Use Coordinated Universal Time (@sc{utc}) by operating as if the
|
||||
@env{TZ} environment variable was set to the string @samp{UTC0}.
|
||||
Normally, @command{date} operates in the time zone indicated by
|
||||
@env{TZ}, or the system default if @env{TZ} is not set. Coordinated
|
||||
Universal Time is often called ``Greenwich Mean Time'' (@sc{gmt}) for
|
||||
historical reasons.
|
||||
@end table
|
||||
|
||||
|
||||
@@ -2591,7 +2596,7 @@ To convert a date string to the number of seconds since the epoch
|
||||
the @samp{%s} format. That can be useful in sorting and/or graphing
|
||||
and/or comparing data by date. The following command outputs the
|
||||
number of the seconds since the epoch for the time one second later
|
||||
than the epoch, but in time zone five hours later (Cambridge, Massachusetts),
|
||||
than the epoch, but in a time zone five hours later (Cambridge, Massachusetts),
|
||||
thus a total of five hours and one second after the epoch:
|
||||
|
||||
@example
|
||||
@@ -2956,7 +2961,7 @@ nohup @var{command} [@var{arg}]@dots{}
|
||||
|
||||
@flindex nohup.out
|
||||
@code{nohup} increases the scheduling priority of @var{command} by 5, so
|
||||
it has a slightly smaller change to run. If standard output is a terminal,
|
||||
it has a slightly smaller chance to run. If standard output is a terminal,
|
||||
it and standard error are redirected so that they are appended to the
|
||||
file @file{nohup.out}; if that cannot be written to, they are appended
|
||||
to the file @file{$HOME/nohup.out}. If that cannot be written to, the
|
||||
@@ -3335,11 +3340,11 @@ $ seq -s' ' 0 .1 .3
|
||||
0 0.1 0.2
|
||||
@end example
|
||||
|
||||
But doesn't happen on most systems because @code{seq} is implemented using
|
||||
binary floating point arithmetic (via the C @code{double} type) -- which
|
||||
means some decimal numbers like @code{.1} cannot be represented exactly.
|
||||
That in turn means some nonintuitive conditions like @code{.1 * 3 > .3}
|
||||
will end up being true.
|
||||
But that doesn't happen on most systems because @code{seq} is
|
||||
implemented using binary floating point arithmetic (via the C
|
||||
@code{double} type) -- which means some decimal numbers like @code{.1}
|
||||
cannot be represented exactly. That in turn means some nonintuitive
|
||||
conditions like @code{.1 * 3 > .3} will end up being true.
|
||||
|
||||
To work around that in the above example, use a slightly larger number as
|
||||
the @var{last} value:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
% Load plain if necessary, i.e., if running under initex.
|
||||
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
||||
%
|
||||
\def\texinfoversion{2000-09-06.09}
|
||||
\def\texinfoversion{2000-10-18.06}
|
||||
%
|
||||
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
% Free Software Foundation, Inc.
|
||||
@@ -688,16 +688,25 @@ where each line of input produces a line of output.}
|
||||
\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
|
||||
\leftline{\hskip\leftskip{\rm#1}}}}
|
||||
|
||||
% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
|
||||
|
||||
\def\inmargin#1{%
|
||||
\strut\vadjust{\nobreak\kern-\strutdepth
|
||||
\vtop to \strutdepth{\baselineskip\strutdepth\vss
|
||||
\llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
|
||||
% @inmargin{TEXT} puts TEXT in the left margin next to the current
|
||||
% paragraph. For more general purposes, use the \margin insertion class.
|
||||
%
|
||||
\newskip\inmarginspacing \inmarginspacing=1cm
|
||||
\def\strutdepth{\dp\strutbox}
|
||||
%
|
||||
\def\inmargin#1{\strut\vadjust{%
|
||||
\nobreak
|
||||
\kern-\strutdepth
|
||||
\vtop to \strutdepth{%
|
||||
\baselineskip=\strutdepth
|
||||
\vss
|
||||
% if you have multiple lines of stuff to put here, you'll need to
|
||||
% make the vbox yourself of the appropriate size.
|
||||
\llap{#1\hskip\inmarginspacing}%
|
||||
\null
|
||||
}%
|
||||
}}
|
||||
|
||||
%\hbox{{\rm#1}}\hfil\break}}
|
||||
|
||||
% @include file insert text of that file as input.
|
||||
% Allow normal characters that we make active in the argument (a file name).
|
||||
|
||||
@@ -217,3 +217,13 @@ p delta
|
||||
n
|
||||
p Start
|
||||
q
|
||||
b dir_name
|
||||
r
|
||||
n
|
||||
p slash
|
||||
n
|
||||
n
|
||||
n
|
||||
p slash
|
||||
p slash - path + 1
|
||||
q
|
||||
|
||||
113
lib/ChangeLog
113
lib/ChangeLog
@@ -1,3 +1,116 @@
|
||||
2000-11-05 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* makepath.h (make_dir): Declare.
|
||||
* makepath.c (make_dir): Remove `static' attribute.
|
||||
Tweak a comment.
|
||||
|
||||
2000-11-04 Alexandre Duret-Lutz <duret_g@epita.fr>
|
||||
|
||||
* hash.c (hash_get_next): Fix a thinko: when ENTRY is the
|
||||
last one in a bucket, advance to the next bucket.
|
||||
|
||||
2000-11-02 Vesselin Atanasov <vesselin@bgnet.bg>
|
||||
|
||||
* lib/fnmatch.c: Do not comment out all the code if we are using
|
||||
the GNU C library, because in some cases we are replacing buggy
|
||||
code in the GNU C library itself.
|
||||
|
||||
2000-10-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/error.h, lib/getline.h, lib/modechange.h:
|
||||
Remove "2000" from Copyright line, as the file hasn't been
|
||||
changed this year other than in the copyright notice.
|
||||
|
||||
* lib/xalloc.h: Add "2000" to Copyright line, as this file
|
||||
was changed this year.
|
||||
|
||||
2000-10-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/fnmatch.c (FOLD): Do not assume that characters are unsigned.
|
||||
(fnmatch): Fix some FNM_FILE_NAME and FNM_LEADING_DIR bugs,
|
||||
e.g. fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) incorrectly yielded zero.
|
||||
|
||||
2000-10-29 Greg Louis <glouis@dynamicro.on.ca>
|
||||
|
||||
* regex.h (__restrict_arr): Move definition out of #ifndef block.
|
||||
Required because egcs-2.91.66 (aka 1.1.2) defines __restrict, but
|
||||
doesn't define __restrict_arr.
|
||||
|
||||
2000-10-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* xstat.in: Fix grammar in comment.
|
||||
|
||||
2000-10-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* memchr.c: Update from libc.
|
||||
Adjust for portability:
|
||||
[HAVE_STDLIB_H]: Include stdlib.h.
|
||||
[HAVE_BP_SYM_H || _LIBC]: Guard inclusion of bp-sym.h.
|
||||
Undef __memchr, too.
|
||||
[!weak_alias]: Define __memchr to memchr.
|
||||
|
||||
* regex.c: Update from libc.
|
||||
* regex.h: Likewise.
|
||||
* getopt1.c: Likewise.
|
||||
* memcmp.c: Likewise.
|
||||
|
||||
* getusershell.c (setusershell) [HAVE_FSEEKO]: Use fseeko.
|
||||
Patch by Ulrich Drepper.
|
||||
|
||||
2000-10-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* strftime.c: Update from libc.
|
||||
|
||||
2000-10-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* obstack.c: Update from libc.
|
||||
|
||||
2000-10-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* hard-locale.c (hard_locale): Revert last change -- it was simply
|
||||
wrong. That set_locale call must not have any side effects.
|
||||
From Paul Eggert.
|
||||
|
||||
2000-10-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* md5.c (md5_process_block) [OP]: Use `rol', not CYCLIC.
|
||||
[CYCLIC]: Remove now-unused definition.
|
||||
|
||||
* save-cwd.c (O_DIRECTORY): Define, if needed.
|
||||
(save_cwd) [HAVE_FCHDIR]: Use O_DIRECTORY when opening ".".
|
||||
Suggestion from Ulrich Drepper.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* dirname.c (dir_name_r): New function, factored out of dir_name.
|
||||
(dir_name): Use dir_name_r.
|
||||
* dirname.h (dir_name_r): Declare it.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* dirname.c (memrchr): Declare if necessary.
|
||||
(dir_name): Remove the restriction that there be no
|
||||
trailing slashes. Now, this code skips past them, effectively
|
||||
ignoring them.
|
||||
[TEST_DIRNAME] (main): New unit tests.
|
||||
|
||||
* memrchr.c: New file from GNU libc.
|
||||
Undef __memrchr, too.
|
||||
[!weak_alias]: Define __memrchr to memrchr.
|
||||
Guard weak_alias use with `#ifdef weak_alias'.
|
||||
|
||||
2000-10-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* quote.h (PARAMS): Define and use.
|
||||
Reported by Akim Demaille.
|
||||
|
||||
* getopt.c: Update from libc.
|
||||
|
||||
2000-10-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* hard-locale.c (hard_locale): Use "", not 0 as 2nd arg to setlocale.
|
||||
From Jan Fedak.
|
||||
|
||||
2000-09-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* md5.h (rol): Define (from GnuPG).
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -213,17 +214,17 @@ $(DEPDIR)/localcharset$U.Po $(DEPDIR)/long-options$U.Po \
|
||||
$(DEPDIR)/lstat.Po $(DEPDIR)/makepath$U.Po $(DEPDIR)/malloc.Po \
|
||||
$(DEPDIR)/mbswidth$U.Po $(DEPDIR)/md5$U.Po $(DEPDIR)/memcasecmp$U.Po \
|
||||
$(DEPDIR)/memchr.Po $(DEPDIR)/memcmp.Po $(DEPDIR)/memcoll$U.Po \
|
||||
$(DEPDIR)/memcpy.Po $(DEPDIR)/memmove.Po $(DEPDIR)/memset.Po \
|
||||
$(DEPDIR)/mktime.Po $(DEPDIR)/modechange$U.Po $(DEPDIR)/mountlist.Po \
|
||||
$(DEPDIR)/nanosleep.Po $(DEPDIR)/obstack.Po $(DEPDIR)/path-concat$U.Po \
|
||||
$(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po $(DEPDIR)/quote$U.Po \
|
||||
$(DEPDIR)/quotearg$U.Po $(DEPDIR)/readtokens$U.Po $(DEPDIR)/readutmp.Po \
|
||||
$(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po $(DEPDIR)/rmdir.Po \
|
||||
$(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po $(DEPDIR)/same$U.Po \
|
||||
$(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po $(DEPDIR)/sha$U.Po \
|
||||
$(DEPDIR)/stat.Po $(DEPDIR)/stime.Po $(DEPDIR)/stpcpy.Po \
|
||||
$(DEPDIR)/strcasecmp.Po $(DEPDIR)/strcspn.Po $(DEPDIR)/strdup.Po \
|
||||
$(DEPDIR)/strftime.Po $(DEPDIR)/stripslash$U.Po \
|
||||
$(DEPDIR)/memcpy.Po $(DEPDIR)/memmove.Po $(DEPDIR)/memrchr.Po \
|
||||
$(DEPDIR)/memset.Po $(DEPDIR)/mktime.Po $(DEPDIR)/modechange$U.Po \
|
||||
$(DEPDIR)/mountlist.Po $(DEPDIR)/nanosleep.Po $(DEPDIR)/obstack.Po \
|
||||
$(DEPDIR)/path-concat$U.Po $(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po \
|
||||
$(DEPDIR)/quote$U.Po $(DEPDIR)/quotearg$U.Po $(DEPDIR)/readtokens$U.Po \
|
||||
$(DEPDIR)/readutmp.Po $(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po \
|
||||
$(DEPDIR)/rmdir.Po $(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po \
|
||||
$(DEPDIR)/same$U.Po $(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po \
|
||||
$(DEPDIR)/sha$U.Po $(DEPDIR)/stat.Po $(DEPDIR)/stime.Po \
|
||||
$(DEPDIR)/stpcpy.Po $(DEPDIR)/strcasecmp.Po $(DEPDIR)/strcspn.Po \
|
||||
$(DEPDIR)/strdup.Po $(DEPDIR)/strftime.Po $(DEPDIR)/stripslash$U.Po \
|
||||
$(DEPDIR)/strncasecmp.Po $(DEPDIR)/strndup.Po $(DEPDIR)/strnlen.Po \
|
||||
$(DEPDIR)/strpbrk.Po $(DEPDIR)/strstr.Po $(DEPDIR)/strtod.Po \
|
||||
$(DEPDIR)/strtol.Po $(DEPDIR)/strtoul.Po $(DEPDIR)/strtoull.Po \
|
||||
@@ -238,9 +239,9 @@ Makefile.in TODO __fpending.c alloca.c atexit.c chown.c dup2.c error.c \
|
||||
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
|
||||
getdate.c getgroups.c gethostname.c getline.c getloadavg.c getpass.c \
|
||||
getusershell.c group-member.c lchown.c malloc.c memchr.c memcmp.c \
|
||||
memcpy.c memmove.c memset.c mktime.c mountlist.c nanosleep.c obstack.c \
|
||||
obstack.h putenv.c readutmp.c realloc.c regex.c rmdir.c rpmatch.c \
|
||||
stime.c stpcpy.c strcasecmp.c strcspn.c strdup.c strftime.c \
|
||||
memcpy.c memmove.c memrchr.c memset.c mktime.c mountlist.c nanosleep.c \
|
||||
obstack.c obstack.h putenv.c readutmp.c realloc.c regex.c rmdir.c \
|
||||
rpmatch.c stime.c stpcpy.c strcasecmp.c strcspn.c strdup.c strftime.c \
|
||||
strncasecmp.c strndup.c strnlen.c strpbrk.c strstr.c strtod.c strtol.c \
|
||||
strtoul.c strtoull.c strtoumax.c strverscmp.c utime.c
|
||||
|
||||
@@ -408,6 +409,8 @@ memcpy_.c: memcpy.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memcpy.c; then echo $(srcdir)/memcpy.c; else echo memcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memcpy_.c
|
||||
memmove_.c: memmove.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memmove.c; then echo $(srcdir)/memmove.c; else echo memmove.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memmove_.c
|
||||
memrchr_.c: memrchr.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memrchr.c; then echo $(srcdir)/memrchr.c; else echo memrchr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memrchr_.c
|
||||
memset_.c: memset.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memset.c; then echo $(srcdir)/memset.c; else echo memset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memset_.c
|
||||
mktime_.c: mktime.c $(ANSI2KNR)
|
||||
@@ -525,17 +528,17 @@ getopt1_.o getpass_.o getstr_.o getugroups_.o getusershell_.o \
|
||||
group-member_.o hard-locale_.o hash_.o human_.o idcache_.o isdir_.o \
|
||||
lchown_.o linebuffer_.o localcharset_.o long-options_.o lstat_.o \
|
||||
makepath_.o malloc_.o mbswidth_.o md5_.o memcasecmp_.o memchr_.o \
|
||||
memcmp_.o memcoll_.o memcpy_.o memmove_.o memset_.o mktime_.o \
|
||||
modechange_.o mountlist_.o nanosleep_.o obstack_.o path-concat_.o \
|
||||
posixtm_.o putenv_.o quote_.o quotearg_.o readtokens_.o readutmp_.o \
|
||||
realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o same_.o \
|
||||
save-cwd_.o savedir_.o sha_.o stat_.o stime_.o stpcpy_.o strcasecmp_.o \
|
||||
strcspn_.o strdup_.o strftime_.o stripslash_.o strncasecmp_.o \
|
||||
strndup_.o strnlen_.o strpbrk_.o strstr_.o strtod_.o strtol_.o \
|
||||
strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o unicodeio_.o \
|
||||
userspec_.o utime_.o version-etc_.o xgetcwd_.o xgethostname_.o \
|
||||
xmalloc_.o xstrdup_.o xstrtod_.o xstrtol_.o xstrtoul_.o xstrtoumax_.o \
|
||||
yesno_.o : $(ANSI2KNR)
|
||||
memcmp_.o memcoll_.o memcpy_.o memmove_.o memrchr_.o memset_.o \
|
||||
mktime_.o modechange_.o mountlist_.o nanosleep_.o obstack_.o \
|
||||
path-concat_.o posixtm_.o putenv_.o quote_.o quotearg_.o readtokens_.o \
|
||||
readutmp_.o realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o \
|
||||
same_.o save-cwd_.o savedir_.o sha_.o stat_.o stime_.o stpcpy_.o \
|
||||
strcasecmp_.o strcspn_.o strdup_.o strftime_.o stripslash_.o \
|
||||
strncasecmp_.o strndup_.o strnlen_.o strpbrk_.o strstr_.o strtod_.o \
|
||||
strtol_.o strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o \
|
||||
unicodeio_.o userspec_.o utime_.o version-etc_.o xgetcwd_.o \
|
||||
xgethostname_.o xmalloc_.o xstrdup_.o xstrtod_.o xstrtol_.o xstrtoul_.o \
|
||||
xstrtoumax_.o yesno_.o : $(ANSI2KNR)
|
||||
.y.c:
|
||||
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
|
||||
if test -f y.tab.h; then \
|
||||
@@ -630,6 +633,7 @@ maintainer-clean-tags:
|
||||
@AMDEP@include $(DEPDIR)/memcoll$U.Po
|
||||
@AMDEP@include $(DEPDIR)/memcpy.Po
|
||||
@AMDEP@include $(DEPDIR)/memmove.Po
|
||||
@AMDEP@include $(DEPDIR)/memrchr.Po
|
||||
@AMDEP@include $(DEPDIR)/memset.Po
|
||||
@AMDEP@include $(DEPDIR)/mktime.Po
|
||||
@AMDEP@include $(DEPDIR)/modechange$U.Po
|
||||
|
||||
107
lib/dirname.c
107
lib/dirname.c
@@ -34,6 +34,13 @@ char *malloc ();
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef HAVE_DECL_MEMRCHR
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_MEMRCHR
|
||||
void *memrchr ();
|
||||
#endif
|
||||
|
||||
#include "dirname.h"
|
||||
|
||||
#ifndef ISSLASH
|
||||
@@ -42,15 +49,13 @@ char *malloc ();
|
||||
|
||||
#define BACKSLASH_IS_PATH_SEPARATOR ISSLASH ('\\')
|
||||
|
||||
/* Return the leading directories part of PATH,
|
||||
allocated with malloc. If out of memory, return 0.
|
||||
Assumes that trailing slashes have already been
|
||||
removed. */
|
||||
|
||||
char *
|
||||
dir_name (const char *path)
|
||||
/* Return the length of `dirname (PATH)' and set *RESULT
|
||||
to point to PATH or to `"."', as appropriate.
|
||||
Works properly even if there are trailing slashes
|
||||
(by effectively ignoring them). */
|
||||
size_t
|
||||
dir_name_r (const char *path, const char **result)
|
||||
{
|
||||
char *newpath;
|
||||
char *slash;
|
||||
int length; /* Length of result, not including NUL. */
|
||||
|
||||
@@ -62,11 +67,26 @@ dir_name (const char *path)
|
||||
slash = b;
|
||||
}
|
||||
|
||||
/* Make sure there are no trailing slashes. */
|
||||
assert (slash == NULL /* There are no slashes in PATH. */
|
||||
|| slash[1] != 0 /* There is a non-NUL byte after the last slash. */
|
||||
|| path == slash /* PATH is just `/'. */
|
||||
);
|
||||
/* If the last byte of PATH is a slash, decrement SLASH until it's
|
||||
pointing at the leftmost in a sequence of trailing slashes. */
|
||||
if (slash && slash[1] == 0)
|
||||
{
|
||||
while (path < slash && ISSLASH (slash[-1]))
|
||||
{
|
||||
--slash;
|
||||
}
|
||||
|
||||
if (path < slash)
|
||||
{
|
||||
slash = memrchr (path, '/', slash - path);
|
||||
if (BACKSLASH_IS_PATH_SEPARATOR)
|
||||
{
|
||||
char *b = memrchr (path, '\\', slash - path);
|
||||
if (b && slash < b)
|
||||
slash = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slash == 0)
|
||||
{
|
||||
@@ -96,10 +116,67 @@ dir_name (const char *path)
|
||||
length = slash - path + 1;
|
||||
}
|
||||
|
||||
newpath = (char *) malloc (length + 1);
|
||||
*result = path;
|
||||
return length;
|
||||
}
|
||||
|
||||
/* Return the leading directories part of PATH,
|
||||
allocated with malloc. If out of memory, return 0.
|
||||
Works properly even if there are trailing slashes
|
||||
(by effectively ignoring them). */
|
||||
|
||||
char *
|
||||
dir_name (const char *path)
|
||||
{
|
||||
const char *result;
|
||||
size_t length = dir_name_r (path, &result);
|
||||
char *newpath = (char *) malloc (length + 1);
|
||||
if (newpath == 0)
|
||||
return 0;
|
||||
strncpy (newpath, path, length);
|
||||
strncpy (newpath, result, length);
|
||||
newpath[length] = 0;
|
||||
return newpath;
|
||||
}
|
||||
|
||||
#ifdef TEST_DIRNAME
|
||||
/*
|
||||
|
||||
Run the test like this (expect no output):
|
||||
gcc -DHAVE_CONFIG_H -DTEST_DIRNAME -I.. -O -Wall memrchr.c dirname.c
|
||||
sed -n '/^BEGIN-DATA$/,/^END-DATA$/p' dirname.c|grep -v DATA|./a.out
|
||||
|
||||
BEGIN-DATA
|
||||
foo//// .
|
||||
bar/foo//// bar
|
||||
foo/ .
|
||||
/ /
|
||||
. .
|
||||
a .
|
||||
END-DATA
|
||||
|
||||
*/
|
||||
|
||||
# define MAX_BUFF_LEN 1024
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char buff[MAX_BUFF_LEN + 1];
|
||||
|
||||
buff[MAX_BUFF_LEN] = 0;
|
||||
while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0])
|
||||
{
|
||||
char path[MAX_BUFF_LEN];
|
||||
char expected_result[MAX_BUFF_LEN];
|
||||
char *result;
|
||||
sscanf (buff, "%s %s", path, expected_result);
|
||||
result = dir_name (path);
|
||||
if (strcmp (result, expected_result))
|
||||
printf ("%s: got %s, expected %s\n", path, result, expected_result);
|
||||
}
|
||||
exit (0);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -28,4 +28,7 @@
|
||||
char *
|
||||
dir_name PARAMS ((const char *path));
|
||||
|
||||
size_t
|
||||
dir_name_r PARAMS ((const char *path, const char **result));
|
||||
|
||||
#endif /* not DIRNAME_H_ */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Declaration for error-reporting function
|
||||
Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright 1991, 1992, 1993, 1996, 1997, 2000 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
|
||||
@@ -27,30 +27,18 @@
|
||||
#include <fnmatch.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined STDC_HEADERS || !defined isascii
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
#else
|
||||
# define IN_CTYPE_DOMAIN(c) isascii (c)
|
||||
#endif
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined _LIBC || !defined __GNU_LIBRARY__
|
||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
|
||||
|
||||
# if defined STDC_HEADERS || !defined isascii
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
# else
|
||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
# endif
|
||||
|
||||
# define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
|
||||
|
||||
# ifndef errno
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Match STRING against the filename pattern PATTERN, returning zero if
|
||||
it matches, nonzero if not. */
|
||||
@@ -61,7 +49,9 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
register char c;
|
||||
|
||||
/* Note that this evaluates C many times. */
|
||||
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
|
||||
#define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER ((unsigned char) (c)) \
|
||||
? tolower ((unsigned char) (c)) \
|
||||
: (c))
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
{
|
||||
@@ -99,13 +89,10 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
|
||||
for (c = *p++; c == '?' || c == '*'; c = *p++)
|
||||
{
|
||||
if ((flags & FNM_FILE_NAME) && *n == '/')
|
||||
/* A slash does not match a wildcard under FNM_FILE_NAME. */
|
||||
return FNM_NOMATCH;
|
||||
else if (c == '?')
|
||||
if (c == '?')
|
||||
{
|
||||
/* A ? needs to match one character. */
|
||||
if (*n == '\0')
|
||||
if (*n == '\0' || (*n == '/' && (flags & FNM_FILE_NAME)))
|
||||
/* There isn't another character; no match. */
|
||||
return FNM_NOMATCH;
|
||||
else
|
||||
@@ -117,7 +104,13 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
}
|
||||
|
||||
if (c == '\0')
|
||||
return 0;
|
||||
{
|
||||
if ((flags & (FNM_FILE_NAME | FNM_LEADING_DIR)) == FNM_FILE_NAME)
|
||||
for (; *n != '\0'; n++)
|
||||
if (*n == '/')
|
||||
return FNM_NOMATCH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
{
|
||||
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
|
||||
@@ -126,6 +119,8 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
if ((c == '[' || FOLD (*n) == c1) &&
|
||||
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
|
||||
return 0;
|
||||
else if (*n == '/' && (flags & FNM_FILE_NAME))
|
||||
break;
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
|
||||
@@ -231,7 +226,5 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
|
||||
return FNM_NOMATCH;
|
||||
|
||||
# undef FOLD
|
||||
#undef FOLD
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1997, 1999 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
|
||||
|
||||
@@ -75,11 +75,12 @@
|
||||
#endif
|
||||
|
||||
#ifndef _
|
||||
/* This is for other GNU distributions with internationalized messages.
|
||||
When compiling libc, the _ macro is predefined. */
|
||||
# ifdef HAVE_LIBINTL_H
|
||||
/* This is for other GNU distributions with internationalized messages. */
|
||||
# if defined HAVE_LIBINTL_H || defined _LIBC
|
||||
# include <libintl.h>
|
||||
# define _(msgid) gettext (msgid)
|
||||
# ifndef _
|
||||
# define _(msgid) gettext (msgid)
|
||||
# endif
|
||||
# else
|
||||
# define _(msgid) (msgid)
|
||||
# endif
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#if !defined __STDC__ || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
@@ -28,9 +31,6 @@
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@@ -103,7 +103,13 @@ setusershell ()
|
||||
if (shellstream == NULL)
|
||||
shellstream = fopen (SHELLS_FILE, "r");
|
||||
else
|
||||
fseek (shellstream, 0L, 0);
|
||||
{
|
||||
#ifdef HAVE_FSEEKO
|
||||
fseeko (shellstream, 0, 0);
|
||||
#else
|
||||
fseek (shellstream, 0L, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Close the shells file. */
|
||||
|
||||
@@ -267,7 +267,7 @@ hash_get_first (const Hash_table *table)
|
||||
|
||||
/* Return the user data for the entry following ENTRY, where ENTRY has been
|
||||
returned by a previous call to either `hash_get_first' or `hash_get_next'.
|
||||
Return NULL if there is no more entries. */
|
||||
Return NULL if there are no more entries. */
|
||||
|
||||
void *
|
||||
hash_get_next (const Hash_table *table, const void *entry)
|
||||
@@ -284,7 +284,7 @@ hash_get_next (const Hash_table *table, const void *entry)
|
||||
return cursor->next->data;
|
||||
|
||||
/* Find first entry in any subsequent bucket. */
|
||||
for (; bucket < table->bucket_limit; bucket++)
|
||||
while (++bucket < table->bucket_limit)
|
||||
if (bucket->data)
|
||||
return bucket->data;
|
||||
|
||||
|
||||
@@ -148,10 +148,10 @@ void strip_trailing_slashes ();
|
||||
function creates DIR and to zero otherwise. Give a diagnostic and
|
||||
return non-zero if DIR cannot be created or cannot be determined to
|
||||
exist already. Use DIRPATH in any diagnostic, not DIR.
|
||||
Note that if DIR already exists, this function will return zero
|
||||
(indicating success) and will set *CREATED_DIR_P to zero. */
|
||||
Note that if DIR already exists, this function returns zero
|
||||
(indicating success) and sets *CREATED_DIR_P to zero. */
|
||||
|
||||
static int
|
||||
int
|
||||
make_dir (const char *dir, const char *dirpath, mode_t mode, int *created_dir_p)
|
||||
{
|
||||
int fail = 0;
|
||||
|
||||
@@ -14,3 +14,9 @@ make_path PARAMS ((const char *_argpath,
|
||||
gid_t _group,
|
||||
int _preserve_existing,
|
||||
const char *_verbose_fmt_string));
|
||||
|
||||
int
|
||||
make_dir PARAMS ((const char *dir,
|
||||
const char *dirpath,
|
||||
mode_t mode,
|
||||
int *created_dir_p));
|
||||
|
||||
11
lib/md5.c
11
lib/md5.c
@@ -304,19 +304,16 @@ md5_process_block (buffer, len, ctx)
|
||||
{ \
|
||||
a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
|
||||
++words; \
|
||||
CYCLIC (a, s); \
|
||||
a = rol (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* It is unfortunate that C does not provide an operator for
|
||||
cyclic rotation. Hope the C compiler is smart enough. */
|
||||
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
|
||||
|
||||
/* Before we start, one word to the strange constants.
|
||||
They are defined in RFC 1321 as
|
||||
|
||||
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
|
||||
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or
|
||||
perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}'
|
||||
*/
|
||||
|
||||
/* Round 1. */
|
||||
@@ -345,7 +342,7 @@ md5_process_block (buffer, len, ctx)
|
||||
do \
|
||||
{ \
|
||||
a += f (b, c, d) + correct_words[k] + T; \
|
||||
CYCLIC (a, s); \
|
||||
a = rol (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
31
lib/memchr.c
31
lib/memchr.c
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1993, 1997, 1999 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991,93,96,97,99,2000 Free Software Foundation, Inc.
|
||||
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
|
||||
with help from Dan Sahlin (dan@sics.se) and
|
||||
commentary by Jim Blandy (jimb@ai.mit.edu);
|
||||
@@ -34,11 +34,18 @@ USA. */
|
||||
# define __ptr_t char *
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
#if defined (_LIBC)
|
||||
#if defined _LIBC
|
||||
# include <string.h>
|
||||
# include <memcopy.h>
|
||||
#else
|
||||
# define reg_char char
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_LIMITS_H) || defined (_LIBC)
|
||||
#if HAVE_STDLIB_H || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H || defined _LIBC
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
@@ -49,21 +56,28 @@ USA. */
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#if HAVE_BP_SYM_H || defined _LIBC
|
||||
# include <bp-sym.h>
|
||||
#else
|
||||
# define BP_SYM(sym) sym
|
||||
#endif
|
||||
|
||||
#undef memchr
|
||||
#undef __memchr
|
||||
|
||||
/* Search no more than N bytes of S for C. */
|
||||
|
||||
__ptr_t
|
||||
memchr (s, c, n)
|
||||
__memchr (s, c_in, n)
|
||||
const __ptr_t s;
|
||||
int c;
|
||||
int c_in;
|
||||
size_t n;
|
||||
{
|
||||
const unsigned char *char_ptr;
|
||||
const unsigned long int *longword_ptr;
|
||||
unsigned long int longword, magic_bits, charmask;
|
||||
unsigned reg_char c;
|
||||
|
||||
c = (unsigned char) c;
|
||||
c = (unsigned char) c_in;
|
||||
|
||||
/* Handle the first few characters by reading one character at a time.
|
||||
Do this until CHAR_PTR is aligned on a longword boundary. */
|
||||
@@ -197,3 +211,6 @@ memchr (s, c, n)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef weak_alias
|
||||
weak_alias (__memchr, BP_SYM (memchr))
|
||||
#endif
|
||||
|
||||
@@ -49,6 +49,11 @@
|
||||
#ifdef _LIBC
|
||||
|
||||
# include <memcopy.h>
|
||||
# include <endian.h>
|
||||
|
||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define WORDS_BIGENDIAN
|
||||
# endif
|
||||
|
||||
#else /* Not in the GNU C library. */
|
||||
|
||||
|
||||
209
lib/memrchr.c
Normal file
209
lib/memrchr.c
Normal file
@@ -0,0 +1,209 @@
|
||||
/* memrchr -- find the last occurrence of a byte in a memory block
|
||||
Copyright (C) 1991, 93, 96, 97, 99, 2000 Free Software Foundation, Inc.
|
||||
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
|
||||
with help from Dan Sahlin (dan@sics.se) and
|
||||
commentary by Jim Blandy (jimb@ai.mit.edu);
|
||||
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
|
||||
and implemented by Roland McGrath (roland@ai.mit.edu).
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#undef __ptr_t
|
||||
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
# define __ptr_t void *
|
||||
#else /* Not C++ or ANSI C. */
|
||||
# define __ptr_t char *
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
#if defined (_LIBC)
|
||||
# include <string.h>
|
||||
# include <memcopy.h>
|
||||
#else
|
||||
# define reg_char char
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_LIMITS_H) || defined (_LIBC)
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#define LONG_MAX_32_BITS 2147483647
|
||||
|
||||
#ifndef LONG_MAX
|
||||
# define LONG_MAX LONG_MAX_32_BITS
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#undef __memrchr
|
||||
#undef memrchr
|
||||
|
||||
#ifndef weak_alias
|
||||
# define __memrchr memrchr
|
||||
#endif
|
||||
|
||||
/* Search no more than N bytes of S for C. */
|
||||
__ptr_t
|
||||
__memrchr (s, c_in, n)
|
||||
const __ptr_t s;
|
||||
int c_in;
|
||||
size_t n;
|
||||
{
|
||||
const unsigned char *char_ptr;
|
||||
const unsigned long int *longword_ptr;
|
||||
unsigned long int longword, magic_bits, charmask;
|
||||
unsigned reg_char c;
|
||||
|
||||
c = (unsigned char) c_in;
|
||||
|
||||
/* Handle the last few characters by reading one character at a time.
|
||||
Do this until CHAR_PTR is aligned on a longword boundary. */
|
||||
for (char_ptr = (const unsigned char *) s + n;
|
||||
n > 0 && ((unsigned long int) char_ptr
|
||||
& (sizeof (longword) - 1)) != 0;
|
||||
--n)
|
||||
if (*--char_ptr == c)
|
||||
return (__ptr_t) char_ptr;
|
||||
|
||||
/* All these elucidatory comments refer to 4-byte longwords,
|
||||
but the theory applies equally well to 8-byte longwords. */
|
||||
|
||||
longword_ptr = (unsigned long int *) char_ptr;
|
||||
|
||||
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
|
||||
the "holes." Note that there is a hole just to the left of
|
||||
each byte, with an extra at the end:
|
||||
|
||||
bits: 01111110 11111110 11111110 11111111
|
||||
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
|
||||
|
||||
The 1-bits make sure that carries propagate to the next 0-bit.
|
||||
The 0-bits provide holes for carries to fall into. */
|
||||
|
||||
if (sizeof (longword) != 4 && sizeof (longword) != 8)
|
||||
abort ();
|
||||
|
||||
#if LONG_MAX <= LONG_MAX_32_BITS
|
||||
magic_bits = 0x7efefeff;
|
||||
#else
|
||||
magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
|
||||
#endif
|
||||
|
||||
/* Set up a longword, each of whose bytes is C. */
|
||||
charmask = c | (c << 8);
|
||||
charmask |= charmask << 16;
|
||||
#if LONG_MAX > LONG_MAX_32_BITS
|
||||
charmask |= charmask << 32;
|
||||
#endif
|
||||
|
||||
/* Instead of the traditional loop which tests each character,
|
||||
we will test a longword at a time. The tricky part is testing
|
||||
if *any of the four* bytes in the longword in question are zero. */
|
||||
while (n >= sizeof (longword))
|
||||
{
|
||||
/* We tentatively exit the loop if adding MAGIC_BITS to
|
||||
LONGWORD fails to change any of the hole bits of LONGWORD.
|
||||
|
||||
1) Is this safe? Will it catch all the zero bytes?
|
||||
Suppose there is a byte with all zeros. Any carry bits
|
||||
propagating from its left will fall into the hole at its
|
||||
least significant bit and stop. Since there will be no
|
||||
carry from its most significant bit, the LSB of the
|
||||
byte to the left will be unchanged, and the zero will be
|
||||
detected.
|
||||
|
||||
2) Is this worthwhile? Will it ignore everything except
|
||||
zero bytes? Suppose every byte of LONGWORD has a bit set
|
||||
somewhere. There will be a carry into bit 8. If bit 8
|
||||
is set, this will carry into bit 16. If bit 8 is clear,
|
||||
one of bits 9-15 must be set, so there will be a carry
|
||||
into bit 16. Similarly, there will be a carry into bit
|
||||
24. If one of bits 24-30 is set, there will be a carry
|
||||
into bit 31, so all of the hole bits will be changed.
|
||||
|
||||
The one misfire occurs when bits 24-30 are clear and bit
|
||||
31 is set; in this case, the hole at bit 31 is not
|
||||
changed. If we had access to the processor carry flag,
|
||||
we could close this loophole by putting the fourth hole
|
||||
at bit 32!
|
||||
|
||||
So it ignores everything except 128's, when they're aligned
|
||||
properly.
|
||||
|
||||
3) But wait! Aren't we looking for C, not zero?
|
||||
Good point. So what we do is XOR LONGWORD with a longword,
|
||||
each of whose bytes is C. This turns each byte that is C
|
||||
into a zero. */
|
||||
|
||||
longword = *--longword_ptr ^ charmask;
|
||||
|
||||
/* Add MAGIC_BITS to LONGWORD. */
|
||||
if ((((longword + magic_bits)
|
||||
|
||||
/* Set those bits that were unchanged by the addition. */
|
||||
^ ~longword)
|
||||
|
||||
/* Look at only the hole bits. If any of the hole bits
|
||||
are unchanged, most likely one of the bytes was a
|
||||
zero. */
|
||||
& ~magic_bits) != 0)
|
||||
{
|
||||
/* Which of the bytes was C? If none of them were, it was
|
||||
a misfire; continue the search. */
|
||||
|
||||
const unsigned char *cp = (const unsigned char *) longword_ptr;
|
||||
|
||||
#if LONG_MAX > 2147483647
|
||||
if (cp[7] == c)
|
||||
return (__ptr_t) &cp[7];
|
||||
if (cp[6] == c)
|
||||
return (__ptr_t) &cp[6];
|
||||
if (cp[5] == c)
|
||||
return (__ptr_t) &cp[5];
|
||||
if (cp[4] == c)
|
||||
return (__ptr_t) &cp[4];
|
||||
#endif
|
||||
if (cp[3] == c)
|
||||
return (__ptr_t) &cp[3];
|
||||
if (cp[2] == c)
|
||||
return (__ptr_t) &cp[2];
|
||||
if (cp[1] == c)
|
||||
return (__ptr_t) &cp[1];
|
||||
if (cp[0] == c)
|
||||
return (__ptr_t) cp;
|
||||
}
|
||||
|
||||
n -= sizeof (longword);
|
||||
}
|
||||
|
||||
char_ptr = (const unsigned char *) longword_ptr;
|
||||
|
||||
while (n-- > 0)
|
||||
{
|
||||
if (*--char_ptr == c)
|
||||
return (__ptr_t) char_ptr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef weak_alias
|
||||
weak_alias (__memrchr, memrchr)
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/* modechange.c -- file mode manipulation
|
||||
Copyright (C) 1989, 1990, 1997-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 1990, 1997, 1998, 1999 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,5 +1,5 @@
|
||||
/* obstack.c - subroutines used implicitly by object stack macros
|
||||
Copyright (C) 1988-1994,96,97,98,1999, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-1994,96,97,98,99,2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
@@ -282,9 +282,10 @@ _obstack_newchunk (h, length)
|
||||
register long obj_size = h->next_free - h->object_base;
|
||||
register long i;
|
||||
long already;
|
||||
char *object_base;
|
||||
|
||||
/* Compute size for new chunk. */
|
||||
new_size = (obj_size + length) + (obj_size >> 3) + 100;
|
||||
new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100;
|
||||
if (new_size < h->chunk_size)
|
||||
new_size = h->chunk_size;
|
||||
|
||||
@@ -296,6 +297,11 @@ _obstack_newchunk (h, length)
|
||||
new_chunk->prev = old_chunk;
|
||||
new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
|
||||
|
||||
/* Compute an aligned object_base in the new chunk */
|
||||
object_base =
|
||||
__INT_TO_PTR ((__PTR_TO_INT (new_chunk->contents) + h->alignment_mask)
|
||||
& ~ (h->alignment_mask));
|
||||
|
||||
/* Move the existing object to the new chunk.
|
||||
Word at a time is fast and is safe if the object
|
||||
is sufficiently aligned. */
|
||||
@@ -303,7 +309,7 @@ _obstack_newchunk (h, length)
|
||||
{
|
||||
for (i = obj_size / sizeof (COPYING_UNIT) - 1;
|
||||
i >= 0; i--)
|
||||
((COPYING_UNIT *)new_chunk->contents)[i]
|
||||
((COPYING_UNIT *)object_base)[i]
|
||||
= ((COPYING_UNIT *)h->object_base)[i];
|
||||
/* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
|
||||
but that can cross a page boundary on a machine
|
||||
@@ -314,7 +320,7 @@ _obstack_newchunk (h, length)
|
||||
already = 0;
|
||||
/* Copy remaining bytes one by one. */
|
||||
for (i = already; i < obj_size; i++)
|
||||
new_chunk->contents[i] = h->object_base[i];
|
||||
object_base[i] = h->object_base[i];
|
||||
|
||||
/* If the object just copied was the only data in OLD_CHUNK,
|
||||
free that chunk and remove it from the chain.
|
||||
@@ -325,7 +331,7 @@ _obstack_newchunk (h, length)
|
||||
CALL_FREEFUN (h, old_chunk);
|
||||
}
|
||||
|
||||
h->object_base = new_chunk->contents;
|
||||
h->object_base = object_base;
|
||||
h->next_free = h->object_base + obj_size;
|
||||
/* The new chunk certainly contains no empty object yet. */
|
||||
h->maybe_empty_object = 0;
|
||||
@@ -451,7 +457,7 @@ _obstack_memory_used (h)
|
||||
|
||||
/* Define the error handler. */
|
||||
# ifndef _
|
||||
# ifdef HAVE_LIBINTL_H
|
||||
# if defined HAVE_LIBINTL_H || defined _LIBC
|
||||
# include <libintl.h>
|
||||
# ifndef _
|
||||
# define _(Str) gettext (Str)
|
||||
|
||||
12
lib/quote.h
12
lib/quote.h
@@ -1,4 +1,12 @@
|
||||
/* prototypes for quote.c */
|
||||
|
||||
char const *quote_n (int n, char const *name);
|
||||
char const *quote (char const *name);
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
char const *quote_n PARAMS ((int n, char const *name));
|
||||
char const *quote PARAMS ((char const *name));
|
||||
|
||||
@@ -89,6 +89,10 @@
|
||||
/* This is for other GNU distributions with internationalized messages. */
|
||||
#if HAVE_LIBINTL_H || defined _LIBC
|
||||
# include <libintl.h>
|
||||
# ifdef _LIBC
|
||||
# undef gettext
|
||||
# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
|
||||
# endif
|
||||
#else
|
||||
# define gettext(msgid) (msgid)
|
||||
#endif
|
||||
@@ -2724,7 +2728,10 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
if (c1 == 1)
|
||||
range_start = extra[idx];
|
||||
while (c1-- > 0)
|
||||
SET_LIST_BIT (extra[idx++]);
|
||||
{
|
||||
SET_LIST_BIT (extra[idx]);
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
had_char_class = false;
|
||||
|
||||
26
lib/regex.h
26
lib/regex.h
@@ -513,13 +513,31 @@ extern int re_exec _RE_ARGS ((const char *));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* GCC 2.95 and later have "__restrict"; C99 compilers have
|
||||
"restrict", and "configure" may have defined "restrict". */
|
||||
#ifndef __restrict
|
||||
# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
|
||||
# if defined restrict || 199901L <= __STDC_VERSION__
|
||||
# define __restrict restrict
|
||||
# else
|
||||
# define __restrict
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
/* For now unconditionally define __restrict_arr to expand to nothing.
|
||||
Ideally we would have a test for the compiler which allows defining
|
||||
it to restrict. */
|
||||
#define __restrict_arr
|
||||
|
||||
/* POSIX compatibility. */
|
||||
extern int regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern,
|
||||
extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
|
||||
const char *__restrict __pattern,
|
||||
int __cflags));
|
||||
|
||||
extern int regexec _RE_ARGS ((const regex_t *__preg,
|
||||
const char *__string, size_t __nmatch,
|
||||
regmatch_t __pmatch[], int __eflags));
|
||||
extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
|
||||
const char *__restrict __string, size_t __nmatch,
|
||||
regmatch_t __pmatch[__restrict_arr],
|
||||
int __eflags));
|
||||
|
||||
extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
|
||||
char *__errbuf, size_t __errbuf_size));
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifndef O_DIRECTORY
|
||||
# define O_DIRECTORY 0
|
||||
#endif
|
||||
|
||||
#include "save-cwd.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -67,7 +71,7 @@ save_cwd (struct saved_cwd *cwd)
|
||||
if (have_working_fchdir)
|
||||
{
|
||||
#if HAVE_FCHDIR
|
||||
cwd->desc = open (".", O_RDONLY);
|
||||
cwd->desc = open (".", O_RDONLY | O_DIRECTORY);
|
||||
if (cwd->desc < 0)
|
||||
{
|
||||
error (0, errno, "cannot open current directory");
|
||||
|
||||
@@ -457,8 +457,7 @@ static CHAR_T const month_name[][10] =
|
||||
return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument);
|
||||
}
|
||||
# undef my_strftime
|
||||
# define my_strftime(S, Maxsize, Format, Tp) \
|
||||
_strftime_copytm (S, Maxsize, Format, Tp)
|
||||
# define my_strftime _strftime_copytm
|
||||
#endif
|
||||
|
||||
|
||||
@@ -801,8 +800,10 @@ my_strftime (s, maxsize, format, tp ut_argument)
|
||||
subformat:
|
||||
{
|
||||
CHAR_T *old_start = p;
|
||||
size_t len = my_strftime (NULL, (size_t) -1, subfmt, tp);
|
||||
add (len, my_strftime (p, maxsize - i, subfmt, tp));
|
||||
size_t len = my_strftime (NULL, (size_t) -1, subfmt,
|
||||
tp ut_argument);
|
||||
add (len, my_strftime (p, maxsize - i, subfmt,
|
||||
tp ut_argument));
|
||||
|
||||
if (to_uppcase)
|
||||
while (old_start < p)
|
||||
|
||||
70
lib/tru-knlist-demo.c
Normal file
70
lib/tru-knlist-demo.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Derived from the example in the OSF1 knlist manpage.
|
||||
OSF1 spe154.testdrive.compaq.com V5.0 1094 alpha
|
||||
aka (w/my private hostname compaq-tru64-50a) */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <nlist.h>
|
||||
|
||||
#ifndef FD_CLOEXEC
|
||||
# define FD_CLOEXEC 1
|
||||
#endif
|
||||
|
||||
#ifndef LDAV_SYMBOL
|
||||
# define LDAV_SYMBOL "_avenrun"
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct nlist nl[2];
|
||||
int retval;
|
||||
long offset;
|
||||
|
||||
nl[0].n_name = LDAV_SYMBOL;
|
||||
nl[1].n_name = "";
|
||||
|
||||
/*******************************************************/
|
||||
/* Call the knlist routine */
|
||||
retval = knlist (nl);
|
||||
|
||||
/******************************************************/
|
||||
/* Display addresses if returned. Otherwise, display */
|
||||
/* the appropriate error message. */
|
||||
if (retval < 0)
|
||||
{
|
||||
printf ("No kernel symbol addresses returned.\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (nl[0].n_type == 0)
|
||||
{
|
||||
printf ("Unable to return address of symbol %s\n", nl[0].n_name);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
offset = nl[0].n_value;
|
||||
printf ("The address of symbol %s is %lx\n", nl[0].n_name, offset);
|
||||
|
||||
{
|
||||
double load_ave[3];
|
||||
int channel = open ("/dev/kmem", 0);
|
||||
if (channel < 0)
|
||||
{
|
||||
printf ("open failed\n");
|
||||
exit (1);
|
||||
}
|
||||
#ifdef FD_SETFD
|
||||
(void) fcntl (channel, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
|
||||
if (lseek (channel, offset, 0) == -1L
|
||||
|| read (channel, (char *) load_ave, sizeof (load_ave))
|
||||
!= sizeof (load_ave))
|
||||
{
|
||||
close (channel);
|
||||
}
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xalloc.h -- malloc with out-of-memory checking
|
||||
Copyright (C) 1990-1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990-1998, 1999, 2000 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
|
||||
|
||||
@@ -52,7 +52,7 @@ void free ();
|
||||
|
||||
char *xmalloc ();
|
||||
|
||||
/* lstat works different on Linux and Solaris systems. POSIX (see
|
||||
/* lstat works differently on Linux and Solaris systems. POSIX (see
|
||||
`pathname resolution' in the glossary) requires that programs like `ls'
|
||||
take into consideration the fact that FILE has a trailing slash when
|
||||
FILE is a symbolic link. On Linux systems, the lstat function already
|
||||
|
||||
24
m4/ChangeLog
24
m4/ChangeLog
@@ -1,3 +1,23 @@
|
||||
2000-11-04 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* regex.m4: Use the `m4_' prefix on `syscmd' and `m4_sysval'.
|
||||
|
||||
2000-10-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* fsusage.m4: s/AC_SHELL_IFELSE/AS_IFELSE/ to match autoconf renaming.
|
||||
* ls-mntd-fs.m4: Likewise
|
||||
|
||||
2000-10-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* prereq.m4 (jm_PREREQ): Add jm_PREREQ_MEMCHR.
|
||||
(jm_PREREQ_MEMCHR): New function.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* check-decl.m4 (jm_CHECK_DECLS): Also check for memrchr.
|
||||
* prereq.m4 (jm_PREREQ_DIRNAME): New macro.
|
||||
* jm-macros.m4 (AC_REPLACE_FUNCS): Add memrchr.
|
||||
|
||||
2000-09-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* getloadavg.m4 (AC_FUNC_GETLOADAVG): Restore the initial value of LIBS.
|
||||
@@ -38,8 +58,8 @@
|
||||
|
||||
2000-07-16 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* mbswidth.m4: New file.
|
||||
* prereq.m4 (jm_PREREQ): Call jm_PREREQ_MBSWIDTH.
|
||||
* mbswidth.m4: New file.
|
||||
* prereq.m4 (jm_PREREQ): Call jm_PREREQ_MBSWIDTH.
|
||||
|
||||
2000-07-14 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 15
|
||||
#serial 16
|
||||
|
||||
dnl This is just a wrapper function to encapsulate this kludge.
|
||||
dnl Putting it in a separate file like this helps share it between
|
||||
@@ -55,6 +55,7 @@ AC_DEFUN(jm_CHECK_DECLS,
|
||||
lseek,
|
||||
malloc,
|
||||
memchr,
|
||||
memrchr,
|
||||
nanosleep,
|
||||
realloc,
|
||||
stpcpy,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 3
|
||||
#serial 4
|
||||
|
||||
# From fileutils/configure.in
|
||||
|
||||
@@ -187,6 +187,6 @@ AC_TRY_CPP([#include <sys/filsys.h>],
|
||||
ac_fsusage_space=yes)
|
||||
fi
|
||||
|
||||
AC_SHELL_IFELSE([test $ac_fsusage_space = yes], [$1], [$2])dnl
|
||||
AS_IFELSE([test $ac_fsusage_space = yes], [$1], [$2])dnl
|
||||
|
||||
])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 25
|
||||
#serial 26
|
||||
|
||||
dnl Misc type-related macros for fileutils, sh-utils, textutils.
|
||||
|
||||
@@ -116,7 +116,7 @@ AC_DEFUN(jm_MACROS,
|
||||
dnl used by e.g. intl/*domain.c and lib/canon-host.c
|
||||
AC_REPLACE_FUNCS(strdup)
|
||||
|
||||
AC_REPLACE_FUNCS(memchr memmove memcpy memset)
|
||||
AC_REPLACE_FUNCS(memchr memcpy memmove memrchr memset)
|
||||
AC_CHECK_FUNCS(getpagesize)
|
||||
|
||||
# By default, argmatch should fail calling usage (1).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 5
|
||||
#serial 6
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
@@ -239,6 +239,6 @@ if test -z "$ac_list_mounted_fs"; then
|
||||
# Can't build mountlist.c or anything that needs its functions
|
||||
fi
|
||||
|
||||
AC_SHELL_IFELSE([test $ac_list_mounted_fs = found], [$1], [$2])dnl
|
||||
AS_IFELSE([test $ac_list_mounted_fs = found], [$1], [$2])dnl
|
||||
|
||||
])
|
||||
|
||||
21
m4/prereq.m4
21
m4/prereq.m4
@@ -1,4 +1,4 @@
|
||||
#serial 11
|
||||
#serial 13
|
||||
|
||||
dnl These are the prerequisite macros for files in the lib/
|
||||
dnl directories of the fileutils, sh-utils, and textutils packages.
|
||||
@@ -7,10 +7,12 @@ AC_DEFUN(jm_PREREQ,
|
||||
[
|
||||
jm_PREREQ_ADDEXT
|
||||
jm_PREREQ_CANON_HOST
|
||||
jm_PREREQ_DIRNAME
|
||||
jm_PREREQ_ERROR
|
||||
jm_PREREQ_GETPAGESIZE
|
||||
jm_PREREQ_HUMAN
|
||||
jm_PREREQ_MBSWIDTH
|
||||
jm_PREREQ_MEMCHR
|
||||
jm_PREREQ_QUOTEARG
|
||||
jm_PREREQ_READUTMP
|
||||
jm_PREREQ_REGEX
|
||||
@@ -39,6 +41,18 @@ AC_DEFUN(jm_PREREQ_CANON_HOST,
|
||||
netinet/in.h arpa/inet.h)
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_DIRNAME,
|
||||
[
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(string.h)
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_GETPAGESIZE,
|
||||
[
|
||||
AC_CHECK_FUNCS(getpagesize)
|
||||
AC_CHECK_HEADERS(OS.h unistd.h)
|
||||
])
|
||||
|
||||
# If you use human.c, you need the following files:
|
||||
# uintmax_t.m4 inttypes_h.m4 ulonglong.m4
|
||||
AC_DEFUN(jm_PREREQ_HUMAN,
|
||||
@@ -49,10 +63,9 @@ AC_DEFUN(jm_PREREQ_HUMAN,
|
||||
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_GETPAGESIZE,
|
||||
AC_DEFUN(jm_PREREQ_MEMCHR,
|
||||
[
|
||||
AC_CHECK_FUNCS(getpagesize)
|
||||
AC_CHECK_HEADERS(OS.h unistd.h)
|
||||
AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_QUOTEARG,
|
||||
|
||||
@@ -51,10 +51,9 @@ AC_DEFUN(jm_INCLUDED_REGEX,
|
||||
fi
|
||||
|
||||
test -n "$1" || AC_MSG_ERROR([missing argument])
|
||||
syscmd([test -f $1])
|
||||
ifelse(sysval, 0,
|
||||
m4_syscmd([test -f $1])
|
||||
ifelse(m4_sysval, 0,
|
||||
[
|
||||
|
||||
AC_ARG_WITH(included-regex,
|
||||
[ --without-included-regex don't compile regex; this is the default on
|
||||
systems with version 2 of the GNU C library
|
||||
|
||||
4
man/sha1sum.x
Normal file
4
man/sha1sum.x
Normal file
@@ -0,0 +1,4 @@
|
||||
[NAME]
|
||||
shasum \- compute and check SHA1 message digest
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
@@ -1,5 +1,244 @@
|
||||
2000-11-05 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.31.
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
* src/mkdir.c (main): Use make_dir instead of using mkdir directly.
|
||||
Diagnose as failure when mkdir tries to create (without the
|
||||
--parent (-p) option) a directory that already exists.
|
||||
* tests/cp/cp-parents: Add a test for the above fix.
|
||||
|
||||
* tests/mv/mv-special-1: Clean up this test.
|
||||
|
||||
2000-11-01 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.30.
|
||||
|
||||
* src/chmod.c (main): Better diagnostics.
|
||||
|
||||
2000-10-31 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/lang-default: Add all the internationalization-related
|
||||
variable names autoconf uses. Set and export them in a loop.
|
||||
|
||||
`mkdir -p' would create parent directories with permissions
|
||||
that did not account for the umask. [introduced with the
|
||||
2000-09-30 change that became part of fileutils-4.0.28]
|
||||
* src/mkdir.c: Include dirname.h.
|
||||
Compute the parent directory `mode' unconditionally, effectively
|
||||
as `$(umask -S),u+wx'.
|
||||
Use make_path to create only the parent directories, thus using
|
||||
the same code, both with and without -p, to create the final
|
||||
component in each file name. Reported by Bob Proulx.
|
||||
|
||||
Add tests for the above fix.
|
||||
* tests/cp/cp-parents: Add some permission tests.
|
||||
* tests/mkdir/perm: Fix the test so it actually does something.
|
||||
Run each test also with mkdir's `-p' option and check permissions
|
||||
on the parent directories.
|
||||
|
||||
2000-10-23 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* doc/getdate.texi: Use @sc where appropriate. Document the
|
||||
ranges of supported times more precisely. Correct menu
|
||||
spacing. Document old Latin 12m/12pm tradition. Remove list
|
||||
of alphabetic time zone names, as it wasn't correct and people
|
||||
shouldn't be relying on it anyway. Relative items also
|
||||
account for non-DST adjustments. Fix some misspellings.
|
||||
|
||||
2000-10-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
2000-10-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.29.
|
||||
|
||||
* src/cp.c (do_copy): When constructing dst_path for use with the
|
||||
--parents option, first remove any trailing slashes from the command
|
||||
line argument. Otherwise, tests/cp/cp-parent would fail on NetBSD.
|
||||
|
||||
* tests/cp/cp-parents: Add a test.
|
||||
|
||||
* src/ls.c (DT_INIT): Define.
|
||||
[enum filetype]: Remove the #ifdef, and use DT_INIT on the
|
||||
initializers instead. `unknown' was undefined for some systems.
|
||||
Reported by John David Anglin.
|
||||
|
||||
* tests/lang-default (LC_COLLATE): Set it to the empty string and
|
||||
export it. Otherwise, tests/cp/cp-mv-backup would fail e.g., when
|
||||
LC_COLLATE was set to en. Reported by Vin Shelton.
|
||||
|
||||
2000-10-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/ls.c (main): In call to gobble_file with `"."', use `directory'
|
||||
as the type, not `unknown'.
|
||||
[enum filetype] (arg_directory): Rather than `100', use
|
||||
a number that should never conflict with another DT_* value.
|
||||
From Ulrich Drepper.
|
||||
|
||||
* Version 4.0.28.
|
||||
|
||||
Make `ls' a lot more efficient on systems (e.g., linux-2.4.*)
|
||||
that store file type information in directory entries.
|
||||
|
||||
* src/ls.c [enum filetype] (unknown):
|
||||
Add members (as yet unused):
|
||||
(HAVE_STRUCT_DIRENT_D_TYPE): Define.
|
||||
(format_needs_type): New global.
|
||||
(main): Set it.
|
||||
(print_dir): Set `type' from directory entry, if possible.
|
||||
(gobble_file): Add a parameter, TYPE.
|
||||
Stat the file only if its type is unknown and we need the type.
|
||||
Patch from Ulrich Drepper.
|
||||
|
||||
Shred can now determine the size of a block devices (e.g. /dev/fd0)
|
||||
by writing until a write operation fails.
|
||||
|
||||
* src/shred.c: Include assert.h.
|
||||
(fillrand): Add a parameter, size_max.
|
||||
Adjust caller.
|
||||
Add an assertion.
|
||||
(dopass): Break out of the `for (;;)' loop if size < offset.
|
||||
That can happen now that dopass is called with SIZE == -1.
|
||||
(do_wipefd): Accept a length of zero only for a regular file.
|
||||
If lseek fails or returns 0 for a non-regular file, let dopass
|
||||
determine the length.
|
||||
Inspired by a patch from Alan Iwi.
|
||||
|
||||
* tests/Makefile.am (EXTRA_DIST): Add lang-default.
|
||||
|
||||
* tests/rm/hash: Factor out the expensive-test-checking code, ...
|
||||
* tests/expensive: ... into this new file.
|
||||
* tests/cp/perm: Disable this test by default; it's expensive.
|
||||
Mark this as an expensive test.
|
||||
* tests/Makefile.am (EXTRA_DIST): Add expensive.
|
||||
|
||||
* doc/fileutils.texi (shred invocation): Give two examples.
|
||||
|
||||
2000-10-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/getdate.texi (Authors of getdate): Add Paul Eggert.
|
||||
|
||||
2000-10-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add .prev-version.
|
||||
|
||||
2000-10-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/cp.c (make_path_private): Add a FIXME comment.
|
||||
|
||||
* tests/lang-default: New file. Set LANG, LC_ALL, and LANGUAGE to ''
|
||||
(rather than to `C') and export them into the environment.
|
||||
Suggestion from Bruno Haible.
|
||||
|
||||
* tests/cp/backup-is-src: Source lang-default rather than open-coding
|
||||
the setting/exporting of LANG, LC_ALL, and LANGUAGE.
|
||||
* tests/cp/cp-mv-backup: Likewise.
|
||||
* tests/cp/same-file: Likewise.
|
||||
* tests/cp/slink-2-slink: Likewise.
|
||||
* tests/cp/symlink-slash: Likewise.
|
||||
* tests/ln/sf-1: Likewise.
|
||||
* tests/ls/symlink-slash: Likewise.
|
||||
* tests/ls/time-1: Likewise.
|
||||
* tests/mv/backup-is-src: Likewise.
|
||||
* tests/mv/diag: Likewise.
|
||||
* tests/mv/force: Likewise.
|
||||
* tests/mv/hard-link-1: Likewise.
|
||||
* tests/mv/i-2: Likewise.
|
||||
* tests/mv/into-self: Likewise.
|
||||
* tests/mv/into-self-2: Likewise.
|
||||
* tests/mv/into-self-3: Likewise.
|
||||
* tests/mv/mv-special-1: Likewise.
|
||||
* tests/mv/part-symlink: Likewise.
|
||||
* tests/mv/partition-perm: Likewise.
|
||||
* tests/rm/r-1: Likewise.
|
||||
* tests/rm/r-2: Likewise.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/cp/cp-parents: New test.
|
||||
* tests/cp/Makefile.am (TESTS): Add cp-parents;
|
||||
|
||||
2000-10-19 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/texinfo.tex: Update from master repository.
|
||||
* config.sub: Likewise.
|
||||
* config.guess: Likewise.
|
||||
* depcomp: Likewise.
|
||||
|
||||
2000-10-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/mv/part-symlink: Make sure the programs use C-locale formats
|
||||
and translations. Bruno Haible reported that this test would fail
|
||||
when using other locales, because ls printed a translation of `total'.
|
||||
|
||||
2000-10-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/ls.c (print_long_format): Wrap date format strings in _(...)
|
||||
so they may be internationalized. Suggestion from Christian Rose.
|
||||
|
||||
2000-10-13 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/mv.c (rm_option_init): Remove FIXME-maybe comment.
|
||||
|
||||
2000-09-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/du/two-args: Update to use newer template.
|
||||
|
||||
* src/install.c: Remove big, option-describing comment block.
|
||||
(main): Rename local `symbolic_mode' to `specified_mode'.
|
||||
|
||||
* src/mkdir.c (main): Don't set the umask to 0 and hand-apply
|
||||
the previously-set umask unconditionally. Do that only when a
|
||||
MODE has been specified. Otherwise, call mkdir with the full
|
||||
creation mask (0777 or 0666) and let the kernel apply the umask.
|
||||
The difference shows up only on file systems with ACL support
|
||||
when the containing directory has a default ACL.
|
||||
Patch by Andreas Gruenbacher.
|
||||
(main): Rename local `symbolic_mode' to `specified_mode'.
|
||||
* src/mknod.c (main): Likewise (but `call mknod', not mkdir).
|
||||
Also, when MODE is specified, call chmod to ensure that the
|
||||
permission bits are set as specified even when the containing
|
||||
directory has a default ACL.
|
||||
Patch by Andreas Gruenbacher.
|
||||
* src/mkfifo.c (main): Likewise (but `call mkfifo', not mkdir).
|
||||
Patch by Andreas Gruenbacher.
|
||||
|
||||
* tests/mkdir/perm: New test.
|
||||
* tests/mkdir/Makefile.am (TESTS): Add perm.
|
||||
|
||||
2000-08-17 Andreas Gruenbacher <ag@bestbits.at>
|
||||
|
||||
* src/chmod.c (change_file_mode): Perform the chmod even if the
|
||||
file mode permission bits are the same as those that should be set.
|
||||
Omitting the chmod call would be alright with minimal 1003.1e DS17
|
||||
ACLs, but eventually there may be other permissions in addition to
|
||||
rwx. E.g., add and delete for directories, and something analogous
|
||||
to NT's take ownership permission.
|
||||
|
||||
2000-09-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/cp/same-file: Don't use `diff -u'. It's not portable.
|
||||
Reported by Christian Krackowizer.
|
||||
* tests/cp/same-file: Run `diff -c' only if cmp finds a difference.
|
||||
* tests/mv/part-symlink: Likewise. And clean up.
|
||||
|
||||
`shred --exact file1 file2' wouldn't touch `file1'
|
||||
* src/shred.c (long_opts): --exact doesn't take an argument.
|
||||
Reported by Alan Iwi.
|
||||
* tests/shred/exact: New test for this.
|
||||
* tests/shred/Makefile.am (TESTS): Add exact.
|
||||
|
||||
* Makefile.maint (PREV_VERSION): Get the value from a file, rather
|
||||
than trying to derive it from the current version number.
|
||||
This is much more robust.
|
||||
(alpha): Record just-released version number in `.prev-version',
|
||||
and commit (post-tag).
|
||||
|
||||
* Version 4.0.27.
|
||||
|
||||
2000-09-24 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
Changes in release 4.01:
|
||||
[4.0.31]
|
||||
* mkdir: fix a bug introduced in 4.0.30 whereby `mkdir existing-dir' would
|
||||
succeed. Now it fails, as it should (and used to).
|
||||
[4.0.30]
|
||||
* mkdir: fix a bug introduced in 4.0.28 whereby parent directories created
|
||||
via `mkdir -p' would have permissions that did not account for the umask
|
||||
[4.0.29]
|
||||
* ls.c wouldn't compile on some systems: fix it
|
||||
* `cp -R --parents dir1/ dir2' failed on NetBSD, due to a portability problem
|
||||
[4.0.28]
|
||||
* ls is much more efficient on systems (e.g., linux-2.4.*) that store file
|
||||
type information in directory entries.
|
||||
* shred now automatically determines the size of each block device argument
|
||||
* ls's date/time format strings are now local dependent
|
||||
* mkdir, mknod, mkfifo, and chmod work better in conjunction with ACLs
|
||||
* `cp --parents dir1/ dir2' no longer gets a failed assertion
|
||||
* shred now determines the size of block devices like /dev/fd0
|
||||
* `shred --exact file1 file2' now erases `file1', too
|
||||
[4.0.27]
|
||||
* install once again unlinks an existing destination before trying to open it
|
||||
* mv no longer gets a failed assertion when moving a directory (specified with
|
||||
|
||||
@@ -1,3 +1,66 @@
|
||||
2000-10-31 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/sh-utils.texi: Clean up indentation and punctuation.
|
||||
Fix a couple typos. From Brian Youmans.
|
||||
|
||||
2000-10-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
2000-10-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 2.0.11.
|
||||
|
||||
2000-10-27 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/date.c (usage): Mention the time zone, UTC, and write the date
|
||||
in ISO format in the description of %s. Suggestion from Karl Berry.
|
||||
|
||||
2000-10-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/dirname.c: Include dirname.h.
|
||||
(main): Use dir_name_r rather than open-coding it.
|
||||
|
||||
2000-10-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add .prev-version.
|
||||
|
||||
2000-10-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/date.c (universal_time): Remove; it's just a temptation to
|
||||
do the wrong thing.
|
||||
(main): The -u option now just sets TZ; it doesn't do anything else.
|
||||
(show_date): Do not do anything special if -u is set.
|
||||
This affects the behavior of the -I and -R options.
|
||||
* doc/sh-utils.texi: Document the above.
|
||||
|
||||
2000-10-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/sh-utils.texi (Examples of date): Fix a typo.
|
||||
|
||||
2000-10-11 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/sh-utils.texi (Time directives) [%S]: Range is 0..60, not 0..61.
|
||||
|
||||
2000-10-06 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Undo the effect of the 1997-07-12 change to date.c; it
|
||||
broke "date -u MMDDhhmm" and it wasn't documented.
|
||||
This reverts to the behavior of the 1996-01-03 patch.
|
||||
|
||||
* src/date.c (TZ_UTC0, MAYBE_SET_TZ_UTC0, set_tz): Remove.
|
||||
(batch_convert): Don't futz with TZ.
|
||||
(main): -u now parses all dates as UTC, not just some.
|
||||
Reported by Karl-Michael Schneider.
|
||||
* tests/date/Test.pm (utc-0, utc-1, relative-2): Adjust to
|
||||
above change.
|
||||
|
||||
2000-09-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/yes.c (usage): Add a separate usage line, just for `OPTION'.
|
||||
Suggestion from M. P. Suzuki.
|
||||
|
||||
2000-09-09 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/date.c (usage): Make the second `Usage' line more precise
|
||||
@@ -441,8 +504,8 @@
|
||||
|
||||
2000-01-21 Bruno Haible <haible@linuix.math.u-bordeaux.fr>
|
||||
|
||||
Add support for octal and hexadecimal output.
|
||||
* seq.c (intconv): New variable.
|
||||
Add support for octal and hexadecimal output.
|
||||
* seq.c (intconv): New variable.
|
||||
(usage): Update.
|
||||
(main): Call scan_arg instead of scan_double_arg. Call check_format
|
||||
before scan_arg.
|
||||
@@ -1803,8 +1866,8 @@
|
||||
1997-08-31 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/who.c (main): New option --lookup (-l).
|
||||
(print_entry): Only call canon_host if user explicitly asks for it.
|
||||
(usage): Describe --lookup.
|
||||
(print_entry): Only call canon_host if user explicitly asks for it.
|
||||
(usage): Describe --lookup.
|
||||
From Galen Hazelwood.
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add Spanish (es).
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
Changes in release 2.1
|
||||
[2.0k]
|
||||
[2.0.11]
|
||||
* setting the date now works properly, even when using -u
|
||||
* `date -f - < /dev/null' no longer dumps core
|
||||
* some DOS/Windows portability changes
|
||||
[2.0j]
|
||||
* `date -d DATE' now parses certain relative DATEs correctly
|
||||
[2.0i]
|
||||
|
||||
@@ -1,3 +1,77 @@
|
||||
2000-11-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/sha1sum/sample-vec: New file, with tests derived from
|
||||
http://csrc.nist.gov/cryptval/shs/sha1-vectors.zip
|
||||
* tests/sha1sum/Makefile.am (TESTS): Add sample-vec.
|
||||
|
||||
2000-10-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
* src/wc.c: Include "system.h" after wctype.h (not before)
|
||||
to avoid a compilation error on Solaris 5.5.1 systems.
|
||||
Reported by Vin Shelton.
|
||||
|
||||
2000-10-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Makefile.maint: Clean up version-related variables.
|
||||
|
||||
* Version 2.0.8.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add .prev-version.
|
||||
|
||||
2000-10-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/Makefile.am (SUBDIRS): Add sha1sum.
|
||||
* tests/sha1sum/basic-1: New file.
|
||||
* configure.in (AC_OUTPUT): Add tests/sha1sum/Makefile.
|
||||
|
||||
* src/Makefile.am (bin_PROGRAMS): Add sha1sum.
|
||||
(md5sum_SOURCES): Define.
|
||||
(sha1sum_SOURCES): Define.
|
||||
(noinst_HEADERS): Add checksum.h.
|
||||
|
||||
* src/md5sum.c: Factor out the differences between MD5 and SHA1,
|
||||
and parameterize so this code may be used by both md5sum and the new
|
||||
program, sha1sum. Loosely based on a patch from Scott Miller.
|
||||
* src/checksum.h: New file.
|
||||
* src/md5.c: New file that simply defines `algorithm'.
|
||||
* src/sha1sum.c: Likewise.
|
||||
|
||||
* man/Makefile.am (man_MANS): Add sha1sum.1.
|
||||
* man/sha1sum.x: New file.
|
||||
|
||||
Support 8-byte integers, assuming they're printable with e.g., %lld.
|
||||
* src/od.c: Add support for printing data as unsigned
|
||||
long long integers.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
The command, `yes ''|./cat -n' would stop printing after INT_MAX lines.
|
||||
* src/cat.c (cat): Never let `newlines' exceed 3.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
Prevent a counter buffer overrun when numbering lines and when
|
||||
processing 100 billion lines (or more) of input.
|
||||
* src/cat.c (LINE_COUNTER_BUF_LEN): Define to allow numbering as
|
||||
many as 10^18 - 1 lines (the old limit was 10^11 - 1, and could
|
||||
be exceeded without too much trouble). Use this symbol rather
|
||||
than hard-coding the constant everywhere.
|
||||
(next_line_num): Rather than overrunning for input with more lines,
|
||||
mark the line number by putting a `>' in the leftmost slot.
|
||||
Patch by Jan Nieuwenhuizen.
|
||||
|
||||
* src/sort.c (SORT_OUT_OF_ORDER): Define.
|
||||
(main): Use it instead of hard-coding the `1'.
|
||||
|
||||
2000-10-10 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/sort.c (main): Use EXIT_SUCCESS rather than 0.
|
||||
Fail when checking (-c) with more than one file argument,
|
||||
rather than simply ignoring the extra arguments.
|
||||
|
||||
2000-09-07 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/cut.c: Remove obsolete comment block.
|
||||
@@ -84,7 +158,7 @@
|
||||
|
||||
2000-08-06 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/sort.c (usage): Warn more succintly about the effects of
|
||||
* src/sort.c (usage): Warn more succinctly about the effects of
|
||||
the locale on sort order.
|
||||
|
||||
2000-08-06 Jim Meyering <meyering@lucent.com>
|
||||
@@ -2160,8 +2234,8 @@
|
||||
|
||||
1998-02-16 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* configure.in (jm_FUNC_LSTAT): Use it.
|
||||
(jm_FUNC_STAT): Use it.
|
||||
* configure.in (jm_FUNC_LSTAT): Use it.
|
||||
(jm_FUNC_STAT): Use it.
|
||||
* lib/Makefile.am (EXTRA_DIST): Add lstat.c and stat.c.
|
||||
|
||||
1998-02-06 Jim Meyering <meyering@eng.ascend.com>
|
||||
@@ -2190,8 +2264,8 @@
|
||||
|
||||
1998-01-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* configure.in (AC_LFS): Put before anything that can affect or use
|
||||
CPPFLAGS, LDFLAGS, or LIBS.
|
||||
* configure.in (AC_LFS): Put before anything that can affect or use
|
||||
CPPFLAGS, LDFLAGS, or LIBS.
|
||||
|
||||
1998-01-25 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
Changes in release 2.1
|
||||
[2.0h]
|
||||
[2.0.8]
|
||||
* od now supports 8-byte integers, assuming they're printable with e.g., %lld
|
||||
* new program: sha1sum
|
||||
* wc accepts new -m option: count (potentially multi-byte) characters
|
||||
* wc's `--chars' option is now equivalent to -m, not --bytes as it used to be
|
||||
* `cat -n' works properly when processing 2^31 or more lines
|
||||
[2.0g]
|
||||
* sort's --help output now warns that it is locale-aware
|
||||
* tail: fix a buffer underrun error that occurred on an empty pipe,
|
||||
|
||||
56
src/cat.c
56
src/cat.c
@@ -55,19 +55,26 @@ static char *infile;
|
||||
/* Descriptor on which input file is open. */
|
||||
static int input_desc;
|
||||
|
||||
/* Buffer for line numbers. */
|
||||
static char line_buf[13] =
|
||||
{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0', '\t', '\0'};
|
||||
/* Buffer for line numbers.
|
||||
An 11 digit counter may overflow within an hour on a P2/466,
|
||||
an 18 digit counter needs about 1000y */
|
||||
#define LINE_COUNTER_BUF_LEN 20
|
||||
static char line_buf[LINE_COUNTER_BUF_LEN] =
|
||||
{
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0',
|
||||
'\t', '\0'
|
||||
};
|
||||
|
||||
/* Position in `line_buf' where printing starts. This will not change
|
||||
unless the number of lines is larger than 999999. */
|
||||
static char *line_num_print = line_buf + 5;
|
||||
static char *line_num_print = line_buf + LINE_COUNTER_BUF_LEN - 8;
|
||||
|
||||
/* Position of the first digit in `line_buf'. */
|
||||
static char *line_num_start = line_buf + 10;
|
||||
static char *line_num_start = line_buf + LINE_COUNTER_BUF_LEN - 3;
|
||||
|
||||
/* Position of the last digit in `line_buf'. */
|
||||
static char *line_num_end = line_buf + 10;
|
||||
static char *line_num_end = line_buf + LINE_COUNTER_BUF_LEN - 3;
|
||||
|
||||
/* Preserves the `cat' function's local `newlines' between invocations. */
|
||||
static int newlines2 = 0;
|
||||
@@ -129,7 +136,10 @@ next_line_num (void)
|
||||
*endp-- = '0';
|
||||
}
|
||||
while (endp >= line_num_start);
|
||||
*--line_num_start = '1';
|
||||
if (line_num_start > line_buf)
|
||||
*--line_num_start = '1';
|
||||
else
|
||||
*line_buf = '>';
|
||||
if (line_num_start < line_num_print)
|
||||
line_num_print--;
|
||||
}
|
||||
@@ -340,13 +350,21 @@ cat (
|
||||
|
||||
if (++newlines > 0)
|
||||
{
|
||||
/* Are multiple adjacent empty lines to be substituted by
|
||||
single ditto (-s), and this was the second empty line? */
|
||||
|
||||
if (squeeze_empty_lines && newlines >= 2)
|
||||
if (newlines >= 2)
|
||||
{
|
||||
ch = *bpin++;
|
||||
continue;
|
||||
/* Limit this to 2 here. Otherwise, with lots of
|
||||
consecutive newlines, the counter could wrap
|
||||
around at INT_MAX. */
|
||||
newlines = 2;
|
||||
|
||||
/* Are multiple adjacent empty lines to be substituted
|
||||
by single ditto (-s), and this was the second empty
|
||||
line? */
|
||||
if (squeeze_empty_lines)
|
||||
{
|
||||
ch = *bpin++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Are line numbers to be written at empty lines (-n)? */
|
||||
@@ -775,8 +793,8 @@ main (int argc, char **argv)
|
||||
{
|
||||
inbuf = (unsigned char *) xmalloc (insize + 1);
|
||||
|
||||
/* Why are (OUTSIZE - 1 + INSIZE * 4 + 13) bytes allocated for
|
||||
the output buffer?
|
||||
/* Why are (OUTSIZE - 1 + INSIZE * 4 + LINE_COUNTER_BUF_LEN)
|
||||
bytes allocated for the output buffer?
|
||||
|
||||
A test whether output needs to be written is done when the input
|
||||
buffer empties or when a newline appears in the input. After
|
||||
@@ -788,10 +806,12 @@ main (int argc, char **argv)
|
||||
If the last character in the preceding block of input was a
|
||||
newline, a line number may be written (according to the given
|
||||
options) as the first thing in the output buffer. (Done after the
|
||||
new input is read, but before processing of the input begins.) A
|
||||
line number requires seldom more than 13 positions. */
|
||||
new input is read, but before processing of the input begins.)
|
||||
A line number requires seldom more than LINE_COUNTER_BUF_LEN
|
||||
positions. */
|
||||
|
||||
outbuf = (unsigned char *) xmalloc (outsize - 1 + insize * 4 + 13);
|
||||
outbuf = (unsigned char *) xmalloc (outsize - 1 + insize * 4
|
||||
+ LINE_COUNTER_BUF_LEN);
|
||||
|
||||
cat (inbuf, insize, outbuf, outsize, quote,
|
||||
output_tabs, numbers, numbers_at_empty_lines, mark_line_ends,
|
||||
|
||||
16
src/checksum.h
Normal file
16
src/checksum.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include "system.h"
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
ALG_UNSPECIFIED = 0,
|
||||
ALG_MD5 = CHAR_MAX + 1,
|
||||
ALG_SHA1
|
||||
};
|
||||
|
||||
extern int algorithm;
|
||||
38
src/chmod.c
38
src/chmod.c
@@ -137,6 +137,8 @@ change_file_mode (const char *file, const struct mode_change *changes,
|
||||
struct stat file_stats;
|
||||
mode_t newmode;
|
||||
int errors = 0;
|
||||
int fail;
|
||||
int saved_errno;
|
||||
|
||||
if (lstat (file, &file_stats))
|
||||
{
|
||||
@@ -161,24 +163,19 @@ change_file_mode (const char *file, const struct mode_change *changes,
|
||||
|
||||
newmode = mode_adjust (file_stats.st_mode, changes);
|
||||
|
||||
if (newmode != (file_stats.st_mode & CHMOD_MODE_BITS))
|
||||
fail = chmod (file, newmode);
|
||||
saved_errno = errno;
|
||||
|
||||
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
|
||||
describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
|
||||
|
||||
if (fail)
|
||||
{
|
||||
int fail = chmod (file, newmode);
|
||||
int saved_errno = errno;
|
||||
|
||||
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
|
||||
describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
|
||||
|
||||
if (fail)
|
||||
{
|
||||
if (force_silent == 0)
|
||||
error (0, saved_errno, _("changing permissions of %s"),
|
||||
quote (file));
|
||||
errors = 1;
|
||||
}
|
||||
if (force_silent == 0)
|
||||
error (0, saved_errno, _("changing permissions of %s"),
|
||||
quote (file));
|
||||
errors = 1;
|
||||
}
|
||||
else if (verbosity == V_high)
|
||||
describe_change (file, newmode, CH_NO_CHANGE_REQUESTED);
|
||||
|
||||
if (recurse && S_ISDIR (file_stats.st_mode))
|
||||
errors |= change_dir_mode (file, changes, &file_stats);
|
||||
@@ -313,7 +310,12 @@ main (int argc, char **argv)
|
||||
case '-':
|
||||
case '=':
|
||||
if (modeind != 0 && modeind != thisind)
|
||||
error (1, 0, _("invalid mode"));
|
||||
{
|
||||
static char char_string[2] = {0, 0};
|
||||
char_string[0] = c;
|
||||
error (1, 0, _("invalid character %s in mode string %s"),
|
||||
quote_n (0, char_string), quote_n (1, argv[thisind]));
|
||||
}
|
||||
modeind = thisind;
|
||||
break;
|
||||
case REFERENCE_FILE_OPTION:
|
||||
@@ -351,7 +353,7 @@ main (int argc, char **argv)
|
||||
: mode_compile (argv[modeind], MODE_MASK_ALL));
|
||||
|
||||
if (changes == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode"));
|
||||
error (1, 0, _("invalid mode string: %s"), quote (argv[modeind]));
|
||||
else if (changes == MODE_MEMORY_EXHAUSTED)
|
||||
xalloc_die ();
|
||||
else if (changes == MODE_BAD_REFERENCE)
|
||||
|
||||
19
src/cp.c
19
src/cp.c
@@ -330,6 +330,8 @@ re_protect (const char *const_dst_path, int src_offset,
|
||||
Return 0 if parent of CONST_DIRPATH exists as a directory with the proper
|
||||
permissions when done, otherwise 1. */
|
||||
|
||||
/* FIXME: find a way to synch this function with the one in lib/makepath.c. */
|
||||
|
||||
static int
|
||||
make_path_private (const char *const_dirpath, int src_offset, int mode,
|
||||
const char *verbose_fmt_string, struct dir_attr **attr_list,
|
||||
@@ -516,13 +518,26 @@ do_copy (int n_files, char **file, const char *target_directory,
|
||||
char *arg_in_concat = NULL;
|
||||
char *arg = file[i];
|
||||
|
||||
/* Trailing slashes are meaningful (i.e., maybe worth preserving)
|
||||
only in the source file names. */
|
||||
if (remove_trailing_slashes)
|
||||
strip_trailing_slashes (arg);
|
||||
|
||||
if (flag_path)
|
||||
{
|
||||
/* Append all of `arg' to `dest'. */
|
||||
dst_path = path_concat (dest, arg, &arg_in_concat);
|
||||
char *arg_no_trailing_slash;
|
||||
|
||||
/* Use `arg' without trailing slashes in constructing destination
|
||||
file names. Otherwise, we can end up trying to create a
|
||||
directory via `mkdir ("dst/foo/"...', which is not portable.
|
||||
It fails, due to the trailing slash, on at least
|
||||
NetBSD 1.[34] systems. */
|
||||
ASSIGN_STRDUPA (arg_no_trailing_slash, arg);
|
||||
strip_trailing_slashes (arg_no_trailing_slash);
|
||||
|
||||
/* Append all of `arg' (minus any trailing slash) to `dest'. */
|
||||
dst_path = path_concat (dest, arg_no_trailing_slash,
|
||||
&arg_in_concat);
|
||||
if (dst_path == NULL)
|
||||
xalloc_die ();
|
||||
|
||||
|
||||
79
src/date.c
79
src/date.c
@@ -79,9 +79,6 @@ static int iso_8601_format = 0;
|
||||
/* If non-zero, display time in RFC-822 format for mail or news. */
|
||||
static int rfc_format = 0;
|
||||
|
||||
/* If nonzero, print or set Coordinated Universal Time. */
|
||||
static int universal_time = 0;
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"date", required_argument, NULL, 'd'},
|
||||
@@ -98,17 +95,12 @@ static struct option const long_options[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
#define TZ_UTC0 "TZ=UTC0"
|
||||
|
||||
#if LOCALTIME_CACHE
|
||||
# define TZSET tzset ()
|
||||
#else
|
||||
# define TZSET /* empty */
|
||||
#endif
|
||||
|
||||
#define MAYBE_SET_TZ_UTC0 \
|
||||
do { if (universal_time) set_tz (TZ_UTC0); } while (0)
|
||||
|
||||
#ifdef _DATE_FMT
|
||||
# define DATE_FMT_LANGINFO() nl_langinfo (_DATE_FMT)
|
||||
#else
|
||||
@@ -169,7 +161,7 @@ specifies Coordinated Universal Time. Interpreted sequences are:\n\
|
||||
%%n a newline\n\
|
||||
%%p locale's AM or PM\n\
|
||||
%%r time, 12-hour (hh:mm:ss [AP]M)\n\
|
||||
%%s seconds since 00:00:00, Jan 1, 1970 (a GNU extension)\n\
|
||||
%%s seconds since `00:00:00 1970-01-01 UTC' (a GNU extension)\n\
|
||||
%%S second (00..60)\n\
|
||||
%%t a horizontal tab\n\
|
||||
%%T time, 24-hour (hh:mm:ss)\n\
|
||||
@@ -195,16 +187,6 @@ the following modifiers between `%%' and a numeric directive.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
/* Set the TZ environment variable. */
|
||||
|
||||
static void
|
||||
set_tz (const char *tz_eq_zone)
|
||||
{
|
||||
if (putenv (tz_eq_zone) != 0)
|
||||
error (1, 0, "memory exhausted");
|
||||
TZSET;
|
||||
}
|
||||
|
||||
/* Parse each line in INPUT_FILENAME as with --date and display each
|
||||
resulting time and date. If the file cannot be opened, tell why
|
||||
then exit. Issue a diagnostic for any lines that cannot be parsed.
|
||||
@@ -219,7 +201,6 @@ batch_convert (const char *input_filename, const char *format)
|
||||
int line_length;
|
||||
size_t buflen;
|
||||
time_t when;
|
||||
char *initial_TZ IF_LINT (= NULL);
|
||||
|
||||
if (strcmp (input_filename, "-") == 0)
|
||||
{
|
||||
@@ -237,23 +218,6 @@ batch_convert (const char *input_filename, const char *format)
|
||||
|
||||
line = NULL;
|
||||
buflen = 0;
|
||||
|
||||
if (universal_time)
|
||||
{
|
||||
initial_TZ = getenv ("TZ");
|
||||
if (initial_TZ == NULL)
|
||||
{
|
||||
initial_TZ = xstrdup ("TZ=");
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t tz_len = strlen (initial_TZ);
|
||||
char *buf = xmalloc (3 + tz_len + 1);
|
||||
memcpy (mempcpy (buf, "TZ=", 3), initial_TZ, tz_len + 1);
|
||||
initial_TZ = buf;
|
||||
}
|
||||
}
|
||||
|
||||
status = 0;
|
||||
while (1)
|
||||
{
|
||||
@@ -264,13 +228,6 @@ batch_convert (const char *input_filename, const char *format)
|
||||
break;
|
||||
}
|
||||
|
||||
if (universal_time)
|
||||
{
|
||||
/* When given a universal time option, restore the initial
|
||||
value of TZ before parsing each string. */
|
||||
set_tz (initial_TZ);
|
||||
}
|
||||
|
||||
when = get_date (line, NULL);
|
||||
|
||||
if (when == -1)
|
||||
@@ -282,14 +239,10 @@ batch_convert (const char *input_filename, const char *format)
|
||||
}
|
||||
else
|
||||
{
|
||||
MAYBE_SET_TZ_UTC0;
|
||||
show_date (format, when);
|
||||
}
|
||||
}
|
||||
|
||||
if (universal_time)
|
||||
free (initial_TZ);
|
||||
|
||||
if (fclose (in_stream) == EOF)
|
||||
error (2, errno, "`%s'", input_filename);
|
||||
|
||||
@@ -352,7 +305,12 @@ main (int argc, char **argv)
|
||||
set_date = 1;
|
||||
break;
|
||||
case 'u':
|
||||
universal_time = 1;
|
||||
/* POSIX.2 says that `date -u' is equivalent to setting the TZ
|
||||
environment variable, so this option should do nothing other
|
||||
than setting TZ. */
|
||||
if (putenv ("TZ=UTC0") != 0)
|
||||
xalloc_die ();
|
||||
TZSET;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
@@ -460,10 +418,6 @@ argument must be a format string beginning with `+'."),
|
||||
}
|
||||
}
|
||||
|
||||
/* When given a universal time option, set TZ to UTC0 after
|
||||
parsing the specified date, but before printing it. */
|
||||
MAYBE_SET_TZ_UTC0;
|
||||
|
||||
show_date (format, when);
|
||||
}
|
||||
|
||||
@@ -480,14 +434,13 @@ show_date (const char *format, time_t when)
|
||||
struct tm *tm;
|
||||
char *out = NULL;
|
||||
size_t out_length = 0;
|
||||
/* ISO 8601 formats, in local and UTC. See below regarding %z */
|
||||
static char *iso_format_string[5][2] =
|
||||
/* ISO 8601 formats. See below regarding %z */
|
||||
static char const * const iso_format_string[] =
|
||||
{
|
||||
{"", ""},
|
||||
{"%Y-%m-%d", "%Y-%m-%d"},
|
||||
{"%Y-%m-%dT%H%z", "%Y-%m-%dT%HZ"},
|
||||
{"%Y-%m-%dT%H:%M%z", "%Y-%m-%dT%H:%MZ"},
|
||||
{"%Y-%m-%dT%H:%M:%S%z", "%Y-%m-%dT%H:%M:%SZ"}
|
||||
"%Y-%m-%d",
|
||||
"%Y-%m-%dT%H%z",
|
||||
"%Y-%m-%dT%H:%M%z",
|
||||
"%Y-%m-%dT%H:%M:%S%z"
|
||||
};
|
||||
|
||||
tm = localtime (&when);
|
||||
@@ -502,11 +455,9 @@ show_date (const char *format, time_t when)
|
||||
RFC time format outside the continental United States and GMT. */
|
||||
|
||||
if (rfc_format)
|
||||
format = (universal_time
|
||||
? "%a, %_d %b %Y %H:%M:%S GMT"
|
||||
: "%a, %_d %b %Y %H:%M:%S %z");
|
||||
format = "%a, %_d %b %Y %H:%M:%S %z";
|
||||
else if (iso_8601_format)
|
||||
format = iso_format_string[iso_8601_format][universal_time];
|
||||
format = iso_format_string[iso_8601_format - 1];
|
||||
else
|
||||
{
|
||||
char *date_fmt = DATE_FMT_LANGINFO ();
|
||||
|
||||
2
src/dd.c
2
src/dd.c
@@ -734,7 +734,7 @@ buggy_lseek_support (int fdesc)
|
||||
on some special files but doesn't return an error, either.
|
||||
In particular, the Linux tape drivers are a problem.
|
||||
For example, when I did the following using dd-4.0y or earlier on a
|
||||
Linux-2.2.17 system with a Exabyte SCSI tape drive:
|
||||
Linux-2.2.17 system with an Exabyte SCSI tape drive:
|
||||
|
||||
dev=/dev/nst0
|
||||
reset='mt -f $dev rewind; mt -f $dev fsf 1'
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "system.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
#include "dirname.h"
|
||||
#include "closeout.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
@@ -64,8 +65,8 @@ output `.' (meaning the current directory).\n\
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
register char *path;
|
||||
register char *slash;
|
||||
const char *result;
|
||||
size_t len;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
@@ -91,20 +92,9 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
path = argv[1];
|
||||
strip_trailing_slashes (path);
|
||||
|
||||
slash = strrchr (path, '/');
|
||||
if (slash == NULL)
|
||||
path = (char *) ".";
|
||||
else
|
||||
{
|
||||
/* Remove any trailing slashes and final element. */
|
||||
while (slash > path && *slash == '/')
|
||||
--slash;
|
||||
slash[1] = 0;
|
||||
}
|
||||
puts (path);
|
||||
len = dir_name_r (argv[1], &result);
|
||||
fwrite (result, 1, len, stdout);
|
||||
putchar ('\n');
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
@@ -15,50 +15,7 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Copy files and set their permission modes and, if possible,
|
||||
their owner and group. Used similarly to `cp'; typically
|
||||
used in Makefiles to copy programs into their destination
|
||||
directories. It can also be used to create the destination
|
||||
directories and any leading directories, and to set the final
|
||||
directory's modes. It refuses to copy files onto themselves.
|
||||
|
||||
Options:
|
||||
-g, --group=GROUP
|
||||
Set the group ownership of the installed file or directory
|
||||
to the group ID of GROUP (default is process's current
|
||||
group). GROUP may also be a numeric group ID.
|
||||
|
||||
-m, --mode=MODE
|
||||
Set the permission mode for the installed file or directory
|
||||
to MODE, which is an octal number (default is u=rwx,g=rx,o=rx).
|
||||
|
||||
-o, --owner=OWNER
|
||||
If run as root, set the ownership of the installed file to
|
||||
the user ID of OWNER (default is root). OWNER may also be
|
||||
a numeric user ID.
|
||||
|
||||
-c No effect. For compatibility with old Unix versions of install.
|
||||
|
||||
-s, --strip
|
||||
Strip the symbol tables from installed files.
|
||||
|
||||
-p, --preserve-timestamps
|
||||
Retain creation and modification timestamps when installing files.
|
||||
|
||||
-d, --directory
|
||||
Create a directory and its leading directories, if they
|
||||
do not already exist. Set the owner, group and mode
|
||||
as given on the command line. Any leading directories
|
||||
that are created are also given those attributes.
|
||||
This is different from the SunOS 4.0 install, which gives
|
||||
directories that it creates the default attributes.
|
||||
|
||||
-D
|
||||
Like the -d option, but a file is installed, along with the directory.
|
||||
Useful when installing into a new directory, and the install
|
||||
process doesn't properly comprehend making directories.
|
||||
|
||||
David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
@@ -226,7 +183,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
int errors = 0;
|
||||
const char *symbolic_mode = NULL;
|
||||
const char *specified_mode = NULL;
|
||||
int make_backups = 0;
|
||||
char *backup_suffix_string;
|
||||
char *version_control_string = NULL;
|
||||
@@ -292,7 +249,7 @@ main (int argc, char **argv)
|
||||
group_name = optarg;
|
||||
break;
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
specified_mode = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
owner_name = optarg;
|
||||
@@ -328,11 +285,11 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
if (symbolic_mode)
|
||||
if (specified_mode)
|
||||
{
|
||||
struct mode_change *change = mode_compile (symbolic_mode, 0);
|
||||
struct mode_change *change = mode_compile (specified_mode, 0);
|
||||
if (change == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode %s"), quote (symbolic_mode));
|
||||
error (1, 0, _("invalid mode %s"), quote (specified_mode));
|
||||
else if (change == MODE_MEMORY_EXHAUSTED)
|
||||
xalloc_die ();
|
||||
mode = mode_adjust (0, change);
|
||||
|
||||
70
src/ls.c
70
src/ls.c
@@ -197,12 +197,26 @@ int rpl_lstat PARAMS((const char *, struct stat *));
|
||||
# define lstat(Name, Stat_buf) rpl_lstat(Name, Stat_buf)
|
||||
#endif
|
||||
|
||||
#if defined _DIRENT_HAVE_D_TYPE || defined DTTOIF
|
||||
# define HAVE_STRUCT_DIRENT_D_TYPE 1
|
||||
# define DT_INIT(Val) = Val
|
||||
#else
|
||||
# define HAVE_STRUCT_DIRENT_D_TYPE 0
|
||||
# define DT_INIT(Val) /* empty */
|
||||
#endif
|
||||
|
||||
enum filetype
|
||||
{
|
||||
symbolic_link,
|
||||
directory,
|
||||
arg_directory, /* Directory given as command line arg. */
|
||||
normal /* All others. */
|
||||
unknown DT_INIT (DT_UNKNOWN),
|
||||
fifo DT_INIT (DT_FIFO),
|
||||
chardev DT_INIT (DT_CHR),
|
||||
directory DT_INIT (DT_DIR),
|
||||
blockdev DT_INIT (DT_BLK),
|
||||
normal DT_INIT (DT_REG),
|
||||
symbolic_link DT_INIT (DT_LNK),
|
||||
sock DT_INIT (DT_SOCK),
|
||||
arg_directory DT_INIT (2 * (DT_UNKNOWN | DT_FIFO | DT_CHR | DT_DIR | DT_BLK
|
||||
| DT_REG | DT_LNK | DT_SOCK))
|
||||
};
|
||||
|
||||
struct fileinfo
|
||||
@@ -290,8 +304,8 @@ static int rev_cmp_version PARAMS ((const struct fileinfo *file2,
|
||||
const struct fileinfo *file1));
|
||||
static int decode_switches PARAMS ((int argc, char **argv));
|
||||
static int file_interesting PARAMS ((const struct dirent *next));
|
||||
static uintmax_t gobble_file PARAMS ((const char *name, int explicit_arg,
|
||||
const char *dirname));
|
||||
static uintmax_t gobble_file PARAMS ((const char *name, enum filetype type,
|
||||
int explicit_arg, const char *dirname));
|
||||
static void print_color_indicator PARAMS ((const char *name, unsigned int mode,
|
||||
int linkok));
|
||||
static void put_indicator PARAMS ((const struct bin_str *ind));
|
||||
@@ -629,6 +643,11 @@ static int line_length;
|
||||
|
||||
static int format_needs_stat;
|
||||
|
||||
/* Similar to `format_needs_stat', but set if only the file type is
|
||||
needed. */
|
||||
|
||||
static int format_needs_type;
|
||||
|
||||
/* The exit status to use if we don't get any fatal errors. */
|
||||
|
||||
static int exit_status;
|
||||
@@ -845,8 +864,9 @@ main (int argc, char **argv)
|
||||
|
||||
format_needs_stat = sort_type == sort_time || sort_type == sort_size
|
||||
|| format == long_format
|
||||
|| trace_links || trace_dirs || indicator_style != none
|
||||
|| print_block_size || print_inode || print_with_color;
|
||||
|| trace_links || trace_dirs || print_block_size || print_inode;
|
||||
format_needs_type = (format_needs_stat == 0
|
||||
&& (print_with_color || indicator_style != none));
|
||||
|
||||
if (dired && format == long_format)
|
||||
{
|
||||
@@ -864,13 +884,13 @@ main (int argc, char **argv)
|
||||
dir_defaulted = 0;
|
||||
for (; i < argc; i++)
|
||||
{
|
||||
gobble_file (argv[i], 1, "");
|
||||
gobble_file (argv[i], unknown, 1, "");
|
||||
}
|
||||
|
||||
if (dir_defaulted)
|
||||
{
|
||||
if (immediate_dirs)
|
||||
gobble_file (".", 1, "");
|
||||
gobble_file (".", directory, 1, "");
|
||||
else
|
||||
queue_directory (".", 0);
|
||||
}
|
||||
@@ -1701,7 +1721,17 @@ print_dir (const char *name, const char *realname)
|
||||
|
||||
while ((next = readdir (reading)) != NULL)
|
||||
if (file_interesting (next))
|
||||
total_blocks += gobble_file (next->d_name, 0, name);
|
||||
{
|
||||
enum filetype type = unknown;
|
||||
|
||||
#if HAVE_STRUCT_DIRENT_D_TYPE
|
||||
if (next->d_type == DT_DIR || next->d_type == DT_CHR
|
||||
|| next->d_type == DT_BLK || next->d_type == DT_SOCK
|
||||
|| next->d_type == DT_FIFO)
|
||||
type = next->d_type;
|
||||
#endif
|
||||
total_blocks += gobble_file (next->d_name, type, 0, name);
|
||||
}
|
||||
|
||||
if (CLOSEDIR (reading))
|
||||
{
|
||||
@@ -1812,7 +1842,8 @@ clear_files (void)
|
||||
Return the number of blocks that the file occupies. */
|
||||
|
||||
static uintmax_t
|
||||
gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
gobble_file (const char *name, enum filetype type, int explicit_arg,
|
||||
const char *dirname)
|
||||
{
|
||||
register uintmax_t blocks;
|
||||
register int val;
|
||||
@@ -1829,7 +1860,8 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
files[files_index].linkmode = 0;
|
||||
files[files_index].linkok = 0;
|
||||
|
||||
if (explicit_arg || format_needs_stat)
|
||||
if (explicit_arg || format_needs_stat
|
||||
|| (format_needs_type && type == unknown))
|
||||
{
|
||||
/* `path' is the absolute pathname of this file. */
|
||||
|
||||
@@ -1937,7 +1969,13 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
}
|
||||
}
|
||||
else
|
||||
blocks = 0;
|
||||
{
|
||||
files[files_index].filetype = type;
|
||||
#if HAVE_STRUCT_DIRENT_D_TYPE
|
||||
files[files_index].stat.st_mode = DTTOIF (type);
|
||||
#endif
|
||||
blocks = 0;
|
||||
}
|
||||
|
||||
files[files_index].name = xstrdup (name);
|
||||
files_index++;
|
||||
@@ -2345,11 +2383,11 @@ print_long_format (const struct fileinfo *f)
|
||||
Allow a 1 hour slop factor for what is considered "the future",
|
||||
to allow for NFS server/client clock disagreement.
|
||||
Show the year instead of the time of day. */
|
||||
fmt = "%b %e %Y";
|
||||
fmt = _("%b %e %Y");
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt = "%b %e %H:%M";
|
||||
fmt = _("%b %e %H:%M");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
144
src/md5sum.c
144
src/md5sum.c
@@ -1,5 +1,4 @@
|
||||
/* Compute MD5 checksum of files or strings according to the definition
|
||||
of MD5 in RFC 1321 from April 1992.
|
||||
/* Compute MD5 or SHA1 checksum of files or strings
|
||||
Copyright (C) 1995-2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -24,16 +23,19 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "md5.h"
|
||||
#include "getline.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "md5.h"
|
||||
#include "sha.h"
|
||||
#include "checksum.h"
|
||||
#include "getline.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "md5sum"
|
||||
#define PROGRAM_NAME (algorithm == ALG_MD5 ? "md5sum" : "shasum")
|
||||
|
||||
#define AUTHORS "Ulrich Drepper"
|
||||
#define AUTHORS "Ulrich Drepper and Scott Miller"
|
||||
|
||||
/* Most systems do not distinguish between external and internal
|
||||
text representations. */
|
||||
@@ -58,24 +60,44 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The minimum length of a valid digest line in a file produced
|
||||
by `md5sum FILE' and read by `md5sum --check'. This length does
|
||||
|
||||
#define DIGEST_TYPE_STRING(Alg) ((Alg) == ALG_MD5 ? "MD5" : "SHA1")
|
||||
#define DIGEST_STREAM(Alg) ((Alg) == ALG_MD5 ? md5_stream : sha_stream)
|
||||
|
||||
#define DIGEST_BITS(Alg) ((Alg) == ALG_MD5 ? 128 : 160)
|
||||
#define DIGEST_HEX_BYTES(Alg) (DIGEST_BITS (Alg) / 4)
|
||||
#define DIGEST_BIN_BYTES(Alg) (DIGEST_BITS (Alg) / 8)
|
||||
|
||||
#define MAX_DIGEST_BIN_BYTES MAX (DIGEST_BIN_BYTES (ALG_MD5), \
|
||||
DIGEST_BIN_BYTES (ALG_SHA1))
|
||||
|
||||
/* The minimum length of a valid digest line. This length does
|
||||
not include any newline character at the end of a line. */
|
||||
#define MIN_DIGEST_LINE_LENGTH (32 /* message digest length */ \
|
||||
+ 2 /* blank and binary indicator */ \
|
||||
+ 1 /* minimum filename length */ )
|
||||
#define MIN_DIGEST_LINE_LENGTH(Alg) \
|
||||
(DIGEST_HEX_BYTES (Alg) /* length of hexadecimal message digest */ \
|
||||
+ 2 /* blank and binary indicator */ \
|
||||
+ 1 /* minimum filename length */ )
|
||||
|
||||
/* Nonzero if any of the files read were the standard input. */
|
||||
static int have_read_stdin;
|
||||
|
||||
/* The minimum length of a valid checksum line for the selected algorithm. */
|
||||
static int min_digest_line_length;
|
||||
|
||||
/* Set to the length of a digest hex string for the selected algorithm. */
|
||||
static size_t digest_hex_bytes;
|
||||
|
||||
/* With --check, don't generate any output.
|
||||
The exit code indicates success or failure. */
|
||||
static int status_only = 0;
|
||||
|
||||
/* With --check, print a message to standard error warning about each
|
||||
improperly formatted MD5 checksum line. */
|
||||
improperly formatted checksum line. */
|
||||
static int warn = 0;
|
||||
|
||||
/* Declared and set via one of the wrapper .c files. */
|
||||
/* int algorithm = ALG_UNSPECIFIED; */
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
@@ -103,25 +125,30 @@ usage (int status)
|
||||
printf (_("\
|
||||
Usage: %s [OPTION] [FILE]...\n\
|
||||
or: %s [OPTION] --check [FILE]\n\
|
||||
Print or check MD5 checksums.\n\
|
||||
Print or check %s (%d-bit) checksums.\n\
|
||||
With no FILE, or when FILE is -, read standard input.\n\
|
||||
\n\
|
||||
-b, --binary read files in binary mode (default on DOS/Windows)\n\
|
||||
-c, --check check MD5 sums against given list\n\
|
||||
-c, --check check %s sums against given list\n\
|
||||
-t, --text read files in text mode (default)\n\
|
||||
\n\
|
||||
The following two options are useful only when verifying checksums:\n\
|
||||
--status don't output anything, status code shows success\n\
|
||||
-w, --warn warn about improperly formated MD5 checksum lines\n\
|
||||
-w, --warn warn about improperly formated checksum lines\n\
|
||||
\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
The sums are computed as described in RFC 1321. When checking, the input\n\
|
||||
The sums are computed as described in %s. When checking, the input\n\
|
||||
should be a former output of this program. The default mode is to print\n\
|
||||
a line with checksum, a character indicating type (`*' for binary, ` ' for\n\
|
||||
text), and name for each FILE.\n"),
|
||||
program_name, program_name);
|
||||
program_name, program_name,
|
||||
DIGEST_TYPE_STRING (algorithm),
|
||||
DIGEST_BITS (algorithm),
|
||||
DIGEST_TYPE_STRING (algorithm),
|
||||
(algorithm == ALG_MD5 ? "RFC 1321" : "FIPS-180-1")
|
||||
);
|
||||
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
|
||||
}
|
||||
|
||||
@@ -140,11 +167,11 @@ split_3 (char *s, size_t s_len, unsigned char **u, int *binary, char **w)
|
||||
while (ISWHITE (s[i]))
|
||||
++i;
|
||||
|
||||
/* The line must have at least 35 (36 if the first is a backslash)
|
||||
more characters to contain correct message digest information.
|
||||
Ignore this line if it is too short. */
|
||||
if (!(s_len - i >= MIN_DIGEST_LINE_LENGTH
|
||||
|| (s[i] == '\\' && s_len - i >= 1 + MIN_DIGEST_LINE_LENGTH)))
|
||||
/* The line must have at least `min_digest_line_length - 1' (or one more, if
|
||||
the first is a backslash) more characters to contain correct message digest
|
||||
information. Ignore this line if it is too short. */
|
||||
if (!(s_len - i >= min_digest_line_length
|
||||
|| (s[i] == '\\' && s_len - i >= 1 + min_digest_line_length)))
|
||||
return 1;
|
||||
|
||||
if (s[i] == '\\')
|
||||
@@ -154,10 +181,10 @@ split_3 (char *s, size_t s_len, unsigned char **u, int *binary, char **w)
|
||||
}
|
||||
*u = (unsigned char *) &s[i];
|
||||
|
||||
/* The first field has to be the 32-character hexadecimal
|
||||
/* The first field has to be the n-character hexadecimal
|
||||
representation of the message digest. If it is not followed
|
||||
immediately by a white space it's an error. */
|
||||
i += 32;
|
||||
i += digest_hex_bytes;
|
||||
if (!ISWHITE (s[i]))
|
||||
return 1;
|
||||
|
||||
@@ -230,12 +257,13 @@ hex_digits (unsigned char const *s)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* An interface to md5_stream. Operate on FILENAME (it may be "-") and
|
||||
put the result in *MD5_RESULT. Return non-zero upon failure, zero
|
||||
to indicate success. */
|
||||
/* An interface to the function, DIGEST_STREAM, (either md5_stream or sha_stream).
|
||||
Operate on FILENAME (it may be "-") and put the result in *BIN_RESULT.
|
||||
Return non-zero upon failure, zero to indicate success. */
|
||||
|
||||
static int
|
||||
md5_file (const char *filename, int binary, unsigned char *md5_result)
|
||||
digest_file (const char *filename, int binary, unsigned char *bin_result,
|
||||
int (*digest_stream)(FILE *, void *))
|
||||
{
|
||||
FILE *fp;
|
||||
int err;
|
||||
@@ -265,7 +293,7 @@ md5_file (const char *filename, int binary, unsigned char *md5_result)
|
||||
}
|
||||
}
|
||||
|
||||
err = md5_stream (fp, md5_result);
|
||||
err = (*digest_stream) (fp, bin_result);
|
||||
if (err)
|
||||
{
|
||||
error (0, errno, "%s", filename);
|
||||
@@ -284,13 +312,13 @@ md5_file (const char *filename, int binary, unsigned char *md5_result)
|
||||
}
|
||||
|
||||
static int
|
||||
md5_check (const char *checkfile_name)
|
||||
digest_check (const char *checkfile_name, int (*digest_stream)(FILE *, void *))
|
||||
{
|
||||
FILE *checkfile_stream;
|
||||
int n_properly_formated_lines = 0;
|
||||
int n_mismatched_checksums = 0;
|
||||
int n_open_or_read_failures = 0;
|
||||
unsigned char md5buffer[16];
|
||||
unsigned char bin_buffer[MAX_DIGEST_BIN_BYTES];
|
||||
size_t line_number;
|
||||
char *line;
|
||||
size_t line_chars_allocated;
|
||||
@@ -318,7 +346,7 @@ md5_check (const char *checkfile_name)
|
||||
{
|
||||
char *filename;
|
||||
int binary;
|
||||
unsigned char *md5num;
|
||||
unsigned char *hex_digest;
|
||||
int err;
|
||||
int line_length;
|
||||
|
||||
@@ -336,14 +364,15 @@ md5_check (const char *checkfile_name)
|
||||
if (line[line_length - 1] == '\n')
|
||||
line[--line_length] = '\0';
|
||||
|
||||
err = split_3 (line, line_length, &md5num, &binary, &filename);
|
||||
if (err || !hex_digits (md5num))
|
||||
err = split_3 (line, line_length, &hex_digest, &binary, &filename);
|
||||
if (err || !hex_digits (hex_digest))
|
||||
{
|
||||
if (warn)
|
||||
{
|
||||
error (0, 0,
|
||||
_("%s: %lu: improperly formatted MD5 checksum line"),
|
||||
checkfile_name, (unsigned long) line_number);
|
||||
_("%s: %lu: improperly formatted %s checksum line"),
|
||||
checkfile_name, (unsigned long) line_number,
|
||||
DIGEST_TYPE_STRING (algorithm));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -356,7 +385,7 @@ md5_check (const char *checkfile_name)
|
||||
|
||||
++n_properly_formated_lines;
|
||||
|
||||
fail = md5_file (filename, binary, md5buffer);
|
||||
fail = digest_file (filename, binary, bin_buffer, digest_stream);
|
||||
|
||||
if (fail)
|
||||
{
|
||||
@@ -369,23 +398,24 @@ md5_check (const char *checkfile_name)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t digest_bin_bytes = digest_hex_bytes / 2;
|
||||
size_t cnt;
|
||||
/* Compare generated binary number with text representation
|
||||
in check file. Ignore case of hex digits. */
|
||||
for (cnt = 0; cnt < 16; ++cnt)
|
||||
for (cnt = 0; cnt < digest_bin_bytes; ++cnt)
|
||||
{
|
||||
if (TOLOWER (md5num[2 * cnt]) != bin2hex[md5buffer[cnt] >> 4]
|
||||
|| (TOLOWER (md5num[2 * cnt + 1])
|
||||
!= (bin2hex[md5buffer[cnt] & 0xf])))
|
||||
if (TOLOWER (hex_digest[2 * cnt]) != bin2hex[bin_buffer[cnt] >> 4]
|
||||
|| (TOLOWER (hex_digest[2 * cnt + 1])
|
||||
!= (bin2hex[bin_buffer[cnt] & 0xf])))
|
||||
break;
|
||||
}
|
||||
if (cnt != 16)
|
||||
if (cnt != digest_bin_bytes)
|
||||
++n_mismatched_checksums;
|
||||
|
||||
if (!status_only)
|
||||
{
|
||||
printf ("%s: %s\n", filename,
|
||||
(cnt != 16 ? _("FAILED") : _("OK")));
|
||||
(cnt != digest_bin_bytes ? _("FAILED") : _("OK")));
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
@@ -411,8 +441,8 @@ md5_check (const char *checkfile_name)
|
||||
if (n_properly_formated_lines == 0)
|
||||
{
|
||||
/* Warn if no tests are found. */
|
||||
error (0, 0, _("%s: no properly formatted MD5 checksum lines found"),
|
||||
checkfile_name);
|
||||
error (0, 0, _("%s: no properly formatted %s checksum lines found"),
|
||||
checkfile_name, DIGEST_TYPE_STRING (algorithm));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -448,7 +478,7 @@ md5_check (const char *checkfile_name)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
unsigned char md5buffer[16];
|
||||
unsigned char bin_buffer[MAX_DIGEST_BIN_BYTES];
|
||||
int do_check = 0;
|
||||
int opt;
|
||||
char **string = NULL;
|
||||
@@ -513,6 +543,9 @@ main (int argc, char **argv)
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
min_digest_line_length = MIN_DIGEST_LINE_LENGTH (algorithm);
|
||||
digest_hex_bytes = DIGEST_HEX_BYTES (algorithm);
|
||||
|
||||
if (file_type_specified && do_check)
|
||||
{
|
||||
error (0, 0, _("the --binary and --text options are meaningless when \
|
||||
@@ -553,10 +586,13 @@ verifying checksums"));
|
||||
for (i = 0; i < n_strings; ++i)
|
||||
{
|
||||
size_t cnt;
|
||||
md5_buffer (string[i], strlen (string[i]), md5buffer);
|
||||
if (algorithm == ALG_MD5)
|
||||
md5_buffer (string[i], strlen (string[i]), bin_buffer);
|
||||
else
|
||||
sha_buffer (string[i], strlen (string[i]), bin_buffer);
|
||||
|
||||
for (cnt = 0; cnt < 16; ++cnt)
|
||||
printf ("%02x", md5buffer[cnt]);
|
||||
for (cnt = 0; cnt < (digest_hex_bytes / 2); ++cnt)
|
||||
printf ("%02x", bin_buffer[cnt]);
|
||||
|
||||
printf (" \"%s\"\n", string[i]);
|
||||
}
|
||||
@@ -570,7 +606,8 @@ verifying checksums"));
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
err = md5_check ((optind == argc) ? "-" : argv[optind]);
|
||||
err = digest_check ((optind == argc) ? "-" : argv[optind],
|
||||
DIGEST_STREAM (algorithm));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -582,7 +619,8 @@ verifying checksums"));
|
||||
int fail;
|
||||
char *file = argv[optind];
|
||||
|
||||
fail = md5_file (file, binary, md5buffer);
|
||||
fail = digest_file (file, binary, bin_buffer,
|
||||
DIGEST_STREAM (algorithm));
|
||||
err |= fail;
|
||||
if (!fail)
|
||||
{
|
||||
@@ -593,8 +631,8 @@ verifying checksums"));
|
||||
if (strchr (file, '\n') || strchr (file, '\\'))
|
||||
putchar ('\\');
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
printf ("%02x", md5buffer[i]);
|
||||
for (i = 0; i < (digest_hex_bytes / 2); ++i)
|
||||
printf ("%02x", bin_buffer[i]);
|
||||
|
||||
putchar (' ');
|
||||
if (binary)
|
||||
|
||||
62
src/mkdir.c
62
src/mkdir.c
@@ -23,6 +23,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "dirname.h"
|
||||
#include "error.h"
|
||||
#include "makepath.h"
|
||||
#include "modechange.h"
|
||||
@@ -77,7 +78,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
mode_t newmode;
|
||||
mode_t parent_mode;
|
||||
const char *symbolic_mode = NULL;
|
||||
const char *specified_mode = NULL;
|
||||
const char *verbose_fmt_string = NULL;
|
||||
int errors = 0;
|
||||
int optc;
|
||||
@@ -101,7 +102,7 @@ main (int argc, char **argv)
|
||||
create_parents = 1;
|
||||
break;
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
specified_mode = optarg;
|
||||
break;
|
||||
case 'v': /* --verbose */
|
||||
verbose_fmt_string = _("created directory %s");
|
||||
@@ -119,13 +120,19 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
newmode = S_IRWXUGO & ~ umask (0);
|
||||
parent_mode = S_IWUSR | S_IXUSR | newmode;
|
||||
if (symbolic_mode)
|
||||
newmode = S_IRWXUGO;
|
||||
{
|
||||
mode_t umask_value = umask (0);
|
||||
umask (umask_value); /* Restore the old value. */
|
||||
parent_mode = (newmode & (~ umask_value)) | S_IWUSR | S_IXUSR;
|
||||
}
|
||||
|
||||
if (specified_mode)
|
||||
{
|
||||
struct mode_change *change = mode_compile (symbolic_mode, 0);
|
||||
struct mode_change *change = mode_compile (specified_mode, 0);
|
||||
newmode &= ~ umask (0);
|
||||
if (change == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode %s"), quote (symbolic_mode));
|
||||
error (1, 0, _("invalid mode %s"), quote (specified_mode));
|
||||
else if (change == MODE_MEMORY_EXHAUSTED)
|
||||
xalloc_die ();
|
||||
newmode = mode_adjust (newmode, change);
|
||||
@@ -136,31 +143,48 @@ main (int argc, char **argv)
|
||||
int fail = 0;
|
||||
if (create_parents)
|
||||
{
|
||||
fail = make_path (argv[optind], newmode, parent_mode,
|
||||
char *parents = dir_name (argv[optind]);
|
||||
fail = make_path (parents, parent_mode, parent_mode,
|
||||
-1, -1, 1, verbose_fmt_string);
|
||||
free (parents);
|
||||
}
|
||||
else
|
||||
|
||||
if (fail == 0)
|
||||
{
|
||||
fail = mkdir (argv[optind], newmode);
|
||||
if (fail)
|
||||
error (0, errno, _("cannot create directory %s"),
|
||||
quote (argv[optind]));
|
||||
const char *dir = argv[optind];
|
||||
int dir_created;
|
||||
int t_errno;
|
||||
fail = make_dir (dir, dir, newmode, &dir_created);
|
||||
t_errno = errno;
|
||||
/* If make_dir `succeeds' because the directory already exists,
|
||||
then fail unless --parents (-p) was specified. */
|
||||
if (fail ||
|
||||
(!create_parents && !dir_created && (t_errno = EEXIST)))
|
||||
{
|
||||
error (0, t_errno, _("cannot create directory %s"),
|
||||
quote (dir));
|
||||
fail = 1;
|
||||
}
|
||||
else if (verbose_fmt_string)
|
||||
error (0, 0, verbose_fmt_string, quote (argv[optind]));
|
||||
error (0, 0, verbose_fmt_string, quote (dir));
|
||||
|
||||
/* mkdir(2) is required to honor only the file permission bits.
|
||||
In particular, it needn't do anything about `special' bits,
|
||||
so if any were set in newmode, apply them with chmod. */
|
||||
if (fail == 0 && (newmode & ~S_IRWXUGO))
|
||||
so if any were set in newmode, apply them with chmod.
|
||||
This extra step is necessary in some cases when the containing
|
||||
directory has a default ACL. */
|
||||
|
||||
if (fail == 0 && specified_mode)
|
||||
{
|
||||
fail = chmod (argv[optind], newmode);
|
||||
fail = chmod (dir, newmode);
|
||||
if (fail)
|
||||
error (0, errno, _("cannot set permissions of directory %s"),
|
||||
quote (argv[optind]));
|
||||
quote (dir));
|
||||
}
|
||||
}
|
||||
|
||||
errors |= fail;
|
||||
if (fail)
|
||||
errors = 1;
|
||||
}
|
||||
|
||||
exit (errors);
|
||||
|
||||
43
src/mkfifo.c
43
src/mkfifo.c
@@ -15,12 +15,7 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options:
|
||||
-m, --mode=mode Set the mode of created fifo's to MODE, which is
|
||||
symbolic as in chmod and uses the umask as a point of
|
||||
departure.
|
||||
|
||||
David MacKenzie <djm@ai.mit.edu> */
|
||||
/* David MacKenzie <djm@ai.mit.edu> */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
@@ -76,7 +71,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
mode_t newmode;
|
||||
struct mode_change *change;
|
||||
const char *symbolic_mode;
|
||||
const char *specified_mode;
|
||||
int errors = 0;
|
||||
int optc;
|
||||
|
||||
@@ -87,7 +82,7 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
symbolic_mode = NULL;
|
||||
specified_mode = NULL;
|
||||
|
||||
#ifndef S_ISFIFO
|
||||
error (4, 0, _("fifo files not supported"));
|
||||
@@ -99,7 +94,7 @@ main (int argc, char **argv)
|
||||
case 0:
|
||||
break;
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
specified_mode = optarg;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
@@ -114,11 +109,11 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
newmode = ((S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
|
||||
& ~ umask (0));
|
||||
if (symbolic_mode)
|
||||
newmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
if (specified_mode)
|
||||
{
|
||||
change = mode_compile (symbolic_mode, 0);
|
||||
newmode &= ~ umask (0);
|
||||
change = mode_compile (specified_mode, 0);
|
||||
if (change == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode"));
|
||||
else if (change == MODE_MEMORY_EXHAUSTED)
|
||||
@@ -128,11 +123,23 @@ main (int argc, char **argv)
|
||||
|
||||
for (; optind < argc; ++optind)
|
||||
{
|
||||
if (mkfifo (argv[optind], newmode))
|
||||
{
|
||||
error (0, errno, _("cannot make fifo %s"), quote (argv[optind]));
|
||||
errors = 1;
|
||||
}
|
||||
int fail = mkfifo (argv[optind], newmode);
|
||||
if (fail)
|
||||
error (0, errno, _("cannot create fifo `%s'"), quote (argv[optind]));
|
||||
|
||||
/* If the containing directory happens to have a default ACL, chmod
|
||||
ensures the file mode permission bits are still set as desired. */
|
||||
|
||||
if (fail == 0 && specified_mode)
|
||||
{
|
||||
fail = chmod (argv[optind], newmode);
|
||||
if (fail)
|
||||
error (0, errno, _("cannot set permissions of fifo `%s'"),
|
||||
quote (argv[optind]));
|
||||
}
|
||||
|
||||
if (fail)
|
||||
errors = 1;
|
||||
}
|
||||
|
||||
exit (errors);
|
||||
|
||||
25
src/mknod.c
25
src/mknod.c
@@ -86,7 +86,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
mode_t newmode;
|
||||
struct mode_change *change;
|
||||
const char *symbolic_mode;
|
||||
const char *specified_mode;
|
||||
int optc;
|
||||
int i_major, i_minor;
|
||||
long int tmp_major, tmp_minor;
|
||||
@@ -99,7 +99,7 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
symbolic_mode = NULL;
|
||||
specified_mode = NULL;
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ main (int argc, char **argv)
|
||||
case 0:
|
||||
break;
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
specified_mode = optarg;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
@@ -117,11 +117,11 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
newmode = ((S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
|
||||
& ~ umask (0));
|
||||
if (symbolic_mode)
|
||||
newmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
if (specified_mode)
|
||||
{
|
||||
change = mode_compile (symbolic_mode, 0);
|
||||
newmode &= ~ umask (0);
|
||||
change = mode_compile (specified_mode, 0);
|
||||
if (change == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode"));
|
||||
else if (change == MODE_MEMORY_EXHAUSTED)
|
||||
@@ -223,5 +223,16 @@ major and minor device numbers may not be specified for fifo files"));
|
||||
usage (1);
|
||||
}
|
||||
|
||||
/* Perform an explicit chmod to ensure the file mode permission bits
|
||||
are set as specified. This extra step is necessary in some cases
|
||||
when the containing directory has a default ACL. */
|
||||
|
||||
if (specified_mode)
|
||||
{
|
||||
if (chmod (argv[optind], newmode))
|
||||
error (0, errno, _("cannot set permissions of `%s'"),
|
||||
quote (argv[optind]));
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
1
src/mv.c
1
src/mv.c
@@ -88,7 +88,6 @@ rm_option_init (struct rm_options *x)
|
||||
{
|
||||
x->unlink_dirs = 0;
|
||||
|
||||
/* FIXME: maybe this should be 1. The POSIX spec doesn't specify. */
|
||||
x->ignore_missing_files = 0;
|
||||
|
||||
x->recursive = 1;
|
||||
|
||||
34
src/od.c
34
src/od.c
@@ -77,6 +77,8 @@ enum size_spec
|
||||
SHORT,
|
||||
INT,
|
||||
LONG,
|
||||
LONG_LONG,
|
||||
/* FIXME: add INTMAX support, too */
|
||||
FLOAT_SINGLE,
|
||||
FLOAT_DOUBLE,
|
||||
FLOAT_LONG_DOUBLE
|
||||
@@ -229,7 +231,11 @@ static FILE *in_stream;
|
||||
/* If nonzero, at least one of the files we read was standard input. */
|
||||
static int have_read_stdin;
|
||||
|
||||
#define LONGEST_INTEGRAL_TYPE long int
|
||||
#ifdef HAVE_UNSIGNED_LONG_LONG
|
||||
# define LONGEST_INTEGRAL_TYPE unsigned long long
|
||||
#else
|
||||
# define LONGEST_INTEGRAL_TYPE long int
|
||||
#endif
|
||||
|
||||
#define MAX_INTEGRAL_TYPE_SIZE sizeof(LONGEST_INTEGRAL_TYPE)
|
||||
static enum size_spec integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1];
|
||||
@@ -441,6 +447,21 @@ print_long (long unsigned int n_bytes, const char *block,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_UNSIGNED_LONG_LONG
|
||||
static void
|
||||
print_long_long (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
for (i = n_bytes / sizeof (unsigned long long); i > 0; i--)
|
||||
{
|
||||
unsigned long long tmp = *(const unsigned long long *) block;
|
||||
printf (fmt_string, tmp);
|
||||
block += sizeof (unsigned long long);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
print_float (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
@@ -704,7 +725,9 @@ this system doesn't provide a %lu-byte integral type"), s_orig, size);
|
||||
fmt = SIGNED_DECIMAL;
|
||||
sprintf (fmt_string, " %%%u%sd",
|
||||
(field_width = bytes_to_signed_dec_digits[size]),
|
||||
(size_spec == LONG ? "l" : ""));
|
||||
(size_spec == LONG ? "l"
|
||||
: (size_spec == LONG_LONG ? "ll"
|
||||
: "")));
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
@@ -756,6 +779,10 @@ this system doesn't provide a %lu-byte integral type"), s_orig, size);
|
||||
print_function = print_long;
|
||||
break;
|
||||
|
||||
case LONG_LONG:
|
||||
print_function = print_long_long;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
@@ -1596,6 +1623,9 @@ main (int argc, char **argv)
|
||||
integral_type_size[sizeof (short int)] = SHORT;
|
||||
integral_type_size[sizeof (int)] = INT;
|
||||
integral_type_size[sizeof (long int)] = LONG;
|
||||
#ifdef HAVE_UNSIGNED_LONG_LONG
|
||||
integral_type_size[sizeof (long long)] = LONG_LONG;
|
||||
#endif
|
||||
|
||||
for (i = 0; i <= MAX_FP_TYPE_SIZE; i++)
|
||||
fp_type_size[i] = NO_SIZE;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
struct rm_options
|
||||
{
|
||||
/* If nonzero, ignore nonexistant files. */
|
||||
/* If nonzero, ignore nonexistent files. */
|
||||
int ignore_missing_files;
|
||||
|
||||
/* If nonzero, query the user about whether to remove each file. */
|
||||
|
||||
2
src/sha1sum.c
Normal file
2
src/sha1sum.c
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "checksum.h"
|
||||
int algorithm = ALG_SHA1;
|
||||
42
src/shred.c
42
src/shred.c
@@ -83,6 +83,7 @@
|
||||
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
@@ -438,7 +439,7 @@ struct Options
|
||||
|
||||
static struct option const long_opts[] =
|
||||
{
|
||||
{"exact", required_argument, NULL, 'x'},
|
||||
{"exact", no_argument, NULL, 'x'},
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
{"iterations", required_argument, NULL, 'n'},
|
||||
{"size", required_argument, NULL, 's'},
|
||||
@@ -990,13 +991,14 @@ fillpattern (int type, unsigned char *r, size_t size)
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill a buffer with random data.
|
||||
* size is rounded UP to a multiple of ISAAC_BYTES.
|
||||
* Fill a buffer, R (of size SIZE_MAX), with random data.
|
||||
* SIZE is rounded UP to a multiple of ISAAC_BYTES.
|
||||
*/
|
||||
static void
|
||||
fillrand (struct isaac_state *s, word32 *r, size_t size)
|
||||
fillrand (struct isaac_state *s, word32 *r, size_t size_max, size_t size)
|
||||
{
|
||||
size = (size + ISAAC_BYTES - 1) / ISAAC_BYTES;
|
||||
assert (size <= size_max);
|
||||
|
||||
while (size--)
|
||||
{
|
||||
@@ -1083,12 +1085,14 @@ dopass (int fd, char const *qname, off_t *sizep, int type,
|
||||
lim = sizeof r;
|
||||
if ((off_t) lim > size - offset && size != -1)
|
||||
{
|
||||
if (size < offset)
|
||||
break;
|
||||
lim = (size_t) (size - offset);
|
||||
if (!lim)
|
||||
break;
|
||||
}
|
||||
if (type < 0)
|
||||
fillrand (s, r, lim);
|
||||
fillrand (s, r, sizeof r, lim);
|
||||
/* Loop to retry partial writes. */
|
||||
for (soff = 0; soff < lim; soff += ssize)
|
||||
{
|
||||
@@ -1422,17 +1426,33 @@ do_wipefd (int fd, char const *qname, struct isaac_state *s,
|
||||
size = flags->size;
|
||||
if (size == -1)
|
||||
{
|
||||
size = (S_ISREG (st.st_mode)
|
||||
? st.st_size
|
||||
: lseek (fd, (off_t) 0, SEEK_END));
|
||||
if (size < (S_ISREG (st.st_mode) ? 0 : -1))
|
||||
/* Accept a length of zero only if it's a regular file.
|
||||
For any other type of file, try to get the size another way. */
|
||||
if (S_ISREG (st.st_mode))
|
||||
{
|
||||
error (0, 0, _("%s: file has negative size"), qname);
|
||||
return -1;
|
||||
size = st.st_size;
|
||||
if (size < 0)
|
||||
{
|
||||
error (0, 0, _("%s: file has negative size"), qname);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size = lseek (fd, (off_t) 0, SEEK_END);
|
||||
if (size <= 0)
|
||||
{
|
||||
/* We are unable to determine the length, up front.
|
||||
Let dopass do that as part of its first iteration. */
|
||||
size = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 <= size && !(flags->exact))
|
||||
{
|
||||
size += ST_BLKSIZE (st) - 1 - (size - 1) % ST_BLKSIZE (st);
|
||||
|
||||
/* If in rounding up, we've just overflowed, use the maximum. */
|
||||
if (size < 0)
|
||||
size = TYPE_MAXIMUM (off_t);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ double strtod ();
|
||||
not properly sorted. Any other irregular exit must exit with a
|
||||
status code greater than 1. */
|
||||
#define SORT_FAILURE 2
|
||||
#define SORT_OUT_OF_ORDER 1
|
||||
|
||||
#define C_DECIMAL_POINT '.'
|
||||
#define NEGATION_SIGN '-'
|
||||
@@ -2242,9 +2243,14 @@ but lacks following character offset"));
|
||||
|
||||
if (checkonly)
|
||||
{
|
||||
if (nfiles > 1)
|
||||
error (SORT_FAILURE, 0,
|
||||
_("too many arguments; with -c, there may be at most\
|
||||
one file argument"));
|
||||
|
||||
/* POSIX requires that sort return 1 IFF invoked with -c and the
|
||||
input is not properly sorted. */
|
||||
exit (check (files, nfiles) == 0 ? 0 : 1);
|
||||
exit (check (files, nfiles) == 0 ? EXIT_SUCCESS : SORT_OUT_OF_ORDER);
|
||||
}
|
||||
|
||||
if (!STREQ (outfile, "-"))
|
||||
|
||||
15
src/wc.c
15
src/wc.c
@@ -26,11 +26,6 @@
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "human.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
/* Get mbstate_t, mbrtowc(), wcwidth(). */
|
||||
#if HAVE_WCHAR_H
|
||||
@@ -45,6 +40,16 @@
|
||||
# define iswprint(wc) 1
|
||||
#endif
|
||||
|
||||
/* Include this after wctype.h so that we `#undef' ISPRINT
|
||||
(from Solaris's euc.h, from widec.h, from wctype.h) before
|
||||
redefining and using it. */
|
||||
#include "system.h"
|
||||
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "human.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
|
||||
#if HAVE_MBRTOWC && defined mbstate_t
|
||||
# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
|
||||
|
||||
@@ -46,7 +46,12 @@ usage (int status)
|
||||
program_name);
|
||||
else
|
||||
{
|
||||
printf (_("Usage: %s [OPTION]... [STRING]...\n"), program_name);
|
||||
printf (_("\
|
||||
Usage: %s [STRING]...\n\
|
||||
or: %s OPTION\n\
|
||||
"),
|
||||
program_name, program_name);
|
||||
|
||||
printf (_("\
|
||||
Repeatedly output a line with all specified STRING(s), or `y'.\n\
|
||||
\n\
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = 1.1 gnits
|
||||
TESTS = \
|
||||
backup-1 no-deref-link1 no-deref-link2 no-deref-link3 backup-is-src \
|
||||
same-file cp-mv-backup symlink-slash slink-2-slink fail-perm dir-slash \
|
||||
perm cp-HL special-bits link dir-rm-dest
|
||||
perm cp-HL special-bits link dir-rm-dest cp-parents
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
MAKE=$(MAKE) \
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -120,7 +121,7 @@ AUTOMAKE_OPTIONS = 1.1 gnits
|
||||
TESTS = \
|
||||
backup-1 no-deref-link1 no-deref-link2 no-deref-link3 backup-is-src \
|
||||
same-file cp-mv-backup symlink-slash slink-2-slink fail-perm dir-slash \
|
||||
perm cp-HL special-bits link dir-rm-dest
|
||||
perm cp-HL special-bits link dir-rm-dest cp-parents
|
||||
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
|
||||
@@ -16,12 +16,7 @@ if test $framework_failure = 1; then
|
||||
fi
|
||||
|
||||
# Make sure we get English translations.
|
||||
LANGUAGE=C
|
||||
export LANGUAGE
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
. $srcdir/../lang-default
|
||||
|
||||
# This cp command should exit nonzero.
|
||||
cp --b=simple a~ a > out 2>&1 && fail=1
|
||||
|
||||
@@ -6,11 +6,8 @@ if test "$VERBOSE" = yes; then
|
||||
cp --version
|
||||
fi
|
||||
|
||||
LANGUAGE=C; export LANGUAGE
|
||||
LANG=C; export LANG
|
||||
|
||||
# Ensure that ls sorts the same way for everyone.
|
||||
LC_ALL=C; export LC_ALL
|
||||
. $srcdir/../lang-default
|
||||
|
||||
. $srcdir/../envvar-check
|
||||
|
||||
|
||||
53
tests/cp/cp-parents
Executable file
53
tests/cp/cp-parents
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
# cp -R --parents dir-specified-with-trailing-slash/ other-dir
|
||||
# would get a failed assertion.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
mv --version
|
||||
fi
|
||||
|
||||
umask 022
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=cp-parents.$$
|
||||
trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
. $srcdir/../envvar-check
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
mkdir foo bar || framework_failure=1
|
||||
mkdir -p a/b/c d e e-dir || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail=0
|
||||
|
||||
# With 4.0.37 and earlier (back to when?), this would fail
|
||||
# with the failed assertion from dirname.c.
|
||||
cp -R --parents foo/ bar || fail=1
|
||||
|
||||
# Exercise the make_path and re_protect code in cp.c.
|
||||
# FIXME: compare verbose output with expected output.
|
||||
cp --verbose -a --parents a/b/c d > /dev/null 2>&1 || fail=1
|
||||
test -d d/a/b/c || fail=1
|
||||
|
||||
# Check that re_protect works.
|
||||
chmod go=w d/a
|
||||
cp -a --parents d/a/b/c e || fail=1
|
||||
p=`ls -ld e/d|sed 's/ .*//'`; case $p in drwxr-xr-x);; *) fail=1;; esac
|
||||
p=`ls -ld e/d/a|sed 's/ .*//'`; case $p in drwx-w--w-);; *) fail=1;; esac
|
||||
p=`ls -ld e/d/a/b/c|sed 's/ .*//'`; case $p in drwxr-xr-x);; *) fail=1;; esac
|
||||
|
||||
# Make sure `mkdir -p existing-dir' succeeds
|
||||
# and that `mkdir existing-dir' fails.
|
||||
mkdir -p e-dir || fail=1
|
||||
mkdir e-dir > /dev/null 2>&1 && fail=1
|
||||
|
||||
(exit $fail); exit
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Make sure the permission-preserving code in copy.c (mv, cp, install) works.
|
||||
|
||||
. $srcdir/../expensive
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
|
||||
@@ -7,8 +7,7 @@ if test "$VERBOSE" = yes; then
|
||||
cp --version
|
||||
fi
|
||||
|
||||
LANGUAGE=C; export LANGUAGE
|
||||
LANG=C; export LANG
|
||||
. $srcdir/../lang-default
|
||||
|
||||
VERSION_CONTROL=numbered; export VERSION_CONTROL
|
||||
|
||||
@@ -182,8 +181,10 @@ cat <<\EOF > $expected
|
||||
|
||||
EOF
|
||||
|
||||
# Uncomment this if you see a failure and want to try to diagnose it.
|
||||
diff -u $expected $actual 1>&2
|
||||
fail=0;
|
||||
|
||||
cmp $expected $actual
|
||||
exit $?
|
||||
# Some folks don't have diff.
|
||||
cmp $expected $actual \
|
||||
|| { diff -c $expected $actual 1>&2; fail=1; }
|
||||
|
||||
(exit $fail); exit
|
||||
|
||||
@@ -10,12 +10,7 @@ fi
|
||||
. $srcdir/../envvar-check
|
||||
|
||||
# Make sure we get English translations.
|
||||
LANGUAGE=C
|
||||
export LANGUAGE
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
. $srcdir/../lang-default
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=sl2sl-$$
|
||||
|
||||
@@ -7,6 +7,8 @@ if test "$VERBOSE" = yes; then
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/../lang-default
|
||||
|
||||
tmp=t-cpsymsl.$$
|
||||
|
||||
framework_failure=0
|
||||
@@ -23,7 +25,7 @@ fi
|
||||
|
||||
fail=0
|
||||
cp -dR symlink/ s || fail=1
|
||||
set `LANGUAGE=C LC_ALL=C ls -l s`
|
||||
set `ls -l s`
|
||||
|
||||
# Prior to fileutils-4.0q, the following would have output ...`s -> dir'
|
||||
# because the trailing slash was removed unconditionally (now you have to
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -95,15 +95,12 @@ sub test_vector
|
||||
['next-mo', "-d '$d1 next month' '+%Y-%m-%d %T'", {}, "$dm $t0", 0],
|
||||
['next-y', "-d '$d1 next year' '+%Y-%m-%d %T'", {}, "$dy $t0", 0],
|
||||
|
||||
# These utc-* tests failed for sh-utils-1.16.
|
||||
['utc-0', "-u -d '08/01/97 6:00' '+%D,%H:%M'", {}, "08/01/97,10:00", 0],
|
||||
# Same as above, but don't rely on TZ in environment.
|
||||
['utc-0', "-u -d '08/01/97 6:00' '+%D,%H:%M'", {}, "08/01/97,06:00", 0],
|
||||
['utc-0a', "-u -d '08/01/97 6:00 UTC +4 hours' '+%D,%H:%M'", {},
|
||||
"08/01/97,10:00", 0],
|
||||
# Make sure --file=FILE works with -u.
|
||||
['utc-1', "-u --file=- '+%Y-%m-%d %T'", "$d0 $t0\n$d0 $t0\n",
|
||||
"$d0 $th\n$d0 $th", 0],
|
||||
# Same as above, but don't rely on TZ in environment.
|
||||
"$d0 $t0\n$d0 $t0", 0],
|
||||
['utc-1a', "-u --file=- '+%Y-%m-%d %T'",
|
||||
"$d0 $t0 UTC +1 hour\n$d0 $t0 UTC +1 hour\n",
|
||||
"$d0 $th\n$d0 $th", 0],
|
||||
@@ -138,9 +135,8 @@ sub test_vector
|
||||
{}, "2000-06-15 09:43:57", 0],
|
||||
|
||||
# Relative seconds, no time.
|
||||
# This test is fragile! It works only if TZ is set to UTC+1 (as below).
|
||||
['relative-2', "--utc -d '1970-01-01 UTC +961062237 sec' $fmt", {},
|
||||
"2000-06-15 10:43:57", 0],
|
||||
"2000-06-15 09:43:57", 0],
|
||||
|
||||
# FIXME: add a lot more...
|
||||
);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -7,9 +7,19 @@ if test "$VERBOSE" = yes; then
|
||||
du --version
|
||||
fi
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=du2-$$
|
||||
trap 'status=$?; rm -rf $tmp && exit $status' 0
|
||||
trap 'exit $?' 1 2 13 15
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
mkdir -p $tmp/1 $tmp/2
|
||||
|
||||
@@ -21,4 +31,4 @@ du $tmp/1 $tmp/2 > /dev/null || fail=1
|
||||
du . $tmp > /dev/null || fail=1
|
||||
du .. $tmp > /dev/null || fail=1
|
||||
|
||||
exit $fail
|
||||
(exit $fail); exit
|
||||
|
||||
11
tests/expensive
Normal file
11
tests/expensive
Normal file
@@ -0,0 +1,11 @@
|
||||
if test "$RUN_EXPENSIVE_TESTS" != yes; then
|
||||
cat <<EOF >&2
|
||||
$0: This test is relatively expensive, so it is disabled by default.
|
||||
To run it anyway, rerun make check with the RUN_EXPENSIVE_TESTS
|
||||
environment variable set to yes. E.g.,
|
||||
|
||||
env RUN_EXPENSIVE_TESTS=yes make check
|
||||
|
||||
EOF
|
||||
exit 77
|
||||
fi
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
8
tests/lang-default
Normal file
8
tests/lang-default
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Set locale-related environment variables so we get consistent
|
||||
# message translations, time formats, sort orderings, etc.
|
||||
|
||||
for i in \
|
||||
LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_TIME; do
|
||||
eval "$i=; export $i"
|
||||
done
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -7,6 +7,9 @@ if test "$VERBOSE" = yes; then
|
||||
ln --version
|
||||
fi
|
||||
|
||||
# Make sure we get English translations.
|
||||
. $srcdir/../lang-default
|
||||
|
||||
tmp=t-ln.$$
|
||||
|
||||
test_failure=0
|
||||
@@ -20,14 +23,6 @@ if test $test_failure = 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure we get English translations.
|
||||
LANGUAGE=C
|
||||
export LANGUAGE
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
|
||||
fail=0
|
||||
ln -sf a b > err 2>&1 && fail=1
|
||||
case `cat err` in
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@@ -6,6 +6,8 @@ if test "$VERBOSE" = yes; then
|
||||
ls --version
|
||||
fi
|
||||
|
||||
. $srcdir/../lang-default
|
||||
|
||||
tmp=t-ls.$$
|
||||
|
||||
framework_failure=0
|
||||
@@ -20,9 +22,6 @@ if test $framework_failure = 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LANGUAGE=C; export LANGUAGE
|
||||
LANG=C; export LANG
|
||||
|
||||
fail=0
|
||||
set `ls -l symlink/`
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user