Commit Graph

49 Commits

Author SHA1 Message Date
Paul Eggert 2d0c5eefd0 Sync from gnulib. 2005-09-22 06:05:39 +00:00
Jim Meyering 2922ae7380 Use ARGMATCH_VERIFY, just in case. 2005-09-13 12:12:36 +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 5fd26561cb (backup_args): Change a `0' to NULL. 2005-06-23 13:26:15 +00:00
Jim Meyering 116e6fb244 Update FSF postal mail address. 2005-05-14 07:58:06 +00:00
Jim Meyering 9258132a73 Remove trailing blank. 2004-09-22 20:14:25 +00:00
Paul Eggert b2fadec71b (check_extension, numbered_backup):
Rename locals to avoid shadowing 'basename'.
2004-09-13 12:10:57 +00:00
Paul Eggert 1b94625f19 backupfile.c rewrite to avoid arbitrary limits on lengths of
numeric backup extensions.

Include "backupfile.h" first.
Include errno.h, stdbool.h, limits.h, unistd.h, xalloc.h.
(CLOSEDIR, INT_STRLEN_BOUND): Remove.
(pathconf) [! (HAVE_PATHCONF && defined _PC_NAME_MAX)]: New macro.
(_POSIX_NAME_MAX) [!defined _POSIX_NAME_MAX]: New macro.
(NAME_MAX_MAXIMUM): New macro.  Unlike the old addext.c, we
also look at _XOPEN_NAME_MAX, for better performance on modern
hosts that support only file names of length 255 or more.
(ISDIGIT): unsigned -> unsigned int
(max_backup_version, version_number): Remove.
(check_extension): New function.  Similar to the old addext, but
static, assumes that the extension has already been added,
and a bit more careful on DOS hosts.
(numbered_backup): New function.  It does what max_backup_version
and version_number used to do, but it doesn't use integer arithmetic
to calculate extensions so it doesn't overflow.
(find_backup_file_name): Rewrite to use these new functions.
This has a new optimization: we needn't call pathconf if the
new numbered backup name has the same length as the old.
Also, use xmalloc rather than malloc, so that the caller
needn't worry about memory exhaustion.
2004-07-27 23:12:56 +00:00
Jim Meyering 49d4a73415 (FILE_SYSTEM_PREFIX_LEN): Renamed from
FILESYSTEM_PREFIX_LEN.  All uses changed.
2004-06-30 22:38:03 +00:00
Jim Meyering 0d84cc66ee Include <string.h>, <stdlib.h> unconditionally.
Don't declare getenv or malloc.
2003-09-10 08:26:42 +00:00
Jim Meyering dfbef7497d (PARAMS): Remove. All uses removed. 2003-06-18 07:55:39 +00:00
Jim Meyering 8b0170befa Update from gnulib. 2003-06-06 19:33:44 +00:00
Jim Meyering af0225072d (ISDIGIT): Comment fix.
add 2002 to Copyright line
2002-01-16 22:44:43 +00:00
Jim Meyering 1450c855b6 Use "", not <> to include non-system header files. 2001-05-12 15:41:11 +00:00
Jim Meyering 9ce2d23774 (base_name): Remove; now in dirname.h.
Include <dirname.h> after size_t is defined.
(find_backup_file_name, max_backup_version): Use base_len instead of
rolling it ourselves.
Handle the case of "" and (on DOS) "C:" correctly.
2001-05-12 14:20:43 +00:00
Jim Meyering 5bea77e1af Guard inclusion of stdlib.h with #if HAVE_STDLIB_H', not #if STDC_HEADERS'.
Declare malloc if needed.
2000-02-27 18:04:00 +00:00
Jim Meyering 4fef810c37 use double quotes, not single quotes around syntax-error-evoking string 2000-02-27 17:54:25 +00:00
Jim Meyering 7a80c0cacc Use #if !HAVE_DECL...' instead of #ifndef HAVE_DECL..'
now that autoconf always defines the HAVE_DECL_ symbols.

Arrange for cpp to fail if the configure-time
declaration check was not run.
2000-02-27 17:39:52 +00:00
Jim Meyering 306ea2b028 [!HAVE_DECL_GETENV]: Declare getenv.
(backup_args): Reorder enum members.
(backup_types): Likewise.
(get_version): Take an additional parameter, `context'.
(xget_version): Like get_version, but if the `version' argument is NULL,
use the value of the envvar VERSION_CONTROL.
(base_name): Declare.
1999-01-16 15:51:21 +00:00
Jim Meyering 8b3cbe63d8 (get_version): Adapt to use new interface to XARGMATCH. 1999-01-02 19:28:31 +00:00
Jim Meyering 46166ad9b7 (get_version): Use XARGCASEMATCH in place of argmatch & co. 1999-01-01 06:43:04 +00:00
Jim Meyering df521a1b29 revert-to-4.0-b7 1998-11-14 13:17:34 +00:00
Jim Meyering 84c2d0e52e revert-last-change 1998-11-14 13:13:10 +00:00
Jim Meyering 6c0c08eb29 back out last change: there is a better way 1998-11-11 05:16:09 +00:00
Jim Meyering 7de9edecfc (BACKUPFILE_EXIT_FAILURE): Define.
(get_version): Use it in place of EXIT_FAILURE.
1998-11-11 05:01:26 +00:00
Jim Meyering 9e3f43b368 [EXIT_FAILURE]: Define.
(get_version): Use EXIT_FAILURE as exit status rather than
hard-coding `2'.  From Franois Pinard.
1998-11-10 05:57:56 +00:00
Jim Meyering 2167febcb1 Fix copyright 1998-01-21 15:57:48 +00:00
Jim Meyering 2c11b736aa Use ANSI function definitions.
Remove global declaration of backup_type.
(simple_backup_suffix): Default to `~', not `.orig'.
Use PARAMS, not __BACKUPFILE_P.
(find_backup_file_name): Add parameter, backup_type.
1998-01-21 15:57:18 +00:00
Jim Meyering 4935348b67 Use ANSI function definitions. 1998-01-20 11:34:38 +00:00
Jim Meyering ca55ba3715 Update from FSF via patch-2.2.93. 1997-05-27 09:41:25 +00:00
Jim Meyering a0aa288531 libitize 1997-02-04 03:27:13 +00:00
Jim Meyering 72f95044eb (ISDIGIT): Replace with smaller, faster edition
that yields nonzero only on ASCII digits.
(ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT
used to have.  From Paul Eggert.
1996-12-18 03:30:20 +00:00
Jim Meyering e8b07e3796 update FSF address in copyright 1996-07-15 03:36:16 +00:00
Jim Meyering 2f6c94da4c [IN_CTYPE_DOMAIN]: Rename from ISASCII. 1996-05-05 01:55:52 +00:00
Jim Meyering bba8ab25f1 (find_backup_file_name, max_backup_version, make_version_name,
version_number, concat): Constify decls of formal parameters.
1996-04-24 04:28:21 +00:00
Jim Meyering 6f2e1d1ce2 (max_backup_version): Declare file_name_length to be of type size_t. 1996-03-12 03:58:25 +00:00
Jim Meyering 9c5f82a7f1 Indent cpp directives. 1995-08-09 05:14:06 +00:00
Jim Meyering 26abb25bd0 Remove unnecessary definitions for r?index.
Update definitions for ISDIGIT.
1995-05-13 13:02:08 +00:00
Jim Meyering f1ce35a10c merge with 3.9h 1994-10-02 05:43:03 +00:00
Jim Meyering f17c045d21 . 1994-10-02 02:09:38 +00:00
Jim Meyering 88494fb8f3 . 1994-07-30 12:05:32 +00:00
Jim Meyering 7691d2fba0 merge with 3.8.4c 1993-10-12 20:24:09 +00:00
Jim Meyering 4ab2d8f53a merge with 3.8.3e 1993-10-09 20:43:31 +00:00
Jim Meyering f2080b7714 merge with 3.8.3b 1993-10-06 16:44:26 +00:00
Jim Meyering 08701d38a4 merge with 3.8 1993-07-24 13:00:24 +00:00
Jim Meyering cff8d231ff merge with 3.5 1993-04-22 03:16:53 +00:00
Jim Meyering 326ea43a59 undef isasc before redining it. 1993-04-02 04:24:29 +00:00
Jim Meyering def996ca60 Define isascii macro to be 1 also if STDC_HEADERS. 1993-04-01 04:12:31 +00:00
Jim Meyering 14fd34b788 Initial revision 1992-10-31 20:42:48 +00:00