Commit Graph

4979 Commits

Author SHA1 Message Date
Jim Meyering
2bd65173c2 *** empty log message *** 2005-12-22 14:36:22 +00:00
Jim Meyering
b6c621211b Include "fcntl--.h" and "unistd--.h", to map open
and dup to open_safer and dup_safer, respectively.
(openat_permissive): Fix typo in comment.
2005-12-22 14:34:20 +00:00
Jim Meyering
1e1938032b . 2005-12-21 10:23:51 +00:00
Jim Meyering
05eb4556c8 . 2005-12-21 09:48:41 +00:00
Jim Meyering
a7c7b483f1 *** empty log message *** 2005-12-21 09:43:44 +00:00
Jim Meyering
2956eb272c like chdir(2), but safer, if possible 2005-12-21 09:42:36 +00:00
Jim Meyering
3108671902 *** empty log message *** 2005-12-20 14:23:25 +00:00
Jim Meyering
d0344cfc55 (RW_USR): Remove definition.
(make_dir_parents): Use S_IRWXU, now that read access is also required.

Avoid a race condition, on systems where open honors O_NOFOLLOW.

(make_dir_parents): Include chdir-safer.h.
Use chdir_no_follow in place of chdir.
2005-12-20 14:23:20 +00:00
Jim Meyering
0b7757fac4 *** empty log message *** 2005-12-20 10:28:58 +00:00
Jim Meyering
cf02d3c6f6 (make_dir_parents): Remove unnecessary casts of alloca,
since now it's guaranteed to be (void *).
2005-12-20 10:28:53 +00:00
Jim Meyering
ddb24aa9fb *** empty log message *** 2005-12-20 10:24:43 +00:00
Jim Meyering
7be64dd68f (fchmod_new): Don't try to close fd if it's < 0. 2005-12-20 10:24:37 +00:00
Jim Meyering
e0029290b8 . 2005-12-19 18:13:00 +00:00
Jim Meyering
89276658f2 . 2005-12-19 18:12:30 +00:00
Jim Meyering
c99e1d2cb6 . 2005-12-17 10:48:30 +00:00
Jim Meyering
c4a1355047 *** empty log message *** 2005-12-17 10:48:12 +00:00
Jim Meyering
4a12f5ebcf (acl_entries): Add fallback implementation for POSIX ACL
systems other than Linux.
(chmod_or_fchmod): New function: use fchmod when possible,
and chmod otherwise.
(file_has_acl): Add a POSIX ACL implementation, with a
Linux-specific subcase.
(copy_acl): Add: copy an acl and S_ISUID, S_ISGID, and
S_ISVTX from one file to another.  Fall back to fchmod/chmod when
acls are unsupported.
(set_acl): Add: set a file's acl and S_ISUID, S_ISGID, and
S_ISVTX to a defined value.  Fall back to fchmod/chmod when acls
are unsupported.
2005-12-17 10:31:33 +00:00
Jim Meyering
9566c9c9d3 (copy_acl, set_acl): Add declarations. 2005-12-17 10:31:15 +00:00
Paul Eggert
1833362111 remove/openat cleanup 2005-12-17 06:56:19 +00:00
Paul Eggert
3f86aaadcf Don't include <stdlib.h>, <unistd.h>, <fcntl.h>,
"gettext.h"; either no longer needed or are guaranteed by openat.h.
(_): Remove; no longer needed.
(openat): Renamed from rpl_openat; no need for rpl_openat
since openat.h renames openat for us.
Replace most of the body with a call to openat_permissive,
to avoid duplicate code.
Port to (probably hypothetical) environments were mode_t is
wider than int.
(openat_permissive): Require mode arg, so that we can check
types better.  Put it just after flags.  Change cwd failure
indicator from pointer-to-bool to pointer-to-errno-value.
All callers changed.
Invoke openat_save_fail and/or openat_restore_fail if
cwd_errno is null, so that openat can call us.
(openat_permissive, fdopendir, fstatat, unlinkat):
Simplify errno handling to avoid some duplicate code,
as it's OK to set errno on success.
2005-12-17 06:55:32 +00:00
Paul Eggert
1c5cebe703 Revamp code so that function macros depend on
__OPENAT_PREFIX only, not also on AT_FDCWD.
(openat_ro): Remove.  Caller changed to use openat_permissive.
(openat_permissive): Now a macro, if not a function.
(openat_restore_fail, openat_save_fail): Now always functions,
since mkdirat needs them even if __OPENAT_PREFIX is defined.
2005-12-17 06:55:01 +00:00
Jim Meyering
049a807bc6 . 2005-12-15 14:47:36 +00:00
Jim Meyering
b0cee61e23 *** empty log message *** 2005-12-14 20:37:24 +00:00
Jim Meyering
bd78a76886 (libcoreutils_a_SOURCES): Remove fprintftime.c
and fprintftime.h.  Now they're pulled in via the .m4 file.
2005-12-14 20:37:06 +00:00
Paul Eggert
23b2b5c660 * Makefile.am (stdbool.h): Resurrect the 'sed' that goes along
with '#if !@HAVE_BOOL@".
2005-12-14 00:09:23 +00:00
Paul Eggert
a6caba2509 (stdbool.h): Resurrect the 'sed' that goes along with '#if !@HAVE_BOOL@". 2005-12-14 00:08:54 +00:00
Paul Eggert
4170c66d45 (_Bool): Resurrect the "#if !@HAVE__BOOL@" check, to
work around compilers that have a (possibly-broken) _Bool but lack
a working <stdbool.h>.
2005-12-13 19:42:27 +00:00
Paul Eggert
5ea987eade * lib/stat-time.h (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC, to fix IRIX 5.3
porting problem reported by Georg Schwarz in
<http://lists.gnu.org/archive/html/bug-coreutils/2005-12/msg00083.html>.
* m4/stat-time.m4 (gl_STAT_TIME): Likewise.
2005-12-07 18:22:05 +00:00
Paul Eggert
19af464ef3 Mention reporters for "none" and "proc" mounts. 2005-12-05 17:46:22 +00:00
Jim Meyering
5e36a5a28f *** empty log message *** 2005-12-04 22:00:18 +00:00
Jim Meyering
6a33c69c49 (EXPECTED_ERRNO): Add ENOSYS, for Solaris 8.
Paul Eggert reported that unlink/rmdir vs. e.g., /proc/self/fd/N/FILE
fails with ENOSYS.  This makes openat revert to using save-cwd.c
functions in that case.
2005-12-04 22:00:14 +00:00
Jim Meyering
b3e300393e . 2005-12-03 23:19:58 +00:00
Jim Meyering
e4f62b9fcf *** empty log message *** 2005-12-02 07:49:12 +00:00
Paul Eggert
76bebf24a5 Import from gnulib. 2005-12-02 00:42:52 +00:00
Jim Meyering
46679371cb *** empty log message *** 2005-11-30 13:05:08 +00:00
Jim Meyering
798f577bec Include openat-priv.h.
Remove definitions of macros defined therein.
2005-11-30 13:04:26 +00:00
Jim Meyering
07c80bab50 Define macros used by mkdirat.c and openat.c. 2005-11-30 13:03:21 +00:00
Jim Meyering
48a8638c23 *** empty log message *** 2005-11-30 12:40:12 +00:00
Jim Meyering
29a3f2f810 (mkdirat): Declare. 2005-11-30 12:40:09 +00:00
Jim Meyering
3f23bf599c *** empty log message *** 2005-11-30 12:39:30 +00:00
Jim Meyering
2e72b76fd3 (mkdirat): New file and function. 2005-11-30 12:39:14 +00:00
Paul Eggert
fc0fa751c4 Log today's changes. 2005-11-26 07:53:39 +00:00
Paul Eggert
1e20020bb8 (ME_DUMMY): "none" and "proc" file systems are dummies
too.
2005-11-26 07:52:11 +00:00
Paul Eggert
45ad3543a9 Include <limits.h>.
(dev_from_mount_options)
[defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2]:
New function.  It no longer assumes "dev=" has the System V meaning
on Linux (since it doesn't).  It also parses "dev=" more carefully.
(read_file_system_list)
[defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2]: Use it.
MOUNTED_GETMNTENT2 is new here; the code didn't used to look for
dev= in that case.
2005-11-26 07:43:50 +00:00
Paul Eggert
128bc21842 (MOSTLYCLEANFILES): Clean stdbool.h-t, not stdbool.ht. 2005-11-26 06:58:34 +00:00
Paul Eggert
b7fa297fa5 (stdbool.h): Fix typo in previous change. 2005-11-26 06:55:22 +00:00
Paul Eggert
dedcfff69c (stdbool.h): Just copy stdbool_.h; no need to sed any more. 2005-11-26 06:54:17 +00:00
Paul Eggert
6771c1b415 Simplify greatly, under the assumption that these
days most people use C99-compatible compilers to debug, so it's
not worth worrying about catering to older compilers for that.
This works around some porting problems with HP-UX compilers.
(false, true) [defined __BEOS__]: Don't #undef; no longer needed.
(_Bool): typedef to bool if C++ or BeOS, and #define to signed char
otherwise.
2005-11-26 06:37:31 +00:00
Paul Eggert
c63680e87b (gettime) [!defined OK_TO_USE_1S_CLOCK]:
Report an error at compile-time if only a 1-second nominal clock
resolution is found.
2005-11-26 06:30:35 +00:00
Paul Eggert
757d7a8eb5 Add buffer-lcm. 2005-11-24 06:49:10 +00:00
Paul Eggert
ef774a082b (libcoreutils_a_SOURCES): Add buffer-lcm.c, buffer-lcm.h. 2005-11-24 06:48:55 +00:00
Paul Eggert
79eb35c4e5 Initial version 2005-11-24 06:48:36 +00:00
Paul Eggert
325619eb0d Initial version, from diffutils 2005-11-24 06:48:03 +00:00
Jim Meyering
1aab378857 tweak grammar in comments 2005-11-23 13:36:48 +00:00
Jim Meyering
694b9b330a *** empty log message *** 2005-11-23 13:35:15 +00:00
Jim Meyering
e8609798de (fdopendir): Don't change errno when returning non-NULL. 2005-11-23 13:35:09 +00:00
Jim Meyering
66878248f6 . 2005-11-22 15:33:39 +00:00
Jim Meyering
9c14365b2a *** empty log message *** 2005-11-22 14:53:55 +00:00
Jim Meyering
d591c30293 (openat_permissive): Declare.
(openat_ro): Define.
2005-11-22 14:53:47 +00:00
Jim Meyering
2fa54245e1 (EXPECTED_ERRNO): New macro.
(openat_permissive): New function -- used in remove.c rewrite.
(all functions): Set errno just before returning, only if there
was an actual failure.
Use EXPECTED_ERRNO rather than comparing against only ENOTDIR.
2005-11-22 14:52:48 +00:00
Jim Meyering
75e3f2ecf2 *** empty log message *** 2005-11-20 09:10:35 +00:00
Jim Meyering
800af65fec . 2005-11-20 08:52:08 +00:00
Jim Meyering
18673b9f2d *** empty log message *** 2005-11-20 08:51:38 +00:00
Jim Meyering
e88132fa06 New file, mostly from euidaccess.c. 2005-11-20 08:51:10 +00:00
Jim Meyering
a1343d67f2 tweak grammar in a comment 2005-11-19 07:49:10 +00:00
Paul Eggert
8645d522c0 Don't bother with #pragma STDC FENV_ACCESS ON, as
coreutils no longer futzes with rounding modes.
2005-11-15 18:30:28 +00:00
Jim Meyering
db5eb389ad Use #if !, not #ifndef, for AC_CHECK_DECLS. 2005-11-14 14:51:24 +00:00
Jim Meyering
6b869921fa *** empty log message *** 2005-11-14 14:51:21 +00:00
Jim Meyering
13e06b3243 *** empty log message *** 2005-11-13 14:07:11 +00:00
Jim Meyering
dcd8aa97f2 Include <config.h>, required for possible replacement of mkstemp. 2005-11-13 14:07:06 +00:00
Jim Meyering
3fd87d8e73 *** empty log message *** 2005-11-12 10:16:50 +00:00
Jim Meyering
716377a20a *** empty log message *** 2005-11-12 10:06:34 +00:00
Jim Meyering
108429b83f Emulate openat-family functions using Linux's procfs, if possible.
Idea and some code from Ulrich Drepper's glibc changes.

(BUILD_PROC_NAME): New macro.
Include <stdio.h>, <string.h>, "alloca.h" and "intprops.h".
(rpl_openat): Emulate by trying to open /proc/self/fd/%d/%s,
before falling back on save_cwd and restore_cwd.
(fdopendir, fstatat, unlinkat): Likewise.
2005-11-12 10:06:29 +00:00
Jim Meyering
7fdc7d4df9 *** empty log message *** 2005-11-10 23:20:09 +00:00
Jim Meyering
e5475103aa (fstatat, unlinkat): Perform the syscall directly,
skipping the save_cwd...restore_cwd overhead, if FILE is absolute.
2005-11-10 23:20:05 +00:00
Paul Eggert
9d9e6430a3 Fix comment 2005-11-10 20:20:31 +00:00
Paul Eggert
163141255f Include "timespec.h" rather than the sys/time / time
business.
(gethrxtime) [! (HAVE_NANOUPTIME
|| (defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME)
|| HAVE_MICROUPTIME)]: Fall back on gettime rather than rolling
our own approximation.
2005-11-10 20:20:20 +00:00
Paul Eggert
14f7ef9d17 gethrxtime now uses gettime 2005-11-10 20:20:02 +00:00
Jim Meyering
aad084f10f Use /dev/full if possible for descriptor 0 -- like glibc now does.
Fall back on /dev/null if opening /dev/full fails.
2005-11-09 20:53:41 +00:00
Paul Eggert
4b15886f93 "touch 0101000000" now operates as POSIX 1002.1-2001 requires. 2005-11-01 23:43:38 +00:00
Paul Eggert
71fa8dc28e (PDS_PRE_2000): New macro. 2005-11-01 23:42:16 +00:00
Paul Eggert
1a0a832ac8 (year): Arg is now syntax_bits rather than allow_century.
All usages changed.  Reject dates outside the range 1969-1999 if
PDS_PRE_2000 is used.
2005-11-01 23:41:56 +00:00
Paul Eggert
a54170c2a0 Fix porting problems reported by Theodoros V. Kalamatianos. 2005-10-30 21:46:00 +00:00
Paul Eggert
9c9083d9a7 [defined HAVE_CONFIG_H]: Include <config.h>, so that large files can be opened. 2005-10-30 21:44:31 +00:00
Paul Eggert
9fb982e150 (futimens) [HAVE_WORKING_UTIMES && HAVE_FUTIMES]:
Don't assume that futimes failing means we must fail.
2005-10-30 21:32:02 +00:00
Paul Eggert
b90c07efd8 (__getcwd): Don't assume that system calls after readdir
leave errno alone.  Problem reported by Dmitry V. Levin.
2005-10-30 01:31:32 +00:00
Paul Eggert
5648577df0 (savedir): Don't assume that xrealloc etc. leave errno alone. 2005-10-28 23:06:42 +00:00
Jim Meyering
e928445598 *** empty log message *** 2005-10-24 13:36:03 +00:00
Jim Meyering
e8871a9516 (make_dir_parents): Like the code above it, don't rely
on mkdir failing with a particular errno value (EEXIST).
Based on a patch by Dmitry V. Levin.
2005-10-24 13:35:59 +00:00
Jim Meyering
d038ef379e *** empty log message *** 2005-10-24 10:22:19 +00:00
Jim Meyering
b8cedd257a (make_dir_parents): Make the preceding fix a little
more robust, e.g., when the final component is created as a non-
directory by another process just before `mkdir -p's final mkdir.
2005-10-24 10:22:10 +00:00
Jim Meyering
946e7dc930 *** empty log message *** 2005-10-24 10:03:51 +00:00
Jim Meyering
5b427ce7c3 A command like `mkdir -p nonexistent/.' would create the
directory but exit nonzero with a diagnostic.  This could also be
triggered with a non-`.' component, e.g., in a race with another
process running the same `mkdir -p nonexistent/sub' command.

(make_dir_parents): Handle the case of an existing final component.
Reported by Matthias Andree here:
http://savannah.gnu.org/bugs/?func=detailitem&item_id=14848
2005-10-24 10:03:47 +00:00
Jim Meyering
708c4e6682 . 2005-10-23 16:00:59 +00:00
Jim Meyering
f0b2494fa6 *** empty log message *** 2005-10-23 15:59:09 +00:00
Jim Meyering
441c8bd865 from David Madore 2005-10-23 15:58:59 +00:00
Jim Meyering
00ba9322af Remove no-longer-relevant comment. 2005-10-23 15:55:30 +00:00
Jim Meyering
e2cfa48b0f from David Madore 2005-10-23 15:53:55 +00:00
Jim Meyering
1e12a6ad1e *** empty log message *** 2005-10-20 14:20:41 +00:00
Jim Meyering
a4667affc0 (mode_compile): Reject an invalid mode string that
starts with an octal digit.  From Andreas Gruenbacher.
2005-10-20 14:20:34 +00:00
Paul Eggert
2ec133706a (make_dir_parents): Don't report an error if an
intermediate directory is in a read-only file system.
2005-10-13 19:05:13 +00:00
Jim Meyering
76890ff048 *** empty log message *** 2005-10-08 09:06:16 +00:00
Jim Meyering
40bf0efd47 (rpl_openat): Use the promoted type (int), not mode_t,
as second argument to va_arg.  Otherwise, some versions of gcc
warn that `if this code is reached, the program will abort'.
2005-10-08 09:05:08 +00:00
Jim Meyering
f754c25d4c *** empty log message *** 2005-10-07 22:07:36 +00:00
Jim Meyering
82ee4b140c Merge from gnulib.
(SIZE_MAX): New macro, if not already defined.
2005-10-07 22:07:27 +00:00
Jim Meyering
a9ede5e986 . 2005-10-07 19:42:03 +00:00
Jim Meyering
3614c42902 *** empty log message *** 2005-10-05 14:54:20 +00:00
Jim Meyering
05e1975d08 (libcoreutils_a_DEPENDENCIES): Remove definition.
Once it's gone, automake generates an equivalent one.
2005-10-05 14:54:17 +00:00
Jim Meyering
d3b8165328 Merge from gnulib. 2005-10-05 09:09:33 +00:00
Jim Meyering
df2b4d3451 *** empty log message *** 2005-10-05 09:09:27 +00:00
Jim Meyering
ed558df65b *** empty log message *** 2005-10-04 15:51:25 +00:00
Jim Meyering
4dffc10f08 Merge from gnulib.
Include sys/types.h before other headers.
2005-10-04 15:51:20 +00:00
Paul Eggert
ca7be84526 Import getdelim.c from gnulib (to fix unused var warnings) then
apply the following fixes:
Include getdelim.h first.  Include <limits.h>.
(SSIZE_MAX): New macro, if not already defined.
(getdelim): Fix buffer overrun on 64-bit hosts with lines longer
than 2 GiB.
2005-10-02 22:49:49 +00:00
Jim Meyering
4a6b465285 *** empty log message *** 2005-10-01 09:49:40 +00:00
Jim Meyering
8050751a86 Protect #include's of sys/socket.h and netdb.h.
Only define struct addrinfo if !HAVE_STRUCT_ADDRINFO.  Protect
AI_* and EAI_* definitions.  Protect function declarations.
2005-10-01 09:49:36 +00:00
Jim Meyering
f9c10dab98 *** empty log message *** 2005-09-30 15:21:26 +00:00
Jim Meyering
03866dcfb9 (fdopendir): Do not define if HAVE_FDOPENDIR. 2005-09-30 15:19:47 +00:00
Jim Meyering
5230885d13 (fdopendir): Do not define if HAVE_FDOPENDIR.
Remove AT_FDCWD test.
Do not consume the fd unless successful.
2005-09-30 15:19:24 +00:00
Paul Eggert
c683e67618 "they wants" -> "they want" 2005-09-29 17:24:21 +00:00
Paul Eggert
63e88f7cef Rely on gettimeofday failure too. 2005-09-29 17:22:19 +00:00
Paul Eggert
37016136c9 (settime): If settimeofday fails, give up right away. 2005-09-29 17:21:44 +00:00
Paul Eggert
346afb38ab * settime.c (settime): Fix { typo in previous patch. Also, don't
bother returning ENOSYS; just let stime return whatever errno it
wants to return.
2005-09-29 17:19:58 +00:00
Paul Eggert
8c871e2391 (settime): Fix { typo in previous patch. Also, don't
boether returning ENOSYS; just let stime return whatever errno it
wants to return.
2005-09-29 17:19:30 +00:00
Paul Eggert
96e3593902 * xtime.h (XTIME_PRECISION): Now of type int, not long long int. 2005-09-29 16:51:58 +00:00
Paul Eggert
970dc8e4a8 (XTIME_PRECISION): Now of type int, not long long int,
so that the code works even with ancient cpp.  Portability problem
with GCC 2.7.2.1 reported by Thomas M.Ott.
2005-09-29 16:51:40 +00:00
Jim Meyering
6204a2d1bd *** empty log message *** 2005-09-29 13:13:53 +00:00
Jim Meyering
33b113c638 (settime): Move the HAVE_STIME block `up' into an #elif
block, so that we don't even try to compile it if settimeofday is
available.  This works around a compilation failure on OSF1 V5.1,
due to stime requiring a `long int*' while tv_sec is `int'.
2005-09-29 13:13:49 +00:00
Jim Meyering
b2d2351330 *** empty log message *** 2005-09-27 08:59:54 +00:00
Jim Meyering
4e8e195401 *** empty log message *** 2005-09-27 08:59:04 +00:00
Jim Meyering
0ffc4a7d84 [HAVE_CONFIG_H]: Include <config.h>. 2005-09-27 08:58:55 +00:00
Jim Meyering
52e05089cc [HAVE_CONFIG_H]: Include <config.h> conditionally,
to be consistent with gnulib.
2005-09-27 08:44:07 +00:00
Jim Meyering
3cf3a44bbd Change #ifdef<TAB>HAVE_CONFIG_H to #ifdef HAVE_CONFIG_H. 2005-09-27 08:33:47 +00:00
Jim Meyering
9346282a5d *** empty log message *** 2005-09-27 08:21:35 +00:00
Jim Meyering
2d7c20c891 Include <config.h> here, now that strnumcmp-in.h no longer includes it. 2005-09-27 08:21:28 +00:00
Paul Eggert
80065b498b utimens.c portability fixes. 2005-09-26 23:01:25 +00:00
Paul Eggert
a6c8a8e6d4 Include unistd.h, for dup2.
(futimens): Fix typo: HAVE_FUTIMESAT was misspelled in an #if.
(futimens) [! HAVE_FUTIMESAT]: If !file, set errno before returning -1.
2005-09-26 23:01:00 +00:00
Jim Meyering
2c5def0462 . 2005-09-25 17:01:54 +00:00
Jim Meyering
0e5662fd54 . 2005-09-25 12:54:04 +00:00
Jim Meyering
23b9299247 Protect against multiple inclusion. 2005-09-25 06:14:33 +00:00
Paul Eggert
7ee48d8ffb Support having a null PATH if the file descriptor is nonnegative. 2005-09-25 06:09:22 +00:00
Paul Eggert
4f001e7a13 (ENOSYS): Define if not already defined.
(ftimens): Support having a null PATH if the file descriptor
is nonnegative.
2005-09-25 06:08:45 +00:00
Paul Eggert
443ddc13e6 Upgrade regex_internal.h patch. 2005-09-25 04:18:54 +00:00
Paul Eggert
793ffcaac0 (__GNUC_PREREQ, always_inline, inline, pure):
Remove.
(__attribute): Define to empty unless GCC 3.1 or later.
This works around a core dump on OpenBSD 3.4, which has GCC
2.95.3, which dumps core when given __attribute__(()).  It also
simplifies other tests, since we really don't want to bother with
worrying about which ancient version of GCC supported what.
Original problem reported by Yoann Vandoorselaere, with part of
the fix suggested by Derek Price.
2005-09-25 04:18:39 +00:00
Paul Eggert
545dd954d9 * Makefile.am (libcoreutils_a_SOURCES): Remove mbchar.c. 2005-09-24 23:14:21 +00:00
Paul Eggert
944e020290 (libcoreutils_a_SOURCES): Remove mbchar.c, since
it doesn't build in OpenBSD 3.4.  See
<http://lists.gnu.org/archive/html/bug-gnulib/2005-09/msg00242.html>.
2005-09-24 23:14:04 +00:00
Paul Eggert
fd02208ad2 * regex_internal.h (__attribute): Define to nothing for GCC 2. 2005-09-24 22:59:22 +00:00
Paul Eggert
5a29d2d430 (__attribute): Define to nothing for GCC 2.
This works around a core dump on OpenBSD 3.4, which has GCC
2.95.3, which dumps core when given __attribute__(()).
2005-09-24 22:59:06 +00:00
Jim Meyering
5e6117b9ec *** empty log message *** 2005-09-24 13:32:36 +00:00
Jim Meyering
58e399c289 Use #ifdef HAVE_CONFIG_H', not #if HAVE_CONFIG_H', for consistency with gnulib. 2005-09-24 13:32:31 +00:00
Jim Meyering
7bf8267334 *** empty log message *** 2005-09-24 13:27:41 +00:00
Jim Meyering
f6dbf542b4 Include <config.h> from strintcmp.c, not from here. 2005-09-24 13:27:34 +00:00
Jim Meyering
d447dba13d Include <config.h> here, not from strnumcmp-in.h. 2005-09-24 13:26:41 +00:00
Jim Meyering
8f4700c9e1 *** empty log message *** 2005-09-23 23:05:44 +00:00
Jim Meyering
8dbb507ee8 (verify_type__): Use `unsigned int' as the bitfield type
so we can once again use a positive bitfield width of 1 -- now we
don't have to explain why we were using a bitfield width of 2.
2005-09-23 23:05:39 +00:00
Jim Meyering
6d8b96f653 *** empty log message *** 2005-09-23 23:05:16 +00:00
Paul Eggert
ebca458e8e Use 2, not 1, for bitfield size in verify.h. 2005-09-23 21:49:59 +00:00
Paul Eggert
45079da973 (verify_type__): Use 2, not 1, for bitfield size, to avoid
a warning with Irix 6.5 cc.
2005-09-23 21:49:31 +00:00
Paul Eggert
28475f652b Log recent changes. 2005-09-23 21:40:12 +00:00
Jim Meyering
a40376f4c5 . 2005-09-23 20:14:20 +00:00
Paul Eggert
b9830cafa1 * lib/utimens.c (futimens): Use futimesat if available.
Prefer it to futimes since it doesn't have the futimes bug.
* m4/utimens.m4 (gl_UTIMENS): Check for futimesat.
2005-09-23 19:18:27 +00:00
Paul Eggert
d6ed244c5a Fix typo in comment. 2005-09-23 17:52:22 +00:00
Paul Eggert
ef999bc74a (GL_CONCAT0, GL_CONCAT): Remove.
(verify): Don't use the __LINE__ trick, as it doesn't work in general.
Instead, declare a function that returns a pointer to an array,
and use verify_type__ to declare the size of the array.
Problem and germ of a solution reported by Bruno Haible.
2005-09-23 17:47:15 +00:00
Jim Meyering
a6821efce3 *** empty log message *** 2005-09-23 12:44:07 +00:00
Jim Meyering
81d380e377 Include <config.h>. Otherwise builds with strict
C89 (e.g., Sun's /opt/SUNWspro/bin/c89) would fail due to the use
of `inline'.
2005-09-23 12:42:45 +00:00
Paul Eggert
9fd31b8beb * lib/getaddrinfo.c [HAVE_NETINET_IN_H]: Include <netinet/in.h>.
Problem reported by Eric Blake.
(getaddrinfo): Initialize se so that it's not garbage.
Redo internal storage allocation so that it doesn't make unportable
assumptions about alignment.
Fix a memory leak.
2005-09-23 05:12:50 +00:00
Jim Meyering
fc6f1f7f9c . 2005-09-22 09:47:36 +00:00
Paul Eggert
9bbbf30543 Regenerate. 2005-09-22 07:07:36 +00:00
Paul Eggert
ca9acc01a6 Sync from gnulib. 2005-09-22 07:06:16 +00:00
Paul Eggert
cab86383b8 (libcoreutils_a_SOURCES): Add getaddrinfo.h,
mbchar.c, mbchar.h, mbuiter.h, strcase.h, strlen1.c, strnlen1.h,
strstr.h.
2005-09-22 06:58:56 +00:00
Paul Eggert
eba2793d11 Nontrivial sync from gnulib. 2005-09-22 06:44:26 +00:00
Paul Eggert
da6ced8651 Add getline.h, getpass.c 2005-09-22 06:43:48 +00:00
Paul Eggert
75b92233d8 (GL_CONCAT): Remove.
Include "verify.h" instead.
(ARGMATCH_CONSTRAINT, ARGMATCH_ASSERT): Remove.
(ARGMATCH_VERIFY): Rewrite in terms of new verify macros.
2005-09-22 06:39:14 +00:00
Paul Eggert
fe4ed6c408 (VERIFY_EXPR, X2NREALLOC, X2REALLOC): Remove.
The latter two macros are moving to ../src/system.h for now.
This reverts this file to the gnulib version.
2005-09-22 06:32:52 +00:00
Paul Eggert
8cec6716df Remove; no longer used. 2005-09-22 06:26:54 +00:00
Paul Eggert
3833e2bc34 New file, from gnulib. 2005-09-22 06:22:44 +00:00
Paul Eggert
0ed6bb9a65 Add getaddrinfo.h, getdelim.h, mbchar.h,
mbuiter.h, strcase.h, strnlen.h, strnlen1.h.
2005-09-22 06:22:31 +00:00
Paul Eggert
2d0c5eefd0 Sync from gnulib. 2005-09-22 06:05:39 +00:00
Paul Eggert
5a43b499b1 Sort. 2005-09-22 05:47:40 +00:00
Paul Eggert
0adb008b03 (ENOSYS): Define to EEXIST if not defined.
(make_dir_parents): Treat ENOSYS like EEXIST.
2005-09-22 05:42:26 +00:00
Jim Meyering
08c07f2a1c . 2005-09-21 17:07:09 +00:00
Jim Meyering
b0ecfaf324 *** empty log message *** 2005-09-20 13:51:20 +00:00
Jim Meyering
5205b73810 (fdopendir): Be sure to close the supplied
file descriptor before returning.  This makes our replacement
implementation a little closer to Solaris's, where fdopendir
ties the file descriptor to the returned DIR* pointer.
2005-09-20 13:51:01 +00:00
Jim Meyering
ea66df2090 *** empty log message *** 2005-09-19 15:45:09 +00:00
Jim Meyering
ee8931ea8e (unlinkat): New function. 2005-09-19 15:45:05 +00:00
Jim Meyering
a1052bb3d9 (unlinkat): Add prototype. 2005-09-19 15:44:57 +00:00
Paul Eggert
90306bc508 (set_stat_atime, set_stat_ctime, set_stat_mtime): Remove; they were
buggy in the HAVE_STRUCT_STAT_ST_SPARE1 case, and they were dubious
anyway.  I rewrote 'tar' to not use them any more.
2005-09-17 06:54:22 +00:00
Paul Eggert
96971b59be Regenerate. 2005-09-16 07:58:03 +00:00
Paul Eggert
555bbf598d Import file time stamp resolution improvements from gnulib. 2005-09-16 07:55:12 +00:00
Paul Eggert
e9f5a9b719 Include stat-time.h.
(SYSCALL_RESOLUTION): Depend on whether various struct stat
members exist, not on the obsolescent ST_MTIM_NSEC.
(utimecmp): Use the new stat-time functions rater than TIMESPEC_NS.
2005-09-16 07:39:41 +00:00
Paul Eggert
b5a377a22b (ST_TIME_CMP_NS, ST_TIME_CMP, ATIME_CMP, CTIME_CMP):
(MTIME_CMP, TIMESPEC_NS): Remove.  Now done by stat-time.h,
in a different way.
(timespec_cmp): New function.
2005-09-16 07:39:18 +00:00
Paul Eggert
24e27d10f9 New file. 2005-09-16 07:36:48 +00:00
Paul Eggert
2bc8e10316 Add stat-time.h. 2005-09-16 07:36:35 +00:00
Jim Meyering
3da8b9a6d8 *** empty log message *** 2005-09-16 07:35:32 +00:00
Jim Meyering
4fa029bd7d (libcoreutils_a_SOURCES): Add fprintftime.c and fprintftime.h. 2005-09-16 07:32:13 +00:00
Jim Meyering
5d8614cf2f *** empty log message *** 2005-09-16 07:31:34 +00:00
Jim Meyering
0277ce3913 [FPRINTFTIME] (fprintftime): Provide a new interface:
size_t fprintftime (FILE *fp, char const *fmt, struct tm const *tm,
		    int utc, int nanoseconds);
Background:
date should not have to allocate a megabyte of virtual memory to
handle a format argument like +%1048575T.  When implemented with
strftime, it must allocate such a buffer, use strftime to fill it
in, print it, then free it.

With fprintftime, it simply prints everything and exits.
With no need for memory allocation, that's one fewer way to fail.
2005-09-16 07:31:29 +00:00
Jim Meyering
ab526003e4 *** empty log message *** 2005-09-16 07:01:00 +00:00
Paul Eggert
0144e1ae89 Rewrite previous strftime change slightly. 2005-09-15 18:48:13 +00:00
Paul Eggert
a08b44ea30 (my_strftime): Rewrite the previous change slightly,
to make it a bit faster and (I hope) clearer.
2005-09-15 18:47:56 +00:00
Jim Meyering
5185512286 *** empty log message *** 2005-09-14 16:10:41 +00:00
Jim Meyering
cc4800dd1b (my_strftime): Be sure to use L_('x') for literals. 2005-09-14 16:10:38 +00:00
Jim Meyering
9d55b89d59 *** empty log message *** 2005-09-14 10:02:57 +00:00
Jim Meyering
ad98202690 (my_strftime): Parse the colons of %:::z *after* the
optional field width, not before, so we accept %9:z, not %:9z.
2005-09-14 10:02:54 +00:00
Paul Eggert
33b49b7cac (my_strftime): Fix typo in octal number introduced in last change. 2005-09-14 06:58:08 +00:00
Paul Eggert
5b0ca7f5c1 Merge md5 from libc, and clean up some sha1 glitches. 2005-09-13 23:32:50 +00:00
Paul Eggert
bf0cc9f753 (SWAP): Renamed from NOTSWAP, to avoid a horrible misnaming.
All uses changed.  Remove the old SWAP.
Remove obvious comment about BLOCKSIZE.
(rol): New macro, moved here from md5.h.
(sha1_process_block): Remove an incoherent FIXME comment.
2005-09-13 23:32:35 +00:00
Paul Eggert
9a5d4089bc (struct sha1_ctx): Mark buffer as being aligned. 2005-09-13 23:32:15 +00:00
Paul Eggert
14d1fdaec1 (CYCLIC): New macro. All uses of rol changed to use CYCLIC.
Redo comment to minimize changes from libc.
2005-09-13 23:32:01 +00:00
Paul Eggert
a19c71988b (__GNUC_PREREQ, __THROW, __attribute__): New macros.
(__md5_buffer): Renamed from md5_buffer.  Add a macro undoing this
if _LIBC is not defined.  Add __THROW.
(__md5_finish_ctx, __md5_init_ctx, __md5_process_block):
(__md5_process_bytes, __md5_read_ctx, __md5_stream): Likewise.
(struct md5_ctx): Mark buffer as being aligned.
(rol): Remove; all uses changed to CYCLIC.
2005-09-13 23:31:37 +00:00
Paul Eggert
b673eeb49c Add date --rfc-3339. 2005-09-13 22:09:25 +00:00
Paul Eggert
7846768c6c (my_strftime): Add support for %:z, %::z, %:::z.
Fix bug in formats like %2N.
2005-09-13 22:08:18 +00:00
Jim Meyering
2859e85770 tweak comment 2005-09-13 21:25:21 +00:00
Jim Meyering
3e4d8edce9 *** empty log message *** 2005-09-13 21:11:29 +00:00
Jim Meyering
8fc8f946c4 Revert unintended change that removed definitions
of X2REALLOC and X2NREALLOC.
2005-09-13 21:11:25 +00:00
Jim Meyering
700395d652 mostly update copyrights 2005-09-13 15:46:12 +00:00
Jim Meyering
5452065818 *** empty log message *** 2005-09-13 12:12:44 +00:00
Jim Meyering
2922ae7380 Use ARGMATCH_VERIFY, just in case. 2005-09-13 12:12:36 +00:00
Jim Meyering
aadcf5b2e4 . 2005-09-10 14:16:53 +00:00
Paul Eggert
97f9677790 Regenerate. 2005-09-09 21:21:16 +00:00
Paul Eggert
3301671de9 Import latest regex module from gnulib, to fix some 64-bit bugs. 2005-09-09 21:07:50 +00:00
Paul Eggert
2aeb8c7fa9 * verify.h: Use a bit-field instead. 2005-09-06 08:21:20 +00:00
Paul Eggert
fd03e5ddc5 (__builtin_constant_p): Remove, undoing previous change.
(verify_type__): Solve the problem by using a bit-field rather
than an array.
2005-09-06 08:20:56 +00:00
Jim Meyering
22322e0d9b *** empty log message *** 2005-09-05 16:57:46 +00:00
Jim Meyering
c862959a9d (__builtin_constant_p) [__GNUC__ <= 2]: Define to 1.
(verify_type__) [verify_error_if_non_const__]: New member/test,
to help detect when verify or verify_expr is mistakenly passed
a non-constant argument within a function.
2005-09-05 16:57:40 +00:00
Jim Meyering
b11babcb6b . 2005-09-04 20:06:36 +00:00
Jim Meyering
7a998d1011 *** empty log message *** 2005-08-31 07:51:07 +00:00
Jim Meyering
db875eadae (quotearg_n_options): Change code to be suboptimal, in
order to avoid an unsuppressible warning from gcc on 64-bit systems.
2005-08-31 07:51:04 +00:00
Jim Meyering
30a8d137dd *** empty log message *** 2005-08-31 07:20:21 +00:00
Jim Meyering
b2678575aa (get_charset_aliases): Add `void' in parameter list
to placate gcc's -Wstrict-prototypes.
2005-08-31 07:19:26 +00:00
Jim Meyering
8cb5f87f68 update from gnulib 2005-08-28 09:18:33 +00:00
Jim Meyering
0b7a9db3fd New file 2005-08-27 20:50:42 +00:00
Jim Meyering
1cd6d2b83b Include <sys/types.h> and declare creat_safer. 2005-08-27 20:43:26 +00:00
Jim Meyering
21e8dcda49 *** empty log message *** 2005-08-27 16:12:25 +00:00
Jim Meyering
dbe6e77865 *** empty log message *** 2005-08-27 16:12:16 +00:00
Jim Meyering
bd17f9b9e1 Use `#error' rather than a string literal to provoke failure. 2005-08-27 16:11:43 +00:00
Jim Meyering
4157054167 *** empty log message *** 2005-08-25 16:28:21 +00:00
Jim Meyering
dd03b039e8 Include <config.h>.
Otherwise, we'd lose LARGEFILE support in any file using e.g. "fcntl--.h"
2005-08-25 16:28:18 +00:00
Jim Meyering
1d6e649c83 *** empty log message *** 2005-08-24 15:25:33 +00:00
Jim Meyering
f80cc28124 (stdopen): Revert to iterating over descriptors, but
rather than using fstat, use fcntl with its F_GETFD flag, which
is more efficient.  Unlike the 2-syscall dup-close approach,
this one doesn't apply any unnecessary pressure on the file
descriptor pool -- thus there is one fewer way to fail.
2005-08-24 15:25:29 +00:00
Jim Meyering
55fb58f426 adjust prototype
Include stdbool.h.
2005-08-24 13:01:31 +00:00
Jim Meyering
2f8742484d *** empty log message *** 2005-08-23 19:42:08 +00:00
Jim Meyering
6cd08ed8ea Update from gnulib. 2005-08-23 19:41:09 +00:00
Jim Meyering
88b1cd5a53 . 2005-08-23 16:58:04 +00:00
Paul Eggert
ff2fecfbe9 Import from gnulib.
(__restrict_arr): Don't define to __restrict if __cplusplus is defined.
2005-08-19 21:14:12 +00:00
Jim Meyering
2e4d4691b0 *** empty log message *** 2005-08-19 17:18:08 +00:00
Jim Meyering
cc6d255ed5 (stdopen): Return `bool' so caller can detect failure. 2005-08-19 17:18:04 +00:00
Jim Meyering
147d65828a *** empty log message *** 2005-08-17 19:55:57 +00:00
Jim Meyering
cb3da21f16 Make the %s format (seconds since the epoch) work for a negative
number and when used with a zero-padded field width, e.g. %015s.

(my_strftime): Move the `do_number_sign_and_padding'
label so that it precedes the code to set `digits'.  Otherwise,
%0Ns wouldn't work.  Before this change, `date -d @-22 +%05s' would
print `00-22'.  Now, it prints `-0022', as it should.
2005-08-17 19:55:52 +00:00
Jim Meyering
ce10740dac make log entry more accurate 2005-08-15 09:11:17 +00:00
Jim Meyering
9d8e8ad521 *** empty log message *** 2005-08-13 12:10:22 +00:00
Jim Meyering
0971b8d8a9 (get_date): Undo part of the 2005-04-04 change, so that
the command "date -d'2005-03-27 +1 day'" succeeds once again, even
when run in a time zone for which daylight savings time is in effect
for the starting date.
2005-08-13 12:10:05 +00:00
Jim Meyering
04de70c8d2 *** empty log message *** 2005-08-12 13:17:05 +00:00
Jim Meyering
320b71c4d3 (re_string_realloc_buffers): Rename local-shadowed
variable: s/new_array/offsets/.
(re_acquire_state) [lint]: Set *err, to avoid warnings in caller.
2005-08-12 13:16:47 +00:00
Jim Meyering
2e24888889 (regexec, re_search_stub) [!_LIBC]: Omit declaration of unused local, dfa.
(proceed_next_node): Remove outer declaration and
unnecessary initialization of local-shadowed `dest_node'.
Declare it in inner scopes, nearer its uses instead.
2005-08-12 13:16:26 +00:00
Jim Meyering
d7d1532698 (duplicate_node) [lint]: Set *new_idx to -1, to avoid
warnings (unfounded) in caller that it may be used uninitialized.
2005-08-12 13:10:17 +00:00
Jim Meyering
39a33e5f64 *** empty log message *** 2005-08-12 13:02:23 +00:00
Jim Meyering
956fd9d0d1 Mention that with FTS_LOGICAL, we use FTS_TIGHT_CYCLE_CHECK. 2005-08-12 13:02:17 +00:00
Jim Meyering
fe90fa6a61 (setup_dir, enter_dir, leave_dir, free_dir):
Use the hash-table-based cycle-detection code not just when
FTS_TIGHT_CYCLE_CHECK if specified, but also with FTS_LOGICAL.
Reported by James Youngman in
<http://lists.gnu.org/archive/html/bug-gnulib/2005-08/msg00011.html>.
2005-08-12 13:02:01 +00:00
Jim Meyering
6806c6a801 (fts_cross_check) [FTS_DEBUG]: s/active_dir_ht/fts_cycle.ht/. 2005-08-12 13:00:57 +00:00
Jim Meyering
fdaa1ce849 (IF_LINT): Define. 2005-08-12 12:41:56 +00:00
Jim Meyering
fa237b382f (RE_SYNTAX_POSIX_AWK): Remove useless space-before-TAB. 2005-08-12 12:41:41 +00:00
Jim Meyering
0508157932 . 2005-08-02 21:15:19 +00:00
Jim Meyering
c5739dcf8e *** empty log message *** 2005-08-02 20:47:46 +00:00
Jim Meyering
8822b68f9e new files 2005-08-02 20:47:37 +00:00
Paul Eggert
317a0f7a07 Fix getdate bug with relative times. 2005-07-21 22:00:55 +00:00
Paul Eggert
217cd893ef (relative_time): New type.
(RELATIVE_TIME_0): New constant.
(parser_control): Use relative_time instead of doing it ourselves.
(%union): Add new relative_time rel member.
(tYEAR_UNIT, tMONTH_UNIT, tHOUR_UNIT, tMINUTE_UNIT, tSEC_UNIT):
Now typeless.
(relunit, relunit_snumber): Now of type rel.
(zone, rel, relunit, get_date): Adjust to above changes.
2005-07-21 22:00:34 +00:00
Jim Meyering
f63845ae12 *** empty log message *** 2005-07-12 16:48:12 +00:00
Jim Meyering
40db6abec1 (X2NREALLOC): Define. 2005-07-12 16:47:37 +00:00
Jim Meyering
95550da8d3 . 2005-07-12 16:44:52 +00:00
Jim Meyering
eb3e6a0569 replace leading spaces with a TAB 2005-07-12 15:36:07 +00:00
Paul Eggert
7c97d643b9 (verify_expr): Use ((verify_type__ (R) *) 0), not
sizeof (verify_type__ (R)), to pacify C++ compilers.
2005-07-11 23:28:09 +00:00
Paul Eggert
6a406d5d8b Reword copyright notices to conform to current GNU coding standards. 2005-07-11 21:59:08 +00:00
Paul Eggert
51ae476ad8 Parameterize the copyright symbol and the year. 2005-07-11 21:58:50 +00:00
Paul Eggert
8fb97bd54a (COPYRIGHT_YEAR): New constant.
(version_etc_va): Use parameterized copyright notice.
Reword to conform to the current GNU coding standards.
2005-07-11 21:58:32 +00:00
Paul Eggert
d3fdc82a4e (getloadavg) [__CYGWIN__]: Port to cygwin.
[__linux__]: Allocate a big enough buffer for /proc/loadavg.
[!LDAV_DONE]: Avoid unused variable warning.
2005-07-08 23:41:43 +00:00
Paul Eggert
64890758cf (init_dfa, build_range_exp): Store __btowc value
in wint_t, not wchar_t.  Remove now-unnecessary cast.
2005-07-08 17:58:35 +00:00
Paul Eggert
060594db56 Regenerate. 2005-07-08 00:35:04 +00:00
Paul Eggert
ce3bb28d95 Switch to Isamu Hasegawa's implementation of regex, which is
now in gnulib.
2005-07-08 00:23:15 +00:00
Paul Eggert
36a263effc Add regcomp.c, regex_internal.c, regex_internal.h. 2005-07-08 00:22:14 +00:00
Paul Eggert
88ca28f3d7 (libcoreutils_a_SOURCES): Remove regex.h; gnulib
now does this automatically for us.
2005-07-08 00:14:05 +00:00
Jim Meyering
52c7a92b85 . 2005-07-07 17:59:05 +00:00
Jim Meyering
e74c15dd5a fix typo in comment 2005-07-05 07:33:50 +00:00
Paul Eggert
6ef09ecf57 verify.h improvements. 2005-07-05 05:16:29 +00:00
Paul Eggert
5ad307bfc0 * verify.h (GL_CONCAT0, GL_CONCAT): Define unconditionally; don't
depend on whether verify_decl is defined.
(verify): Renamed from verify_decl.  All uses changed.
Use an extern function decl, as it can't possibly collide with other
decls.
(verify_expr): Renamed from verify.  All uses changed.
(verify_type__): New private macro.
(verify, verify_expr): Use it.
2005-07-05 05:16:08 +00:00
Jim Meyering
e2b7434615 rename: s/verify_dcl/verify_decl/ 2005-07-04 17:39:48 +00:00
Jim Meyering
14ad8a2da7 *** empty log message *** 2005-07-04 16:09:10 +00:00
Jim Meyering
302c7df271 (libcoreutils_a_SOURCES): Add verify.h here, temporarily.
Eventually, it'll be pulled in via AC_LIBSOURCES.
2005-07-04 16:09:03 +00:00
Jim Meyering
979600d391 *** empty log message *** 2005-07-04 16:05:44 +00:00
Jim Meyering
cfdfe3e318 (verify, verify_dcl): New file/macros. 2005-07-04 16:05:41 +00:00
Jim Meyering
a54b48abe6 *** empty log message *** 2005-07-04 14:47:47 +00:00
Jim Meyering
13bda3c7c6 (verify_dcl): Rename from VERIFY. Update use. 2005-07-04 14:47:42 +00:00
Paul Eggert
9a00b08ea6 Remove the dependency of the strftime module on the tzset module. 2005-07-04 05:07:30 +00:00
Paul Eggert
d96382a5e9 (my_strftime) [! defined _LIBC && ! HAVE_RUN_TZSET_TEST]:
Copy the input structure, to work around some of the bug with
Solaris 2.5.1 and Solaris 2.6.
2005-07-04 05:06:44 +00:00
Jim Meyering
c719961a19 *** empty log message *** 2005-07-03 21:10:37 +00:00
Jim Meyering
035abbb7c6 (posixtime) [lint]: Initialize *all* of tm0, not just
the .tm_year member, since otherwise gcc-4.0 would now warn about
tm_zone, tm_gmtoff, tm_isdst, tm_yday, tm_wday.
2005-07-03 21:10:31 +00:00
Jim Meyering
685eb5f2c3 . 2005-07-03 13:47:39 +00:00
Jim Meyering
85ddb64559 . 2005-07-03 11:58:11 +00:00
Paul Eggert
c6a39d64c0 Minor fixes for port to Solaris 8. 2005-07-03 09:35:34 +00:00
Paul Eggert
0e11d335eb Undo previous change. 2005-07-03 09:35:02 +00:00
Paul Eggert
ac1f5e4f90 Remove (sync from gnulib). 2005-07-03 09:28:55 +00:00
Paul Eggert
e3f2ac8a0f New file, from gnulib. 2005-07-03 09:28:17 +00:00
Paul Eggert
067253007b Sync from gnulib. 2005-07-03 09:27:38 +00:00
Paul Eggert
7e58462337 [! _LIBC]: Include "lstat.h" rather than rolling our own. 2005-07-03 09:27:22 +00:00
Paul Eggert
a90f160a33 (libcoreutils_a_SOURCES): Add fcntl--.h, stdio--h,
stdlib--.h, unistd--.h.
2005-07-03 09:26:59 +00:00
Jim Meyering
4f89ded6e2 *** empty log message *** 2005-07-03 09:07:28 +00:00
Jim Meyering
c1ef936462 Include <unistd.h> for declaration of close. 2005-07-03 09:07:22 +00:00
Paul Eggert
de0cf8356f Regenerate. 2005-07-03 07:28:38 +00:00
Paul Eggert
e05ece2ced Cleanup to isolate "safer" functions to a small part of the code. 2005-07-03 07:27:05 +00:00
Paul Eggert
9c34c16a06 Include fcntl--.h rather than fcntl.h.
Do not include unistd-safer.h.
(save_cwd): Don't call fd_safer; no longer needed
now that we include fcntl--.h.
2005-07-03 07:15:39 +00:00
Paul Eggert
6207fc885c Include stdio--.h rather than stdio.h
and stdio-safer.h.
(getusershell): Call fopen, not fopen_safer.
2005-07-03 07:15:09 +00:00
Paul Eggert
bd1806f708 Include fcntl--.h rather than fcntl.h.
Do not include unistd-safer.h.
(getloadavg): Don't call fd_safer; no longer needed
now that we include fcntl--.h.
2005-07-03 07:14:28 +00:00
Paul Eggert
f21950385b (fd_safer): Remove decl.
Include fcntl--.h rather than unistd-safer.h
(fts_safe_changedir): Don't call fd_safer; no longer needed
now that we include fcntl--.h.
2005-07-03 07:14:05 +00:00
Paul Eggert
98088e6a60 Include stdio-safer.h first, to check interface.
Don't bother including stdio.h, since stdio-safer.h does.
2005-07-03 07:13:31 +00:00
Paul Eggert
8b0a2afe9f Add support for fcntl--.h, stdio--.h, stdlib--.h, unistd--.h, etc. 2005-07-03 06:43:07 +00:00
Jim Meyering
42f845ebc7 . 2005-07-02 14:33:56 +00:00
Jim Meyering
f0001d7346 *** empty log message *** 2005-07-02 11:56:56 +00:00
Jim Meyering
25ef400404 Assume HAVE_UNISTD_H, i.e., include <unistd.h> unconditionally. 2005-07-02 11:56:49 +00:00
Jim Meyering
06e5948dce *** empty log message *** 2005-07-02 10:26:00 +00:00
Jim Meyering
dd2b7c95ff Update from gnulib. 2005-07-02 10:25:58 +00:00
Jim Meyering
410f98fc2b Assume HAVE_UNISTD_H, i.e., include <unistd.h> unconditionally. 2005-07-02 08:41:46 +00:00
Jim Meyering
58076430c3 Assume HAVE_FCNTL_H (i.e., include <fcntl.h> unconditionally,
and don't include <sys/file.h>).
2005-07-01 20:55:29 +00:00
Jim Meyering
ceaa11b643 *** empty log message *** 2005-07-01 20:53:36 +00:00
Paul Eggert
00fdbcc4af * xnanosleep.c: Include timespec.h, since OpenBSD 3.4 <time.h>
declares only 'struct timespec;' (!).
2005-07-01 17:25:56 +00:00
Jim Meyering
c44874f722 . 2005-06-30 20:32:46 +00:00
Jim Meyering
d3f25798b9 Add copyright.
Include <fcntl.h> and <unistd.h> unconditionally --
it seems to be ok to do this, these days.
2005-06-30 20:23:09 +00:00
Jim Meyering
a3d8cfece3 *** empty log message *** 2005-06-30 20:23:00 +00:00
Jim Meyering
c17ae586bb *** empty log message *** 2005-06-30 20:16:01 +00:00
Jim Meyering
5754380c82 Rewritten by Paul Eggert.
Now, the minimum overhead is just two system calls: dup and close.
2005-06-30 20:13:40 +00:00
Jim Meyering
58000d181c New file. As yet unused. 2005-06-30 20:10:39 +00:00
Jim Meyering
36835110b6 *** empty log message *** 2005-06-30 16:40:08 +00:00
Jim Meyering
c25ccafa30 *** empty log message *** 2005-06-30 16:39:46 +00:00
Jim Meyering
5aa46e285c [!VERIFY] (VERIFY): Define.
(ARGMATCH_VERIFY): Use it, so this macro may be used more than
once in any given scope.
2005-06-30 16:39:41 +00:00
Jim Meyering
4ff07ebe3c (VERIFY_EXPR): Undef and add a comment. 2005-06-30 15:46:05 +00:00
Jim Meyering
b2915239d7 *** empty log message *** 2005-06-29 21:24:48 +00:00
Jim Meyering
eb231be3d6 (getuser, getuidbyname, getgroup, getgidbyname): Likewise. 2005-06-29 21:24:44 +00:00
Jim Meyering
2639d24e52 *** empty log message *** 2005-06-29 21:22:31 +00:00
Jim Meyering
dc59bb5133 (make_dir_parents): Don't apply sizeof to a hard-coded type name.
Use the variable name instead.
2005-06-29 21:22:06 +00:00
Jim Meyering
a9b919bde8 *** empty log message *** 2005-06-29 16:33:27 +00:00
Jim Meyering
22326600be (VERIFY_EXPR): Define.
(X2REALLOC): New macro, to make using x2realloc a little safer.
2005-06-29 16:33:17 +00:00
Jim Meyering
f05347d1ee . 2005-06-27 11:13:43 +00:00
Jim Meyering
7f7acc20fd . 2005-06-27 08:50:22 +00:00
Jim Meyering
722379be04 (libcoreutils_a_SOURCES): Remove diacrit.c and diacrit.h. 2005-06-26 13:31:16 +00:00
Jim Meyering
88fc20a633 *** empty log message *** 2005-06-25 21:32:05 +00:00
Jim Meyering
a2013a21e1 (libcoreutils_a_SOURCES): Remove version-etc.c version-etc.h
and version-etc-fsf.c.
2005-06-25 21:31:59 +00:00
Jim Meyering
98172e8ab1 (libcoreutils_a_SOURCES): Remove dev-ino.h too, now that we
get it via root-dev-ino.m4
2005-06-25 21:25:42 +00:00
Jim Meyering
49d976e156 Remove dev-ino.h, now that we get it via root-dev-ino.m4 2005-06-25 21:25:29 +00:00
Jim Meyering
ef0790fc1c *** empty log message *** 2005-06-25 12:35:23 +00:00
Jim Meyering
40a9612ec4 (libcoreutils_a_SOURCES): Remove root-dev-ino.c and root-dev-ino.h. 2005-06-25 12:35:13 +00:00
Paul Eggert
406929bb9d (canon_host) [HAVE_GETADDRINFO]: Use = { 0, };' to initialize local hint'. 2005-06-24 17:33:58 +00:00
Jim Meyering
534ccf18c2 . 2005-06-24 08:06:28 +00:00
Jim Meyering
a0e12540f5 *** empty log message *** 2005-06-23 18:41:55 +00:00
Jim Meyering
8ddb95f66c (libcoreutils_a_SOURCES): Remove xstrtod.c and xstrtod.h. 2005-06-23 18:41:48 +00:00
Jim Meyering
5c215ef2ad . 2005-06-23 16:34:18 +00:00
Jim Meyering
a2b5c6c00e (libcoreutils_a_SOURCES): Remove xreadlink.c and xreadlink.h. 2005-06-23 16:24:32 +00:00
Jim Meyering
fba73bf741 *** empty log message *** 2005-06-23 13:26:20 +00:00
Jim Meyering
5fd26561cb (backup_args): Change a `0' to NULL. 2005-06-23 13:26:15 +00:00
Paul Eggert
a13627ac2e mktime fix to avoid a diagnostic. 2005-06-22 19:08:21 +00:00
Paul Eggert
8834b57877 Include <string.h> even if !DEBUG. (From glibc.)
(ranged_convert): Don't save conversion in a temporary struct.
This causes a warning with GCC 4.0.0, and anyway in the typical
case it's not worth the extra 100 bytes or so of code.
(ranged_convert, __mktime_internal): When calling a function via a
pointer P, use P () rather than (*P) (), as we now assume C89 or better.
2005-06-22 19:07:41 +00:00
Paul Eggert
956daabfc6 (desirable_utmp_entry): Fix bug where "who -b" and "who -r"
failed to give output.
2005-06-22 18:26:22 +00:00
Jim Meyering
fd78e66067 From gnulib:
(HAVE_GNU_CALLOC): New constant.
  (xcalloc): Use it to avoid needless tests.
2005-06-22 11:55:38 +00:00
Jim Meyering
fb33aea31f *** empty log message *** 2005-06-22 11:52:24 +00:00
Jim Meyering
7cb0b72a2c . 2005-06-20 07:13:36 +00:00
Jim Meyering
b0e72c0a63 *** empty log message *** 2005-06-19 08:30:16 +00:00
Jim Meyering
2c4bb16c03 (libcoreutils_a_SOURCES): Remove xgetcwd.c, xgetcwd.h, xfts.c and xfts.h. 2005-06-19 08:25:21 +00:00
Jim Meyering
a5c9e15482 *** empty log message *** 2005-06-16 14:52:33 +00:00
Jim Meyering
5371690c7f (rpl_calloc): Allocate a 1-byte buffer (not 1xS or Nx1)
when either N or S is zero.
2005-06-16 14:52:29 +00:00
Jim Meyering
7dd05aa715 Reflect s/_die/_fail/ renaming. 2005-06-15 09:38:12 +00:00
Jim Meyering
8add4ac9cb *** empty log message *** 2005-06-15 08:32:14 +00:00
Jim Meyering
d4145e48ed (make_dir_parents): Don't let a failed chdir($PWD)
stop us from restricting permissions of just-created absolute-named
directories.
2005-06-15 08:31:44 +00:00
Paul Eggert
f2c653e8df Improve diagnostics for restore_cwd failure. 2005-06-14 23:58:00 +00:00
Paul Eggert
153854cc31 (make_dir): Remove. All uses replaced by mkdir.
(make_dir_parents): Last arg is now int * (for errno), not bool *.
Rewrite "mkdir -p" algorithm to avoid the need for "stat"
each time through the loop.  Do not diagnose restore_cwd failure;
that is the caller's job (and perhaps the caller does not care).
2005-06-14 23:56:49 +00:00
Paul Eggert
616a6e5146 (make_dir): Remove. All uses replaced by mkdir.
(make_dir_parents): Last arg is now int * (for errno), not bool *.
2005-06-14 23:56:17 +00:00
Paul Eggert
d203fc19ae mkdir-p cleanup. 2005-06-14 18:36:44 +00:00
Paul Eggert
f7bbc5d1a2 (CLEANUP_CWD, CLEANUP): Remove.
(make_dir_parents): Revamp to avoid need for CLEANUP_CWD, CLEANUP.
If the file already exists but is not a directory, don't bother
to try to make its parents.
Close potential file descriptor leak if we can't chdir("/") (!).
Don't always return true if chdir($PWD) fails; return true only
if the requested action was done successfully (except for the
chdir($PWD)).
Don't log final directory unless we actually made it.
Refactor to avoid duplicate code to fix up permissions.
Don't attempt to fix up parent permissions if chdir($PWD) fails.
2005-06-14 18:35:38 +00:00
Jim Meyering
5c3c5b0586 *** empty log message *** 2005-06-14 09:46:39 +00:00
Jim Meyering
b95fca684c Reflect s/_die/_fail/ renaming. 2005-06-14 09:46:24 +00:00
Jim Meyering
f23e1c18a8 (openat_save_fail): Rename from openat_save_die.
(openat_restore_fail): Rename from openat_restore_die.
2005-06-14 09:44:54 +00:00
Jim Meyering
cb7512d04d clarify comment 2005-06-14 08:55:37 +00:00
Jim Meyering
cb3b87f4d7 *** empty log message *** 2005-06-14 08:53:11 +00:00
Jim Meyering
1fbdda3dc2 (CLEANUP_CWD): Return *true*, not false when failing
to restore initial working directory.
2005-06-14 08:48:13 +00:00
Jim Meyering
a0e071d050 . 2005-06-14 08:19:18 +00:00
Jim Meyering
30b65617ac *** empty log message *** 2005-06-14 06:55:32 +00:00
Jim Meyering
3e915a8263 (openat_save_die, openat_restore_die): New file. 2005-06-14 06:55:24 +00:00
Jim Meyering
5985c9991b (openat_save_die, openat_restore_die): Declare and define. 2005-06-14 06:54:57 +00:00
Jim Meyering
8c98346f6f Provide an alternative to exiting immediately upon save_cwd or
restore_cwd failure.  Now, an application can arrange e.g.,
to perform a longjump in that case.
* openat.c: Include dirname.h.
Use IS_ABSOLUTE_FILE_NAME rather than testing for leading slash.
(rpl_openat, fdopendir, fstatat): Call openat_save_die
and openat_restore_die rather than calling error directly.
Don't include "error.h" or "exitfail.h"; they're no longer needed.

* openat-die.c (openat_save_die, openat_restore_die): New file.
* openat.h (openat_save_die, openat_restore_die): Declare and define.
2005-06-14 06:54:39 +00:00
Jim Meyering
57f2a7090c *** empty log message *** 2005-06-13 10:22:29 +00:00
Jim Meyering
15de627dec (make_dir_parents): Update prototype. 2005-06-13 10:22:26 +00:00
Jim Meyering
ecd375b64a (make_dir_parents): New parameter: different_working_dir,
to tell caller if/when we change the working directory and are
unable to return to the initial one.
2005-06-13 10:15:19 +00:00
Jim Meyering
26438e44cd *** empty log message *** 2005-06-12 19:56:42 +00:00
Jim Meyering
78c87e1292 (CLEANUP_CWD): Change one more return 1' to return false'.
This fixes a bug introduced on 2004-07-30.
2005-06-12 19:56:37 +00:00
Paul Eggert
2bc139bf8f Regenerate. 2005-06-02 05:19:46 +00:00
Paul Eggert
ef12d7fb52 Use "file name" when talking about file names, instead of "filename"
or "path", as per the GNU coding standards.  As part of this,
rename makepath.c to mkdir-p.c, and path-concat.c to filenamecat.c,
and likewise for the .h files.
2005-06-02 05:06:56 +00:00
Paul Eggert
ab2edb9e33 Don't use "path" or "filename" to mean "file name"
in comments or local variable names.
2005-06-02 05:05:29 +00:00
Paul Eggert
1e6b9bd047 (excluded_file_name): Renamed from excluded_filename.
All uses changed.
2005-06-02 05:02:38 +00:00
Paul Eggert
d91f01988d Don't use "path" or "filename" to mean "file name"
in comments or local variable names.

(excluded_file_name): Renamed from excluded_filename.
All uses changed.
2005-06-02 05:02:14 +00:00
Paul Eggert
1885506f1e Renamed from path-concat.c.
(file_name_concat): Renamed from path_concat.  All callers changed.
[TEST_FILE_NAME_CONCAT]: Renamed from TEST_PATH_CONCAT.
2005-06-02 04:59:10 +00:00
Paul Eggert
3a0841772c Renamed from path-concat.h. All includers changed.
(file_name_concat): Renamed from path_concat.  All callers changed.
2005-06-02 04:58:26 +00:00
Paul Eggert
6499782f2e Renamed from makepath.h. All includers changed.
(make_dir_parents): Renamed from make_path.  All callers changed.
2005-06-02 04:56:41 +00:00
Paul Eggert
78cd5b80f6 Renamed from makepath.c.
(make_dir_parents): Renamed from make_path.  All callers changed.
2005-06-02 04:55:35 +00:00
Paul Eggert
ff57f59217 Regenerate. 2005-05-30 07:41:32 +00:00