mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
81 Commits
FILEUTILS-
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e2e012dc9 | ||
|
|
3962d775bf | ||
|
|
1faa6a399a | ||
|
|
98a1d5e72a | ||
|
|
985cf06296 | ||
|
|
377d7cdb85 | ||
|
|
86c8226819 | ||
|
|
e5f1a12c6b | ||
|
|
c588f96c37 | ||
|
|
51cee2cf8d | ||
|
|
b0619089c9 | ||
|
|
e78fd6ee39 | ||
|
|
2e8629e442 | ||
|
|
111cdb39c3 | ||
|
|
1b306b070e | ||
|
|
70ac95bbb2 | ||
|
|
43585ddb5e | ||
|
|
410cb32814 | ||
|
|
ea146bfd07 | ||
|
|
534576fad0 | ||
|
|
6f7ac74eb3 | ||
|
|
f6639dbe36 | ||
|
|
f29147b4a1 | ||
|
|
757e85d993 | ||
|
|
b662dfc657 | ||
|
|
8cb9b753c5 | ||
|
|
2d5e52c70d | ||
|
|
4eb4f8c624 | ||
|
|
59ee5c9f35 | ||
|
|
209099c9d9 | ||
|
|
8f245c6f2c | ||
|
|
8208033b86 | ||
|
|
afa54698c9 | ||
|
|
a4791b30ea | ||
|
|
f06a2374fd | ||
|
|
ff9eb12809 | ||
|
|
472729831e | ||
|
|
4fc0af40aa | ||
|
|
11c6d21d52 | ||
|
|
ab2c79328e | ||
|
|
40acdda1b3 | ||
|
|
ad435461eb | ||
|
|
8b59f3a9e5 | ||
|
|
1a0017092d | ||
|
|
769aaffc24 | ||
|
|
2981d74992 | ||
|
|
5ccb8ddd83 | ||
|
|
6aff8653fe | ||
|
|
42cfd00757 | ||
|
|
3cec0fda7b | ||
|
|
4957557813 | ||
|
|
619bbd4ce6 | ||
|
|
15a9b83bdd | ||
|
|
d73513786d | ||
|
|
8ccf29f7fe | ||
|
|
c8afcbe2e7 | ||
|
|
37cbfc8c6b | ||
|
|
40b91250bc | ||
|
|
87da84ba81 | ||
|
|
8b45419759 | ||
|
|
9ca281e5b3 | ||
|
|
d2586a214a | ||
|
|
429093f9ad | ||
|
|
35aaf0b09d | ||
|
|
3ed09573d7 | ||
|
|
449fa131d6 | ||
|
|
0de83d1d81 | ||
|
|
2aeb21d67a | ||
|
|
dfdfbc22b3 | ||
|
|
5f3b8f3038 | ||
|
|
f29de82520 | ||
|
|
1117d0586a | ||
|
|
36595ef3f7 | ||
|
|
b8c130d091 | ||
|
|
b5431fdfdf | ||
|
|
24f2bd8c9f | ||
|
|
ac81803363 | ||
|
|
b2c7c6055d | ||
|
|
c75dc9689e | ||
|
|
02f7878928 | ||
|
|
a311f0eac5 |
2
THANKS
2
THANKS
@@ -15,6 +15,7 @@ Andreas Luik luik@isa.de
|
||||
Andreas Schwab schwab@suse.de
|
||||
Andreas Stolcke stolcke@ICSI.Berkeley.EDU
|
||||
Andres Soolo andres@soolo.matti.ee
|
||||
Andrew Burgess aab@cichlid.com
|
||||
Andrew Dalke dalke@bioreason.com
|
||||
Andrew Tridgell tridge@samba.org
|
||||
Andries Brouwer Andries.Brouwer@cwi.nl
|
||||
@@ -153,6 +154,7 @@ Marc Olzheim marcolz@stack.nl
|
||||
Marco Franzen Marco.Franzen@Thyron.com
|
||||
Marcus Daniels marcus@ee.pdx.edu
|
||||
Mark A. Thomas thommark@access.digex.net
|
||||
Mark D. Roth roth@uiuc.edu
|
||||
Mark Harris mark@monitor.designacc.com
|
||||
Mark Hewitt mhewitt@armature.com
|
||||
Mark Kettenis kettenis@phys.uva.nl
|
||||
|
||||
@@ -1,3 +1,37 @@
|
||||
2000-06-04 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* getugroups.c (getugroups): Cast -1 to gid_t, for systems like
|
||||
SunOS4.1.4 for which gid_t is an unsigned type.
|
||||
|
||||
2000-06-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* strnlen.c [!HAVE_DECL_MEMCHR]: Declare memchr.
|
||||
|
||||
2000-05-26 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* Makefile.am (install-exec-local): On systems with glibc-2.1 or
|
||||
newer, don't install charset.alias.
|
||||
* config.charset: Change the Linux/glibc rules so they become empty
|
||||
on glibc-2.1 or newer.
|
||||
|
||||
2000-06-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* mountlist.c: Back out last change. Instead, do this...
|
||||
* mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Set the me_dummy
|
||||
member using the same `ignore'-testing code.
|
||||
* mountlist.h (ME_DUMMY): Add `autofs' to the list of ignored
|
||||
fs_type strings.
|
||||
From Mark D. Roth.
|
||||
|
||||
2000-05-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Ignore mounts
|
||||
with the `ignore' attribute. Based on a patch from Mark D. Roth.
|
||||
|
||||
2000-05-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* makepath.c: Remove old, now-unnecessary `#ifdef __MSDOS__' block.
|
||||
|
||||
2000-05-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* hash.c (hash_rehash): Fix a nasty bug: copy the free entry list
|
||||
|
||||
@@ -59,6 +59,8 @@ stat.c: xstat.in
|
||||
# which is shared with other installed packages. We use a list of referencing
|
||||
# packages so that "make uninstall" will remove the file if and only if it
|
||||
# is not used by another installed package.
|
||||
# On systems with glibc-2.1 or newer, the file is redundant, therefore we
|
||||
# avoid installing it.
|
||||
|
||||
all-local: charset.alias ref-add.sed ref-del.sed
|
||||
|
||||
@@ -66,12 +68,17 @@ charset_alias = $(DESTDIR)$(libdir)/charset.alias
|
||||
charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
|
||||
install-exec-local: all-local
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
test -f $(charset_alias) \
|
||||
&& orig=$(charset_alias) \
|
||||
|| orig=charset.alias; \
|
||||
sed -f ref-add.sed $$orig > $(charset_tmp)
|
||||
$(INSTALL_DATA) $(charset_tmp) $(charset_alias)
|
||||
rm -f $(charset_tmp)
|
||||
if test -f $(charset_alias); then \
|
||||
sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
|
||||
$(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
|
||||
rm -f $(charset_tmp) ; \
|
||||
else \
|
||||
if test @GLIBC21@ = no; then \
|
||||
sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
|
||||
$(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
|
||||
rm -f $(charset_tmp) ; \
|
||||
fi ; \
|
||||
fi
|
||||
|
||||
uninstall-local: all-local
|
||||
if test -f $(charset_alias); then \
|
||||
|
||||
@@ -797,16 +797,23 @@ stat.c: xstat.in
|
||||
# which is shared with other installed packages. We use a list of referencing
|
||||
# packages so that "make uninstall" will remove the file if and only if it
|
||||
# is not used by another installed package.
|
||||
# On systems with glibc-2.1 or newer, the file is redundant, therefore we
|
||||
# avoid installing it.
|
||||
|
||||
all-local: charset.alias ref-add.sed ref-del.sed
|
||||
install-exec-local: all-local
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
test -f $(charset_alias) \
|
||||
&& orig=$(charset_alias) \
|
||||
|| orig=charset.alias; \
|
||||
sed -f ref-add.sed $$orig > $(charset_tmp)
|
||||
$(INSTALL_DATA) $(charset_tmp) $(charset_alias)
|
||||
rm -f $(charset_tmp)
|
||||
if test -f $(charset_alias); then \
|
||||
sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
|
||||
$(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
|
||||
rm -f $(charset_tmp) ; \
|
||||
else \
|
||||
if test @GLIBC21@ = no; then \
|
||||
sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
|
||||
$(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
|
||||
rm -f $(charset_tmp) ; \
|
||||
fi ; \
|
||||
fi
|
||||
|
||||
uninstall-local: all-local
|
||||
if test -f $(charset_alias); then \
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
# The current list of GNU canonical charset names is as follows.
|
||||
#
|
||||
# name used by which systems a MIME name?
|
||||
# ASCII glibc solaris
|
||||
# ASCII, ANSI_X3.4-1968 glibc solaris
|
||||
# ISO-8859-1 glibc aix hpux irix osf solaris yes
|
||||
# ISO-8859-2 glibc aix hpux irix solaris yes
|
||||
# ISO-8859-4 solaris yes
|
||||
@@ -72,6 +72,9 @@
|
||||
# Note: Names which are not marked as being a MIME name should not be used in
|
||||
# Internet protocols for information interchange (mail, news, etc.).
|
||||
#
|
||||
# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||
# must understand both names and treat them as equivalent.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
@@ -86,11 +89,12 @@ echo "# It was automatically generated from config.charset."
|
||||
echo "# Packages using this file: "
|
||||
case "$os" in
|
||||
linux* | *-gnu*)
|
||||
# With glibc we don't need any canonicalization, because glibc
|
||||
# supports all GNU canonical names directly.
|
||||
echo "ANSI_X3.4-1968 ASCII" # this is a nop
|
||||
echo "ISO_646.IRV:1983 ASCII" # this is a nop
|
||||
echo "BALTIC ISO-8859-13" # in glibc-2.2 or newer, this is a nop
|
||||
# With glibc-2.1 or newer, we don't need any canonicalization,
|
||||
# because glibc has iconv and both glibc and libiconv support all
|
||||
# GNU canonical names directly. Therefore, the Makefile does not
|
||||
# need to install the alias file at all.
|
||||
# The following applies only to glibc-2.0.x and older libcs.
|
||||
echo "ISO_646.IRV:1983 ASCII"
|
||||
;;
|
||||
aix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* getugroups.c -- return a list of the groups a user is in
|
||||
Copyright (C) 1990, 1991, 1998, 1999 Free Software Foundation.
|
||||
Copyright (C) 1990, 1991, 1998, 1999, 2000 Free Software Foundation.
|
||||
|
||||
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
|
||||
@@ -57,7 +57,7 @@ getugroups (int maxcount, GETGROUPS_T *grouplist, char *username, gid_t gid)
|
||||
register char **cp;
|
||||
register int count = 0;
|
||||
|
||||
if (gid != -1)
|
||||
if (gid != (gid_t) -1)
|
||||
{
|
||||
if (maxcount != 0)
|
||||
grouplist[count] = gid;
|
||||
|
||||
@@ -114,11 +114,6 @@ extern int errno;
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
|
||||
#ifdef __MSDOS__
|
||||
typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
#endif
|
||||
|
||||
#include "save-cwd.h"
|
||||
#include "error.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* mountlist.c -- return a list of mounted filesystems
|
||||
Copyright (C) 1991, 1992, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 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
|
||||
@@ -40,7 +40,6 @@ char *strstr ();
|
||||
char *xmalloc ();
|
||||
char *xrealloc ();
|
||||
char *xstrdup ();
|
||||
void error ();
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
@@ -725,6 +724,8 @@ read_filesystem_list (int need_fs_type)
|
||||
for (thisent = entries; thisent < entries + bufsize;
|
||||
thisent += vmp->vmt_length)
|
||||
{
|
||||
char *options, *ignore;
|
||||
|
||||
vmp = (struct vmount *) thisent;
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
if (vmp->vmt_flags & MNT_REMOTE)
|
||||
@@ -748,7 +749,12 @@ read_filesystem_list (int need_fs_type)
|
||||
}
|
||||
me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
|
||||
me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
|
||||
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
|
||||
options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
|
||||
ignore = strstr (options, "ignore");
|
||||
me->me_dummy = (ignore
|
||||
&& (ignore == options || ignore[-1] == ',')
|
||||
&& (ignore[sizeof "ignore" - 1] == ','
|
||||
|| ignore[sizeof "ignore" - 1] == '\0'));
|
||||
me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */
|
||||
|
||||
/* Add to the linked list. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* mountlist.h -- declarations for list of mounted filesystems
|
||||
Copyright (C) 1991, 1992, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 1998, 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
|
||||
@@ -39,7 +39,10 @@ struct mount_entry *read_filesystem_list PARAMS ((int need_fs_type));
|
||||
|
||||
#ifndef ME_DUMMY
|
||||
# define ME_DUMMY(fs_name, fs_type) \
|
||||
(!strcmp (fs_type, "auto") || !strcmp (fs_type, "ignore"))
|
||||
(!strcmp (fs_type, "auto") \
|
||||
|| !strcmp (fs_type, "autofs") \
|
||||
/* for Irix 6.5 */ \
|
||||
|| !strcmp (fs_type, "ignore"))
|
||||
#endif
|
||||
|
||||
#ifndef ME_REMOTE
|
||||
|
||||
@@ -19,6 +19,13 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifndef HAVE_DECL_MEMCHR
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_MEMCHR
|
||||
char *memchr ();
|
||||
#endif
|
||||
|
||||
#undef __strnlen
|
||||
#undef strnlen
|
||||
|
||||
|
||||
45
m4/ChangeLog
45
m4/ChangeLog
@@ -1,3 +1,48 @@
|
||||
2000-06-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* prereq.m4 (jm_PREREQ_HUMAN): Use []-quoted list in AC_CHECK_DECLS,
|
||||
now that autoconf requires that.
|
||||
|
||||
* jm-glibc-io.m4: Add a kludge to make autoheader emit the required
|
||||
#undefs. E.g., #undef HAVE_DECL_FERROR_UNLOCKED.
|
||||
Use []-quoted list in AC_CHECK_DECLS, now that autoconf requires that.
|
||||
|
||||
2000-05-26 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* glibc21.m4: New file.
|
||||
* jm-macros.m4: (jm_MACROS): Call jm_GLIBC21.
|
||||
|
||||
2000-05-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* jm-macros.m4 (AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): Rename from
|
||||
jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK.
|
||||
* stat.m4: Likewise.
|
||||
* lstat.m4: Likewise.
|
||||
* lstat-slash.m4: Remove file (absorbed into autoconf).
|
||||
|
||||
* jm-macros.m4 (AC_FUNC_STRERROR_R): Rename from jm_FUNC_STRERROR_R.
|
||||
* strerror_r.m4: Remove file (absorbed into autoconf).
|
||||
|
||||
2000-05-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* uptime.m4: Use `$cross_compiling', not `$ac_cv_prog_cc_cross'.
|
||||
|
||||
2000-05-24 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* prereq.m4: Use []-quoted list in AC_CHECK_MEMBERS, now that
|
||||
autoconf requires that.
|
||||
* lib-check.m4: Likewise.
|
||||
* jm-macros.m4: Likewise.
|
||||
* strftime.m4: Likewise.
|
||||
|
||||
* check-decl.m4 (jm_CHECK_DECLS): Use []-quoted list in AC_CHECK_DECLS,
|
||||
now that autoconf requires that.
|
||||
|
||||
2000-05-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* stat.m4: Require jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK.
|
||||
* lstat.m4: Likewise.
|
||||
|
||||
2000-05-20 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* prereq.m4 (jm_PREREQ_HUMAN): New macro.
|
||||
|
||||
@@ -20,6 +20,7 @@ getgroups.m4 \
|
||||
getline.m4 \
|
||||
getloadavg.m4 \
|
||||
glibc.m4 \
|
||||
glibc21.m4 \
|
||||
group-member.m4 \
|
||||
iconv.m4 \
|
||||
inttypes_h.m4 \
|
||||
@@ -36,7 +37,6 @@ lib-check.m4 \
|
||||
libintl.m4 \
|
||||
link-follow.m4 \
|
||||
ls-mntd-fs.m4 \
|
||||
lstat-slash.m4 \
|
||||
lstat.m4 \
|
||||
malloc.m4 \
|
||||
memcmp.m4 \
|
||||
@@ -53,7 +53,6 @@ search-libs.m4 \
|
||||
st_dm_mode.m4 \
|
||||
st_mtim.m4 \
|
||||
stat.m4 \
|
||||
strerror_r.m4 \
|
||||
strftime.m4 \
|
||||
timespec.m4 \
|
||||
uintmax_t.m4 \
|
||||
|
||||
@@ -133,6 +133,7 @@ getgroups.m4 \
|
||||
getline.m4 \
|
||||
getloadavg.m4 \
|
||||
glibc.m4 \
|
||||
glibc21.m4 \
|
||||
group-member.m4 \
|
||||
iconv.m4 \
|
||||
inttypes_h.m4 \
|
||||
@@ -149,7 +150,6 @@ lib-check.m4 \
|
||||
libintl.m4 \
|
||||
link-follow.m4 \
|
||||
ls-mntd-fs.m4 \
|
||||
lstat-slash.m4 \
|
||||
lstat.m4 \
|
||||
malloc.m4 \
|
||||
memcmp.m4 \
|
||||
@@ -166,7 +166,6 @@ search-libs.m4 \
|
||||
st_dm_mode.m4 \
|
||||
st_mtim.m4 \
|
||||
stat.m4 \
|
||||
strerror_r.m4 \
|
||||
strftime.m4 \
|
||||
timespec.m4 \
|
||||
uintmax_t.m4 \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 11
|
||||
#serial 12
|
||||
|
||||
dnl This is just a wrapper function to encapsulate this kludge.
|
||||
dnl Putting it in a separate file like this helps share it between
|
||||
@@ -43,7 +43,7 @@ AC_DEFUN(jm_CHECK_DECLS,
|
||||
#endif
|
||||
'
|
||||
|
||||
AC_CHECK_DECLS((
|
||||
AC_CHECK_DECLS([
|
||||
free,
|
||||
getenv,
|
||||
geteuid,
|
||||
@@ -59,7 +59,7 @@ AC_DEFUN(jm_CHECK_DECLS,
|
||||
strstr,
|
||||
strtoul,
|
||||
strtoull,
|
||||
ttyname), , , $headers)
|
||||
ttyname], , , $headers)
|
||||
])
|
||||
|
||||
dnl FIXME: when autoconf has support for it.
|
||||
|
||||
26
m4/glibc21.m4
Normal file
26
m4/glibc21.m4
Normal file
@@ -0,0 +1,26 @@
|
||||
#serial 1
|
||||
|
||||
# Test for the GNU C Library, version 2.1 or newer.
|
||||
# From Bruno Haible.
|
||||
|
||||
AC_DEFUN(jm_GLIBC21,
|
||||
[
|
||||
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
|
||||
ac_cv_gnu_library_2_1,
|
||||
[AC_EGREP_CPP([Lucky GNU user],
|
||||
[
|
||||
#include <features.h>
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
|
||||
Lucky GNU user
|
||||
#endif
|
||||
#endif
|
||||
],
|
||||
ac_cv_gnu_library_2_1=yes,
|
||||
ac_cv_gnu_library_2_1=no)
|
||||
]
|
||||
)
|
||||
AC_DEFINE_UNQUOTED(GLIBC21, $ac_cv_gnu_library_2_1,
|
||||
[we use GNU C Library 2.1 or newer])
|
||||
]
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 3
|
||||
#serial 4
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
@@ -8,6 +8,13 @@ dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
|
||||
[
|
||||
# Kludge (not executed) to make autoheader do the right thing.
|
||||
if test a = b; then
|
||||
AC_CHECK_DECLS([clearerr_unlocked, feof_unlocked, ferror_unlocked,
|
||||
fflush_unlocked, fputc_unlocked, fread_unlocked, fwrite_unlocked,
|
||||
getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked])
|
||||
fi
|
||||
|
||||
io_functions='clearerr_unlocked feof_unlocked ferror_unlocked
|
||||
fflush_unlocked fputc_unlocked fread_unlocked fwrite_unlocked
|
||||
getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked'
|
||||
@@ -16,7 +23,7 @@ AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
|
||||
# Otherwise, we'd get the Solaris5.5.1 functions that are not
|
||||
# declared, and that have been removed from Solaris5.6. The resulting
|
||||
# 5.5.1 binaries would not run on 5.6 due to shared library differences.
|
||||
AC_CHECK_DECLS(($jm_io_func),
|
||||
AC_CHECK_DECLS([$jm_io_func],
|
||||
jm_declared=yes,
|
||||
jm_declared=no,
|
||||
[#include <stdio.h>])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 17
|
||||
#serial 19
|
||||
|
||||
dnl Misc type-related macros for fileutils, sh-utils, textutils.
|
||||
|
||||
@@ -74,11 +74,11 @@ AC_DEFUN(jm_MACROS,
|
||||
AC_REQUIRE([jm_FUNC_CHOWN])
|
||||
AC_REQUIRE([jm_FUNC_MKTIME])
|
||||
AC_REQUIRE([jm_FUNC_LSTAT])
|
||||
AC_REQUIRE([jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
|
||||
AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
|
||||
AC_REQUIRE([jm_FUNC_STAT])
|
||||
AC_REQUIRE([jm_FUNC_REALLOC])
|
||||
AC_REQUIRE([jm_FUNC_MALLOC])
|
||||
AC_REQUIRE([jm_FUNC_STRERROR_R])
|
||||
AC_REQUIRE([AC_FUNC_STRERROR_R])
|
||||
AC_REQUIRE([jm_FUNC_NANOSLEEP])
|
||||
AC_REQUIRE([jm_FUNC_READDIR])
|
||||
AC_REQUIRE([jm_FUNC_MEMCMP])
|
||||
@@ -188,7 +188,7 @@ AC_DEFUN(jm_MACROS,
|
||||
test $am_cv_func_strtod_needs_libm = yes && POW_LIBM=-lm
|
||||
|
||||
jm_LANGINFO_CODESET
|
||||
|
||||
jm_GLIBC21
|
||||
jm_ICONV
|
||||
|
||||
# These tests are for df.
|
||||
@@ -232,7 +232,7 @@ AC_DEFUN(jm_CHECK_ALL_TYPES,
|
||||
|
||||
AC_REQUIRE([AC_HEADER_DIRENT])
|
||||
AC_REQUIRE([AC_HEADER_STDC])
|
||||
AC_CHECK_MEMBERS((struct stat.st_blksize),,,[$ac_includes_default
|
||||
AC_CHECK_MEMBERS([struct stat.st_blksize],,,[$ac_includes_default
|
||||
#include <sys/stat.h>
|
||||
])
|
||||
AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 3
|
||||
#serial 4
|
||||
|
||||
dnl Misc lib-related macros for fileutils, sh-utils, textutils.
|
||||
|
||||
@@ -51,7 +51,7 @@ $ac_includes_default
|
||||
# include <shadow.h>
|
||||
#endif
|
||||
"
|
||||
AC_CHECK_MEMBERS((struct spwd.sp_pwdp),,,[$shadow_includes])
|
||||
AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
|
||||
AC_CHECK_FUNCS(getspnam)
|
||||
|
||||
# SCO-ODT-3.0 is reported to need -lufc for crypt.
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl FIXME: describe
|
||||
|
||||
AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
|
||||
[
|
||||
AC_CACHE_CHECK(
|
||||
[whether lstat dereferences a symlink specified with a trailing slash],
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink,
|
||||
[
|
||||
rm -f conftest.sym conftest.file
|
||||
: > conftest.file
|
||||
if ln -s conftest.file conftest.sym; then
|
||||
AC_TRY_RUN([
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct stat sbuf;
|
||||
/* Linux will dereference the symlink and fail.
|
||||
That is better in the sense that it means we will not
|
||||
have to compile and use the lstat wrapper. */
|
||||
exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
|
||||
}
|
||||
],
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink=yes,
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink=no,
|
||||
dnl When crosscompiling, be pessimistic so we will end up using the
|
||||
dnl replacement version of lstat that checkes for trailing slashes
|
||||
dnl and calls lstat a second time when necessary.
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink=no
|
||||
)
|
||||
else
|
||||
# If the `ln -s' command failed, then we probably don't even
|
||||
# have an lstat function.
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink=no
|
||||
fi
|
||||
])
|
||||
|
||||
test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \
|
||||
&& zero_one=1 \
|
||||
|| zero_one=0
|
||||
AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one,
|
||||
[Define if lstat dereferences a symlink specified with a trailing slash])
|
||||
|
||||
if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then
|
||||
AC_SUBST(LIBOBJS)
|
||||
# Append lstat.o if it's not already in $LIBOBJS.
|
||||
case "$LIBOBJS" in
|
||||
*lstat.$ac_objext*) ;;
|
||||
*) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 3
|
||||
#serial 5
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl Determine whether lstat has the bug that it succeeds when given the
|
||||
@@ -11,6 +11,7 @@ dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_LSTAT,
|
||||
[
|
||||
AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
|
||||
AC_CACHE_CHECK([whether lstat accepts an empty string],
|
||||
jm_cv_func_lstat_empty_string_bug,
|
||||
[AC_TRY_RUN([
|
||||
|
||||
12
m4/prereq.m4
12
m4/prereq.m4
@@ -1,4 +1,4 @@
|
||||
#serial 7
|
||||
#serial 9
|
||||
|
||||
dnl These are the prerequisite macros for files in the lib/
|
||||
dnl directories of the fileutils, sh-utils, and textutils packages.
|
||||
@@ -43,7 +43,7 @@ AC_DEFUN(jm_PREREQ_CANON_HOST,
|
||||
AC_DEFUN(jm_PREREQ_HUMAN,
|
||||
[
|
||||
AC_CHECK_HEADERS(limits.h stdlib.h string.h)
|
||||
AC_CHECK_DECLS((getenv))
|
||||
AC_CHECK_DECLS([getenv])
|
||||
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
|
||||
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
|
||||
])
|
||||
@@ -79,10 +79,10 @@ $ac_includes_default
|
||||
# include <utmp.h>
|
||||
#endif
|
||||
"
|
||||
AC_CHECK_MEMBERS((struct utmpx.ut_user),,,[$utmp_includes])
|
||||
AC_CHECK_MEMBERS((struct utmp.ut_user),,,[$utmp_includes])
|
||||
AC_CHECK_MEMBERS((struct utmpx.ut_name),,,[$utmp_includes])
|
||||
AC_CHECK_MEMBERS((struct utmp.ut_name),,,[$utmp_includes])
|
||||
AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
|
||||
AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
|
||||
AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
|
||||
AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_REGEX,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 3
|
||||
#serial 5
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl Determine whether stat has the bug that it succeeds when given the
|
||||
@@ -11,6 +11,7 @@ dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_STAT,
|
||||
[
|
||||
AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
|
||||
AC_CACHE_CHECK([whether stat accepts an empty string],
|
||||
jm_cv_func_stat_empty_string_bug,
|
||||
[AC_TRY_RUN([
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#serial 2
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl Determine whether the strerror_r implementation is one of
|
||||
dnl the broken ones that returns `int' rather than `char*'.
|
||||
dnl Actually, this tests only whether it returns a scalar
|
||||
dnl or an array, but that should be enough.
|
||||
dnl On at least DEC UNIX 4.0[A-D] and HP-UX B.10.20, strerror_r
|
||||
dnl returns `int'. This is used by lib/error.c.
|
||||
|
||||
AC_DEFUN(jm_FUNC_STRERROR_R,
|
||||
[
|
||||
# Check strerror_r
|
||||
AC_CHECK_FUNCS([strerror_r])
|
||||
if test $ac_cv_func_strerror_r = yes; then
|
||||
AC_CHECK_HEADERS(string.h)
|
||||
AC_CACHE_CHECK([for working strerror_r],
|
||||
jm_cv_func_working_strerror_r,
|
||||
[
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
# include <stdio.h>
|
||||
# if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# endif
|
||||
],
|
||||
[
|
||||
int buf; /* avoiding square brackets makes this easier */
|
||||
char x = *strerror_r (0, buf, sizeof buf);
|
||||
],
|
||||
jm_cv_func_working_strerror_r=yes,
|
||||
jm_cv_func_working_strerror_r=no
|
||||
)
|
||||
if test $jm_cv_func_working_strerror_r = yes; then
|
||||
AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
|
||||
[Define to 1 if strerror_r returns a string.])
|
||||
fi
|
||||
])
|
||||
fi
|
||||
])
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 13
|
||||
#serial 14
|
||||
|
||||
dnl This macro is intended to be used solely in this file.
|
||||
dnl These are the prerequisite macros for GNU's strftime.c replacement.
|
||||
@@ -16,7 +16,7 @@ AC_DEFUN(_jm_STRFTIME_PREREQS,
|
||||
|
||||
AC_CHECK_FUNCS(mblen mbrlen)
|
||||
|
||||
AC_CHECK_MEMBER(struct tm.tm_gmtoff,
|
||||
AC_CHECK_MEMBER([struct tm.tm_gmtoff],
|
||||
[AC_DEFINE(HAVE_TM_GMTOFF, 1,
|
||||
[Define if struct tm has the tm_gmtoff member.])],
|
||||
,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 2
|
||||
#serial 3
|
||||
|
||||
AC_PREREQ(2.13)
|
||||
|
||||
@@ -8,7 +8,7 @@ AC_DEFUN(jm_SYS_PROC_UPTIME,
|
||||
AC_CACHE_CHECK([for /proc/uptime], jm_cv_have_proc_uptime,
|
||||
[jm_cv_have_proc_uptime=no
|
||||
test -f /proc/uptime \
|
||||
&& test $ac_cv_prog_cc_cross = no \
|
||||
&& test $cross_compiling = no \
|
||||
&& cat < /proc/uptime >/dev/null 2>/dev/null \
|
||||
&& jm_cv_have_proc_uptime=yes])
|
||||
if test $jm_cv_have_proc_uptime = yes; then
|
||||
|
||||
@@ -1,3 +1,47 @@
|
||||
2000-06-04 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0t.
|
||||
|
||||
* src/df.c (show_point) [HAVE_REALPATH && !HAVE_RESOLVEPATH]:
|
||||
Cast undeclared `realpath' to char* to avoid warning.
|
||||
|
||||
2000-06-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/install.c (usage): Document that -v is a synonym for --verbose.
|
||||
* src/mkdir.c: Allow -v as synonym for --verbose, to be consistent
|
||||
with other fileutils.
|
||||
* src/rmdir.c: Likewise.
|
||||
Suggestion from François Pinard.
|
||||
|
||||
2000-06-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add Danish (da).
|
||||
|
||||
2000-05-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
Allow `cp -d -u' to copy one symlink onto another that's identical.
|
||||
* src/copy.c (copy_internal): Change the || to ^ in the big sameness
|
||||
test, so copying one symlink onto another, identical one doesn't fail
|
||||
here.
|
||||
If the symlink call fails, don't report the failure if the destination
|
||||
already exists and is a symlink pointing to the proper name.
|
||||
Reported by Andrew Burgess.
|
||||
* tests/cp/slink-2-slink: New test.
|
||||
* tests/cp/Makefile.am (TESTS): Add slink-2-slink.
|
||||
* tests/cp/same-file: Adapt to fit new semantics of `cp -d'.
|
||||
|
||||
2000-05-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/dd.c (close_stdout_wrapper): Don't dereference NULL pointer.
|
||||
From Bob Proulx.
|
||||
|
||||
2000-05-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/shred/remove: Add traps to clean up.
|
||||
Correct broken running-as-root test.
|
||||
|
||||
* tests/mv/i-2: Exit 77 when run as root. Reported by Andreas Schwab.
|
||||
|
||||
2000-05-20 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0s.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
Changes in release 4.1:
|
||||
[4.0t]
|
||||
* rmdir and mkdir accept -v as synonym for --verbose
|
||||
[4.0s]
|
||||
* rm no longer segfaults on certain very deep hierarchies
|
||||
* IMPORTANT SECURITY FIX: a running `rm -r' may no longer be subverted to
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
2000-05-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/nice: Remove now-unused reference to srcdir.
|
||||
|
||||
* src/help-version: Use `WARNING', not just `Warning' in the
|
||||
broken-/bin/sh diagnostic, to be consistent with other such warnings.
|
||||
|
||||
2000-05-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/nice: Disable test on djgpp.
|
||||
|
||||
2000-05-15 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/date/Test.pm (test_vector): Skip the %c test on SunOS4 systems.
|
||||
|
||||
@@ -1,3 +1,54 @@
|
||||
2000-05-27 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/tail.c: Arrange to call close_stdout upon exit.
|
||||
Don't close stdout explicitly.
|
||||
(usage): Add missing backslash at end of line.
|
||||
(write_header): Remove now-unused COMMENT parameter.
|
||||
Update all callers.
|
||||
|
||||
2000-05-24 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/head.c (head_file): Use STDIN_FILENO in place of `0'.
|
||||
(main): Likewise.
|
||||
|
||||
2000-05-20 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/cat.c: Arrange to call close_stdout upon exit.
|
||||
Don't close stdout explicitly. Replace uses of global constant,
|
||||
output_desc, with uses of STDOUT_FILENO.
|
||||
|
||||
* src/tail.c: FIXME
|
||||
|
||||
Arrange to call close_stdout upon exit. Don't close stdout explicitly.
|
||||
* src/cksum.c: Likewise.
|
||||
* src/comm.c: Likewise.
|
||||
* src/csplit.c: Likewise.
|
||||
* src/cut.c: Likewise.
|
||||
* src/expand.c: Likewise.
|
||||
* src/fmt.c: Likewise.
|
||||
* src/fold.c: Likewise.
|
||||
* src/head.c: Likewise.
|
||||
* src/join.c: Likewise.
|
||||
* src/md5sum.c: Likewise.
|
||||
* src/nl.c: Likewise.
|
||||
* src/od.c: Likewise.
|
||||
* src/paste.c: Likewise.
|
||||
* src/pr.c: Likewise.
|
||||
* src/ptx.c: Likewise.
|
||||
* src/sort.c: Likewise. (but set exit status and file name, too)
|
||||
* src/split.c: Likewise.
|
||||
* src/sum.c: Likewise.
|
||||
* src/tac.c: Likewise.
|
||||
* src/tr.c: Likewise.
|
||||
* src/tsort.c: Likewise.
|
||||
* src/unexpand.c: Likewise.
|
||||
* src/uniq.c: Likewise.
|
||||
* src/wc.c:: Likewise.
|
||||
|
||||
2000-05-13 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/help-version: Run each program successfully at least once.
|
||||
|
||||
2000-05-12 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/head.c (string_to_integer): Restrict base to 10.
|
||||
|
||||
46
src/cat.c
46
src/cat.c
@@ -1,5 +1,5 @@
|
||||
/* cat -- concatenate files and print on the standard output.
|
||||
Copyright (C) 88, 90, 91, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 88, 90, 91, 1995-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
|
||||
@@ -31,6 +31,7 @@
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
@@ -54,9 +55,6 @@ static char *infile;
|
||||
/* Descriptor on which input file is open. */
|
||||
static int input_desc;
|
||||
|
||||
/* Descriptor on which output file is open. Always is 1. */
|
||||
static int output_desc;
|
||||
|
||||
/* Buffer for line numbers. */
|
||||
static char line_buf[13] =
|
||||
{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0', '\t', '\0'};
|
||||
@@ -136,8 +134,7 @@ next_line_num (void)
|
||||
line_num_print--;
|
||||
}
|
||||
|
||||
/* Plain cat. Copies the file behind `input_desc' to the file behind
|
||||
`output_desc'. */
|
||||
/* Plain cat. Copies the file behind `input_desc' to STDOUT_FILENO. */
|
||||
|
||||
static void
|
||||
simple_cat (
|
||||
@@ -172,7 +169,7 @@ simple_cat (
|
||||
|
||||
/* Write this block out. */
|
||||
|
||||
if (full_write (output_desc, buf, n_read) < 0)
|
||||
if (full_write (STDOUT_FILENO, buf, n_read) < 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
}
|
||||
@@ -253,7 +250,7 @@ cat (
|
||||
unsigned char *wp = outbuf;
|
||||
do
|
||||
{
|
||||
if (full_write (output_desc, wp, outsize) < 0)
|
||||
if (full_write (STDOUT_FILENO, wp, outsize) < 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
wp += outsize;
|
||||
}
|
||||
@@ -306,7 +303,7 @@ cat (
|
||||
{
|
||||
int n_write = bpout - outbuf;
|
||||
|
||||
if (full_write (output_desc, outbuf, n_write) < 0)
|
||||
if (full_write (STDOUT_FILENO, outbuf, n_write) < 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
bpout = outbuf;
|
||||
}
|
||||
@@ -465,6 +462,17 @@ cat (
|
||||
}
|
||||
}
|
||||
|
||||
/* This is gross, but necessary, because of the way close_stdout
|
||||
works and because this program closes STDOUT_FILENO directly. */
|
||||
static void (*closeout_func) (void) = close_stdout;
|
||||
|
||||
static void
|
||||
close_stdout_wrapper (void)
|
||||
{
|
||||
if (closeout_func)
|
||||
(*closeout_func) ();
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -537,6 +545,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
/* Parse command line options. */
|
||||
|
||||
while ((c = getopt_long (argc, argv,
|
||||
@@ -622,11 +632,11 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
output_desc = 1;
|
||||
closeout_func = NULL;
|
||||
|
||||
/* Get device, i-node number, and optimal blocksize of output. */
|
||||
|
||||
if (fstat (output_desc, &stat_buf) < 0)
|
||||
if (fstat (STDOUT_FILENO, &stat_buf) < 0)
|
||||
error (EXIT_FAILURE, errno, _("standard output"));
|
||||
|
||||
outsize = ST_BLKSIZE (stat_buf);
|
||||
@@ -659,13 +669,13 @@ main (int argc, char **argv)
|
||||
with only CR-LF is an empty line. (Besides, if they ask for
|
||||
one of these options, they don't care much about the original
|
||||
file contents anyway). */
|
||||
if ((!isatty (output_desc)
|
||||
if ((!isatty (STDOUT_FILENO)
|
||||
&& !(numbers || squeeze_empty_lines || mark_line_ends))
|
||||
|| binary_files)
|
||||
{
|
||||
/* Switch stdout to BINARY mode. */
|
||||
binary_output = 1;
|
||||
SET_BINARY (output_desc);
|
||||
SET_BINARY (STDOUT_FILENO);
|
||||
/* When stdout is in binary mode, make sure all input files are
|
||||
also read in binary mode. */
|
||||
file_open_mode |= O_BINARY;
|
||||
@@ -681,8 +691,8 @@ main (int argc, char **argv)
|
||||
|
||||
/* Setting stdin to binary switches the console device to
|
||||
raw I/O, which also affects stdout to console. Undo that. */
|
||||
if (isatty (output_desc))
|
||||
setmode (output_desc, O_TEXT);
|
||||
if (isatty (STDOUT_FILENO))
|
||||
setmode (STDOUT_FILENO, O_TEXT);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -715,7 +725,7 @@ main (int argc, char **argv)
|
||||
This is so "cat > xyzzy" creates a DOS-style text
|
||||
file, like people expect. */
|
||||
if (tty_in && optind <= argc)
|
||||
setmode (output_desc, O_TEXT);
|
||||
setmode (STDOUT_FILENO, O_TEXT);
|
||||
else
|
||||
{
|
||||
SET_BINARY (input_desc);
|
||||
@@ -756,7 +766,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (check_redirection
|
||||
&& stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino
|
||||
&& (input_desc != STDIN_FILENO || output_desc != STDOUT_FILENO))
|
||||
&& (input_desc != STDIN_FILENO))
|
||||
{
|
||||
error (0, 0, _("%s: input file is output file"), infile);
|
||||
exit_status = 1;
|
||||
@@ -816,8 +826,6 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (close (1) < 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ main ()
|
||||
# include <getopt.h>
|
||||
# include <sys/types.h>
|
||||
# include "system.h"
|
||||
# include "closeout.h"
|
||||
# include "long-options.h"
|
||||
# include "error.h"
|
||||
|
||||
@@ -293,6 +294,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
AUTHORS, usage);
|
||||
|
||||
|
||||
10
src/comm.c
10
src/comm.c
@@ -1,5 +1,5 @@
|
||||
/* comm -- compare two sorted files line by line.
|
||||
Copyright (C) 86, 90, 91, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 86, 90, 91, 1995-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
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "linebuffer.h"
|
||||
#include "error.h"
|
||||
#include "hard-locale.h"
|
||||
@@ -215,11 +216,6 @@ compare_files (char **infiles)
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
{
|
||||
error (0, errno, _("write error"));
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -233,6 +229,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
hard_LC_COLLATE = hard_locale (LC_COLLATE);
|
||||
#endif
|
||||
|
||||
26
src/copy.c
26
src/copy.c
@@ -448,7 +448,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
&& S_ISLNK (src_sb.st_mode)
|
||||
&& !S_ISLNK (dst_sb.st_mode)))
|
||||
&& !x->dereference
|
||||
&& (S_ISLNK (dst_sb.st_mode) || S_ISLNK (src_sb.st_mode)))
|
||||
&& (S_ISLNK (dst_sb.st_mode) ^ S_ISLNK (src_sb.st_mode)))
|
||||
{
|
||||
struct stat dst2_sb;
|
||||
struct stat src2_sb;
|
||||
@@ -848,8 +848,28 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
|
||||
if (symlink (link_val, dst_path))
|
||||
{
|
||||
error (0, errno, _("cannot create symbolic link `%s'"), dst_path);
|
||||
goto un_backup;
|
||||
int saved_errno = errno;
|
||||
int same_link = 0;
|
||||
if (x->update && !new_dst && S_ISLNK (dst_sb.st_mode))
|
||||
{
|
||||
/* See if the destination is already the desired symlink. */
|
||||
char *dest_link_name = (char *) alloca (PATH_MAX + 2);
|
||||
int dest_link_len = readlink (dst_path, dest_link_name,
|
||||
PATH_MAX + 1);
|
||||
if (dest_link_len > 0)
|
||||
{
|
||||
dest_link_name[dest_link_len] = '\0';
|
||||
if (STREQ (dest_link_name, link_val))
|
||||
same_link = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (! same_link)
|
||||
{
|
||||
error (0, saved_errno, _("cannot create symbolic link `%s'"),
|
||||
dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
}
|
||||
|
||||
if (x->preserve_owner_and_group)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
@@ -1383,6 +1384,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
global_argv = argv;
|
||||
controls = NULL;
|
||||
control_used = 0;
|
||||
@@ -1489,9 +1492,6 @@ main (int argc, char **argv)
|
||||
cleanup_fatal ();
|
||||
}
|
||||
|
||||
if (!suppress_count && (ferror (stdout) || fclose (stdout) == EOF))
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
@@ -698,6 +699,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
operating_mode = undefined_mode;
|
||||
|
||||
/* By default, all non-delimited lines are printed. */
|
||||
@@ -798,8 +801,6 @@ main (int argc, char **argv)
|
||||
error (0, errno, "-");
|
||||
exit_status = 1;
|
||||
}
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
2
src/dd.c
2
src/dd.c
@@ -1055,7 +1055,7 @@ static void (*closeout_func) (void) = close_stdout;
|
||||
static void
|
||||
close_stdout_wrapper (void)
|
||||
{
|
||||
if (*closeout_func)
|
||||
if (closeout_func)
|
||||
(*closeout_func) ();
|
||||
}
|
||||
|
||||
|
||||
2
src/df.c
2
src/df.c
@@ -576,7 +576,7 @@ show_point (const char *point, const struct stat *statp)
|
||||
}
|
||||
# else
|
||||
resolved = alloca (PATH_MAX + 1);
|
||||
resolved = realpath (abspoint, resolved);
|
||||
resolved = (char *) realpath (abspoint, resolved);
|
||||
resolved_len = resolved ? strlen (resolved) : -1;
|
||||
# endif
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* expand - convert tabs to spaces
|
||||
Copyright (C) 89, 91, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 91, 1995-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
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
@@ -339,6 +340,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
while ((c = getopt_long (argc, argv, "it:,0123456789", longopts, NULL)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
@@ -388,8 +391,6 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* GNU fmt -- simple text formatter.
|
||||
Copyright (C) 1994-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994-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,6 +27,7 @@
|
||||
#define word unused_word_type
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -316,6 +317,8 @@ main (register int argc, register char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
crown = tagged = split = uniform = FALSE;
|
||||
max_width = WIDTH;
|
||||
prefix = "";
|
||||
@@ -412,9 +415,6 @@ main (register int argc, register char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* fold -- wrap each input line to fit in specified width.
|
||||
Copyright (C) 91, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 91, 1995-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
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -242,6 +243,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
break_spaces = count_bytes = have_read_stdin = 0;
|
||||
|
||||
/* Turn any numeric options into -w options. */
|
||||
@@ -302,8 +305,6 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (errs == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
#include "safe-read.h"
|
||||
@@ -191,7 +192,7 @@ head_file (const char *filename, uintmax_t n_units, int count_lines)
|
||||
filename = _("standard input");
|
||||
if (print_headers)
|
||||
write_header (filename);
|
||||
return head (filename, 0, n_units, count_lines);
|
||||
return head (filename, STDIN_FILENO, n_units, count_lines);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -263,6 +264,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
have_read_stdin = 0;
|
||||
|
||||
print_headers = 0;
|
||||
@@ -381,10 +384,8 @@ main (int argc, char **argv)
|
||||
for (; optind < argc; ++optind)
|
||||
exit_status |= head_file (argv[optind], n_units, count_lines);
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
if (have_read_stdin && close (STDIN_FILENO) < 0)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ In the third format, create all components of the given DIRECTORY(ies).\n\
|
||||
to corresponding destination files\n\
|
||||
-s, --strip strip symbol tables, only for 1st and 2nd formats\n\
|
||||
-S, --suffix=SUFFIX override the usual backup suffix\n\
|
||||
--verbose print the name of each directory as it is created\n\
|
||||
-v, --verbose print the name of each directory as it is created\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "hard-locale.h"
|
||||
#include "linebuffer.h"
|
||||
@@ -737,6 +738,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
hard_LC_COLLATE = hard_locale (LC_COLLATE);
|
||||
#endif
|
||||
@@ -868,8 +871,6 @@ main (int argc, char **argv)
|
||||
error (EXIT_FAILURE, errno, "%s", names[1]);
|
||||
if ((fp1 == stdin || fp2 == stdin) && fclose (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Compute MD5 checksum of files or strings according to the definition
|
||||
of MD5 in RFC 1321 from April 1992.
|
||||
Copyright (C) 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-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
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "md5.h"
|
||||
#include "getline.h"
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
@@ -472,6 +473,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
while ((opt = getopt_long (argc, argv, "bctw", long_options, NULL)) != -1)
|
||||
switch (opt)
|
||||
{
|
||||
@@ -625,9 +628,6 @@ verifying checksums"));
|
||||
}
|
||||
}
|
||||
|
||||
if (fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ static struct option const longopts[] =
|
||||
{
|
||||
{"mode", required_argument, NULL, 'm'},
|
||||
{"parents", no_argument, NULL, 'p'},
|
||||
{"verbose", no_argument, NULL, 2},
|
||||
{"verbose", no_argument, NULL, 'v'},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
@@ -66,7 +66,7 @@ Create the DIRECTORY(ies), if they do not already exist.\n\
|
||||
\n\
|
||||
-m, --mode=MODE set permission mode (as in chmod), not rwxrwxrwx - umask\n\
|
||||
-p, --parents no error if existing, make parent directories as needed\n\
|
||||
--verbose print a message for each created directory\n\
|
||||
-v, --verbose print a message for each created directory\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
@@ -94,7 +94,7 @@ main (int argc, char **argv)
|
||||
|
||||
create_parents = 0;
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "pm:", longopts, NULL)) != -1)
|
||||
while ((optc = getopt_long (argc, argv, "pm:v", longopts, NULL)) != -1)
|
||||
{
|
||||
switch (optc)
|
||||
{
|
||||
@@ -106,7 +106,7 @@ main (int argc, char **argv)
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
break;
|
||||
case 2: /* --verbose */
|
||||
case 'v': /* --verbose */
|
||||
verbose_fmt_string = _("created directory `%s'");
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
|
||||
9
src/nl.c
9
src/nl.c
@@ -1,5 +1,5 @@
|
||||
/* nl -- number lines of files
|
||||
Copyright (C) 89, 92, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 92, 1995-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
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
@@ -362,7 +363,7 @@ static enum section
|
||||
check_section (void)
|
||||
{
|
||||
size_t len = line_buf.length - 1;
|
||||
|
||||
|
||||
if (len < 2 || memcmp (line_buf.buffer, section_del, 2))
|
||||
return Text;
|
||||
if (len == header_del_len
|
||||
@@ -453,6 +454,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
have_read_stdin = 0;
|
||||
|
||||
while ((c = getopt_long (argc, argv, "h:b:f:v:i:pl:s:w:n:d:", longopts,
|
||||
@@ -604,8 +607,6 @@ main (int argc, char **argv)
|
||||
error (0, errno, "-");
|
||||
exit_status = 1;
|
||||
}
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
8
src/od.c
8
src/od.c
@@ -1,5 +1,5 @@
|
||||
/* od -- dump files in octal and other formats
|
||||
Copyright (C) 92, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 92, 1995-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
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -1584,6 +1585,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
err = 0;
|
||||
|
||||
for (i = 0; i <= MAX_INTEGRAL_TYPE_SIZE; i++)
|
||||
@@ -1928,8 +1931,5 @@ cleanup:;
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
|
||||
if (fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (err == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
@@ -430,6 +431,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
have_read_stdin = 0;
|
||||
serial_merge = 0;
|
||||
delims = default_delims;
|
||||
@@ -474,7 +477,5 @@ main (int argc, char **argv)
|
||||
exit_status = paste_serial (argc - optind, &argv[optind]);
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
5
src/pr.c
5
src/pr.c
@@ -318,6 +318,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -853,6 +854,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
n_files = 0;
|
||||
file_names = (argc > 1
|
||||
? (char **) xmalloc ((argc - 1) * sizeof (char *))
|
||||
@@ -1162,8 +1165,6 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
if (failed_opens > 0)
|
||||
exit (EXIT_FAILURE);
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Permuted index for GNU, with keywords in their context.
|
||||
Copyright (C) 1990, 1991, 1993, 1998-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1991, 1993, 1998-2000 Free Software Foundation, Inc.
|
||||
François Pinard <pinard@iro.umontreal.ca>, 1988.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "argmatch.h"
|
||||
#include "bumpalloc.h"
|
||||
#include "diacrit.h"
|
||||
@@ -1942,6 +1943,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
#if HAVE_SETCHRCLASS
|
||||
setchrclass (NULL);
|
||||
#endif
|
||||
@@ -2111,6 +2114,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"),
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
/* FIXME: don't fclose here? */
|
||||
fclose (stdout);
|
||||
if (fopen (argv[optind], "w") == NULL)
|
||||
error (EXIT_FAILURE, errno, "%s", argv[optind]);
|
||||
|
||||
@@ -74,7 +74,7 @@ static struct option const longopts[] =
|
||||
|
||||
{"path", no_argument, NULL, 'p'},
|
||||
{"parents", no_argument, NULL, 'p'},
|
||||
{"verbose", no_argument, NULL, 14},
|
||||
{"verbose", no_argument, NULL, 'v'},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
@@ -152,7 +152,7 @@ Remove the DIRECTORY(ies), if they are empty.\n\
|
||||
-p, --parents remove DIRECTORY, then try to remove each directory\n\
|
||||
component of that path name. E.g., `rmdir -p a/b/c' is\n\
|
||||
similar to `rmdir a/b/c a/b a'.\n\
|
||||
--verbose output a diagnostic for every directory processed\n\
|
||||
-v, --verbose output a diagnostic for every directory processed\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
@@ -176,7 +176,7 @@ main (int argc, char **argv)
|
||||
|
||||
empty_paths = 0;
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "p", longopts, NULL)) != -1)
|
||||
while ((optc = getopt_long (argc, argv, "pv", longopts, NULL)) != -1)
|
||||
{
|
||||
switch (optc)
|
||||
{
|
||||
@@ -188,7 +188,7 @@ main (int argc, char **argv)
|
||||
case IGNORE_FAIL_ON_NON_EMPTY_OPTION:
|
||||
ignore_fail_on_non_empty = 1;
|
||||
break;
|
||||
case 14:
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
#include "hard-locale.h"
|
||||
@@ -1854,6 +1855,9 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
close_stdout_set_status (SORT_FAILURE);
|
||||
atexit (close_stdout);
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
|
||||
hard_LC_COLLATE = hard_locale (LC_COLLATE);
|
||||
@@ -2123,6 +2127,7 @@ but lacks following character offset"));
|
||||
else
|
||||
outfile = argv[++i];
|
||||
}
|
||||
close_stdout_set_file_name (outfile);
|
||||
goto outer;
|
||||
case 's':
|
||||
stable = 1;
|
||||
@@ -2221,6 +2226,7 @@ but lacks following character offset"));
|
||||
struct stat outstat;
|
||||
if (stat (outfile, &outstat) == 0)
|
||||
{
|
||||
/* FIXME: warn about this */
|
||||
/* The following code prevents a race condition when
|
||||
people use the brain dead shell programming idiom:
|
||||
cat file | sort -o file
|
||||
@@ -2317,8 +2323,6 @@ but lacks following character offset"));
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (SORT_FAILURE, errno, "%s", outfile);
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (SORT_FAILURE, errno, _("%s: write error"), outfile);
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* split.c -- split a file into pieces.
|
||||
Copyright (C) 88, 91, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 88, 91, 1995-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
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "safe-read.h"
|
||||
#include "xstrtol.h"
|
||||
@@ -348,6 +349,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
/* Parse command line options. */
|
||||
|
||||
infile = "-";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* sum -- checksum and count the blocks in a file
|
||||
Copyright (C) 86, 89, 91, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 86, 89, 91, 1995-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
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
@@ -213,6 +214,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
have_read_stdin = 0;
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "rs", longopts, NULL)) != -1)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* tac - concatenate and print files in reverse
|
||||
Copyright (C) 1988-1991, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-1991, 1995-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
|
||||
@@ -41,6 +41,7 @@ tac -r -s '.\|
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
@@ -615,6 +616,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
errors = 0;
|
||||
separator = "\n";
|
||||
sentinel_length = 1;
|
||||
@@ -711,7 +714,5 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
19
src/tail.c
19
src/tail.c
@@ -32,6 +32,7 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "argmatch.h"
|
||||
#include "error.h"
|
||||
#include "safe-read.h"
|
||||
@@ -261,7 +262,7 @@ With no FILE, or when FILE is -, read standard input.\n\
|
||||
with --follow=name, reopen a FILE which has not\n\
|
||||
changed size after N (default %d) iterations\n\
|
||||
to see if it has been unlinked or renamed\n\
|
||||
(this is the usual case of rotated log files)\n
|
||||
(this is the usual case of rotated log files)\n\
|
||||
--pid=PID with -f, terminate after process ID, PID dies\n\
|
||||
-q, --quiet, --silent never output headers giving file names\n\
|
||||
-s, --sleep-interval=S with -f, each iteration lasts approximately S\n\
|
||||
@@ -327,13 +328,11 @@ close_fd (int fd, const char *filename)
|
||||
}
|
||||
|
||||
static void
|
||||
write_header (const char *pretty_filename, const char *comment)
|
||||
write_header (const char *pretty_filename)
|
||||
{
|
||||
static int first_file = 1;
|
||||
|
||||
printf ("%s==> %s%s%s <==\n", (first_file ? "" : "\n"), pretty_filename,
|
||||
(comment ? ": " : ""),
|
||||
(comment ? comment : ""));
|
||||
printf ("%s==> %s <==\n", (first_file ? "" : "\n"), pretty_filename);
|
||||
first_file = 0;
|
||||
}
|
||||
|
||||
@@ -934,7 +933,7 @@ tail_forever (struct File_spec *f, int nfiles)
|
||||
|
||||
if (stats.st_size < f[i].size)
|
||||
{
|
||||
write_header (pretty_name (&f[i]), _("file truncated"));
|
||||
error (0, 0, _("%s: file truncated"), pretty_name (&f[i]));
|
||||
last = i;
|
||||
/* FIXME: check lseek return value */
|
||||
lseek (f[i].fd, stats.st_size, SEEK_SET);
|
||||
@@ -945,7 +944,7 @@ tail_forever (struct File_spec *f, int nfiles)
|
||||
if (i != last)
|
||||
{
|
||||
if (print_headers)
|
||||
write_header (pretty_name (&f[i]), NULL);
|
||||
write_header (pretty_name (&f[i]));
|
||||
last = i;
|
||||
}
|
||||
f[i].size += dump_remainder (pretty_name (&f[i]), f[i].fd,
|
||||
@@ -1148,7 +1147,7 @@ tail_file (struct File_spec *f, off_t n_units)
|
||||
else
|
||||
{
|
||||
if (print_headers)
|
||||
write_header (pretty_name (f), NULL);
|
||||
write_header (pretty_name (f));
|
||||
errors = tail (pretty_name (f), fd, n_units);
|
||||
if (forever)
|
||||
{
|
||||
@@ -1511,6 +1510,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
have_read_stdin = 0;
|
||||
|
||||
{
|
||||
@@ -1573,7 +1574,5 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
6
src/tr.c
6
src/tr.c
@@ -26,6 +26,7 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "safe-read.h"
|
||||
#include "xstrtol.h"
|
||||
@@ -1783,6 +1784,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
while ((c = getopt_long (argc, argv, "cdst", long_options, NULL)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
@@ -2006,9 +2009,6 @@ construct in string1 must be aligned with a corresponding construct\n\
|
||||
}
|
||||
}
|
||||
|
||||
if (fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
if (close (0) != 0)
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
#include "readtokens.h"
|
||||
@@ -552,6 +553,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
exit_status = 0;
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
@@ -579,9 +582,6 @@ main (int argc, char **argv)
|
||||
else
|
||||
tsort ("-");
|
||||
|
||||
if (fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
|
||||
#include "error.h"
|
||||
|
||||
@@ -407,6 +408,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
have_read_stdin = 0;
|
||||
exit_status = 0;
|
||||
convert_entire_line = 0;
|
||||
@@ -473,7 +476,5 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* uniq -- remove duplicate lines from a sorted file
|
||||
Copyright (C) 86, 91, 1995-1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 86, 91, 1995-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
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "linebuffer.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
@@ -313,7 +314,9 @@ check_file (const char *infile, const char *outfile)
|
||||
if (ferror (istream) || fclose (istream) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("error reading %s"), infile);
|
||||
|
||||
if (ferror (ostream) || fclose (ostream) == EOF)
|
||||
/* Close ostream only if it's not stdout -- the latter is closed
|
||||
via the atexit-invoked close_stdout. */
|
||||
if (ostream != stdout && (ferror (ostream) || fclose (ostream) == EOF))
|
||||
error (EXIT_FAILURE, errno, _("error writing %s"), outfile);
|
||||
|
||||
free (lb1.buffer);
|
||||
@@ -331,6 +334,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
skip_chars = 0;
|
||||
skip_fields = 0;
|
||||
check_chars = 0;
|
||||
|
||||
5
src/wc.c
5
src/wc.c
@@ -1,5 +1,5 @@
|
||||
/* wc - print the number of bytes, words, and lines in files
|
||||
Copyright (C) 85, 91, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 85, 91, 1995-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,6 +27,7 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "human.h"
|
||||
#include "safe-read.h"
|
||||
@@ -309,6 +310,8 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
exit_status = 0;
|
||||
posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
|
||||
print_lines = print_words = print_chars = print_linelength = 0;
|
||||
|
||||
@@ -3,7 +3,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
|
||||
same-file cp-mv-backup symlink-slash slink-2-slink
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
PATH=`pwd`/../../src:$$PATH
|
||||
|
||||
@@ -118,7 +118,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
|
||||
same-file cp-mv-backup symlink-slash slink-2-slink
|
||||
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
|
||||
@@ -130,7 +130,7 @@ cat <<\EOF > $expected
|
||||
0 -bdfl (foo foo.~1~)
|
||||
|
||||
1 [cp: `sl1' and `sl2' are the same file] (foo sl1 -> foo sl2 -> foo)
|
||||
1 -d [cp: `sl1' and `sl2' are the same file] (foo sl1 -> foo sl2 -> foo)
|
||||
1 -d [cp: cannot create symbolic link `sl2': File exists] (foo sl1 -> foo sl2 -> foo)
|
||||
0 -f (foo sl1 -> foo sl2)
|
||||
0 -df (foo sl1 -> foo sl2 -> foo)
|
||||
0 -b (foo sl1 -> foo sl2 sl2.~1~ -> foo)
|
||||
@@ -138,7 +138,7 @@ cat <<\EOF > $expected
|
||||
0 -bf (foo sl1 -> foo sl2 sl2.~1~ -> foo)
|
||||
0 -bdf (foo sl1 -> foo sl2 -> foo sl2.~1~ -> foo)
|
||||
0 -l (foo sl1 -> foo sl2 -> foo)
|
||||
0 -dl (foo sl1 -> foo sl2 -> foo)
|
||||
1 -dl [cp: cannot create link `sl2': File exists] (foo sl1 -> foo sl2 -> foo)
|
||||
0 -fl (foo sl1 -> foo sl2 -> foo)
|
||||
0 -bl (foo sl1 -> foo sl2 -> foo)
|
||||
0 -bfl (foo sl1 -> foo sl2 -> foo)
|
||||
@@ -163,7 +163,7 @@ cat <<\EOF > $expected
|
||||
EOF
|
||||
|
||||
# Uncomment this if you see a failure and want to try to diagnose it.
|
||||
# diff -u $expected $actual 1>&2
|
||||
diff -u $expected $actual 1>&2
|
||||
|
||||
cmp $expected $actual
|
||||
exit $?
|
||||
|
||||
49
tests/cp/slink-2-slink
Executable file
49
tests/cp/slink-2-slink
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
# `test cp --update A B' where A and B are both symlinks that point
|
||||
# to the same file
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
unset VERSION_CONTROL
|
||||
if test "${VERSION_CONTROL+set}" = set; then
|
||||
echo '$0: the VERSION_CONTROL envvar is set --' \
|
||||
' unset it and rerun this test' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure we get English translations.
|
||||
LANGUAGE=C
|
||||
export LANGUAGE
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=sl2sl-$$
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap 'exit $?' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp
|
||||
|
||||
touch file || framework_failure=1
|
||||
ln -s file a || framework_failure=1
|
||||
ln -s file b || framework_failure=1
|
||||
ln -s no-such-file c || framework_failure=1
|
||||
ln -s no-such-file d || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail=0
|
||||
cp --update --no-dereference a b || fail=1
|
||||
cp --update --no-dereference c d || fail=1
|
||||
|
||||
exit $fail
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -6,14 +6,16 @@ explicit = in in-1024
|
||||
maint_gen = idem-0.I idem-0.X idem-1.I idem-1.X idem-2.I idem-2.X idem-3.I \
|
||||
idem-3.X basic-0-10.I basic-0-10.X basic-0-09.I basic-0-09.X basic-0-11.I \
|
||||
basic-0-11.X obs-0.I obs-0.X obs-1.I obs-1.X obs-2.I obs-2.X obs-3.I obs-3.X \
|
||||
fail-1.I fail-1.X null-1.I null-1.X posix-0.I posix-0.X posix-1.I posix-1.X \
|
||||
posix-2.I posix-2.X posix-3.I posix-3.X
|
||||
fail-1.I fail-1.X null-1.I null-1.X no-octal-1.I no-octal-1.X no-octal-2.I \
|
||||
no-octal-2.X no-octal-3.I no-octal-3.X no-octal-4.I no-octal-4.X posix-0.I \
|
||||
posix-0.X posix-1.I posix-1.X posix-2.I posix-2.X posix-3.I posix-3.X
|
||||
run_gen = idem-0.O idem-0.E idem-1.O idem-1.E idem-2.O idem-2.E idem-3.O \
|
||||
idem-3.E basic-0-10.O basic-0-10.E basic-0-09.O basic-0-09.E basic-0-11.O \
|
||||
basic-0-11.E obs-0.O obs-0.E obs-1.O obs-1.E obs-2.O obs-2.E obs-3.O obs-3.E \
|
||||
obs-4.O obs-4.E obs-5.O obs-5.E fail-1.O fail-1.E null-1.O null-1.E posix-0.O \
|
||||
posix-0.E posix-1.O posix-1.E posix-2.O posix-2.E posix-3.O posix-3.E \
|
||||
posix-4.O posix-4.E posix-5.O posix-5.E
|
||||
obs-4.O obs-4.E obs-5.O obs-5.E fail-1.O fail-1.E null-1.O null-1.E \
|
||||
no-octal-1.O no-octal-1.E no-octal-2.O no-octal-2.E no-octal-3.O no-octal-3.E \
|
||||
no-octal-4.O no-octal-4.E posix-0.O posix-0.E posix-1.O posix-1.E posix-2.O \
|
||||
posix-2.E posix-3.O posix-3.E posix-4.O posix-4.E posix-5.O posix-5.E
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
@@ -119,15 +119,17 @@ explicit = in in-1024
|
||||
maint_gen = idem-0.I idem-0.X idem-1.I idem-1.X idem-2.I idem-2.X idem-3.I \
|
||||
idem-3.X basic-0-10.I basic-0-10.X basic-0-09.I basic-0-09.X basic-0-11.I \
|
||||
basic-0-11.X obs-0.I obs-0.X obs-1.I obs-1.X obs-2.I obs-2.X obs-3.I obs-3.X \
|
||||
fail-1.I fail-1.X null-1.I null-1.X posix-0.I posix-0.X posix-1.I posix-1.X \
|
||||
posix-2.I posix-2.X posix-3.I posix-3.X
|
||||
fail-1.I fail-1.X null-1.I null-1.X no-octal-1.I no-octal-1.X no-octal-2.I \
|
||||
no-octal-2.X no-octal-3.I no-octal-3.X no-octal-4.I no-octal-4.X posix-0.I \
|
||||
posix-0.X posix-1.I posix-1.X posix-2.I posix-2.X posix-3.I posix-3.X
|
||||
|
||||
run_gen = idem-0.O idem-0.E idem-1.O idem-1.E idem-2.O idem-2.E idem-3.O \
|
||||
idem-3.E basic-0-10.O basic-0-10.E basic-0-09.O basic-0-09.E basic-0-11.O \
|
||||
basic-0-11.E obs-0.O obs-0.E obs-1.O obs-1.E obs-2.O obs-2.E obs-3.O obs-3.E \
|
||||
obs-4.O obs-4.E obs-5.O obs-5.E fail-1.O fail-1.E null-1.O null-1.E posix-0.O \
|
||||
posix-0.E posix-1.O posix-1.E posix-2.O posix-2.E posix-3.O posix-3.E \
|
||||
posix-4.O posix-4.E posix-5.O posix-5.E
|
||||
obs-4.O obs-4.E obs-5.O obs-5.E fail-1.O fail-1.E null-1.O null-1.E \
|
||||
no-octal-1.O no-octal-1.E no-octal-2.O no-octal-2.E no-octal-3.O no-octal-3.E \
|
||||
no-octal-4.O no-octal-4.E posix-0.O posix-0.E posix-1.O posix-1.E posix-2.O \
|
||||
posix-2.E posix-3.O posix-3.E posix-4.O posix-4.E posix-5.O posix-5.E
|
||||
|
||||
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
10
tests/mv/i-2
10
tests/mv/i-2
@@ -32,6 +32,16 @@ framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp
|
||||
|
||||
touch file || framework_failure=1
|
||||
chmod u-w file || framework_failure=1
|
||||
(echo foo >> file) >/dev/null 2>&1 && {
|
||||
echo '********************************************'
|
||||
echo "$0: NOTICE: This test case cannot be run as root."
|
||||
echo '********************************************'
|
||||
exit 77
|
||||
}
|
||||
|
||||
|
||||
for i in a b c d e f g h; do
|
||||
echo $i > $i || framework_failure=1
|
||||
done
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -6,7 +6,10 @@ if test "$VERBOSE" = yes; then
|
||||
shred --version
|
||||
fi
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=t-shred.$$
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap 'exit $?' 1 2 13 15
|
||||
|
||||
# The length of the basename is what matters.
|
||||
# In this case, shred would try to rename the file 256^10 times
|
||||
@@ -16,16 +19,16 @@ file=$tmp/0123456789
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
touch $file || framework_failure=1
|
||||
chmod u-w $tmp || framework_failure=1
|
||||
chmod u-w $file || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(echo foo >> $tmp/file) >/dev/null 2>&1 && {
|
||||
(echo foo >> $file) >/dev/null 2>&1 && {
|
||||
echo '********************************************'
|
||||
echo 'NOTICE: This test case cannot be run as root.'
|
||||
echo "$0: NOTICE: This test case cannot be run as root."
|
||||
echo '********************************************'
|
||||
exit 77
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
@@ -31,8 +31,6 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -90,7 +88,9 @@ INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
|
||||
Reference in New Issue
Block a user