summaryrefslogtreecommitdiff
path: root/lib/backupfile.c
AgeCommit message (Collapse)Author
2004-09-22Remove trailing blank.Jim Meyering
2004-09-13(check_extension, numbered_backup):Paul Eggert
Rename locals to avoid shadowing 'basename'.
2004-07-27backupfile.c rewrite to avoid arbitrary limits on lengths ofPaul Eggert
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-06-30(FILE_SYSTEM_PREFIX_LEN): Renamed fromJim Meyering
FILESYSTEM_PREFIX_LEN. All uses changed.
2003-09-10Include <string.h>, <stdlib.h> unconditionally.Jim Meyering
Don't declare getenv or malloc.
2003-06-18(PARAMS): Remove. All uses removed.Jim Meyering
2003-06-06Update from gnulib.Jim Meyering
2002-01-16(ISDIGIT): Comment fix.Jim Meyering
add 2002 to Copyright line
2001-05-12Use "", not <> to include non-system header files.Jim Meyering
2001-05-12(base_name): Remove; now in dirname.h.Jim Meyering
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.
2000-02-27Guard inclusion of stdlib.h with `#if HAVE_STDLIB_H', not `#if STDC_HEADERS'.Jim Meyering
Declare malloc if needed.
2000-02-27use double quotes, not single quotes around syntax-error-evoking stringJim Meyering
2000-02-27Use `#if !HAVE_DECL...' instead of `#ifndef HAVE_DECL..'Jim Meyering
now that autoconf always defines the HAVE_DECL_ symbols. Arrange for cpp to fail if the configure-time declaration check was not run.
1999-01-16[!HAVE_DECL_GETENV]: Declare getenv.Jim Meyering
(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-02(get_version): Adapt to use new interface to XARGMATCH.Jim Meyering
1999-01-01(get_version): Use XARGCASEMATCH in place of argmatch & co.Jim Meyering
1998-11-14revert-to-4.0-b7Jim Meyering
1998-11-14revert-last-changeJim Meyering
1998-11-11back out last change: there is a better wayJim Meyering
1998-11-11(BACKUPFILE_EXIT_FAILURE): Define.Jim Meyering
(get_version): Use it in place of EXIT_FAILURE.
1998-11-10[EXIT_FAILURE]: Define.Jim Meyering
(get_version): Use EXIT_FAILURE as exit status rather than hard-coding `2'. From François Pinard.
1998-01-21Fix copyrightJim Meyering
1998-01-21Use ANSI function definitions.Jim Meyering
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-20Use ANSI function definitions.Jim Meyering
1997-05-27Update from FSF via patch-2.2.93.Jim Meyering
1997-02-04libitizeJim Meyering
1996-12-18(ISDIGIT): Replace with smaller, faster editionJim Meyering
that yields nonzero only on ASCII digits. (ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT used to have. From Paul Eggert.
1996-07-15update FSF address in copyrightJim Meyering
1996-05-05[IN_CTYPE_DOMAIN]: Rename from ISASCII.Jim Meyering
1996-04-24(find_backup_file_name, max_backup_version, make_version_name,Jim Meyering
version_number, concat): Constify decls of formal parameters.
1996-03-12(max_backup_version): Declare file_name_length to be of type size_t.Jim Meyering
1995-08-09Indent cpp directives.Jim Meyering
1995-05-13Remove unnecessary definitions for r?index.Jim Meyering
Update definitions for ISDIGIT.
1994-10-02merge with 3.9hJim Meyering
1994-10-02.Jim Meyering
1994-07-30.Jim Meyering
1993-10-12merge with 3.8.4cJim Meyering
1993-10-09merge with 3.8.3eJim Meyering
1993-10-06merge with 3.8.3bJim Meyering
1993-07-24merge with 3.8Jim Meyering
1993-04-22merge with 3.5Jim Meyering
1993-04-02undef isasc before redining it.Jim Meyering
1993-04-01Define isascii macro to be 1 also if STDC_HEADERS.Jim Meyering
1992-10-31Initial revisionJim Meyering