Andreas Gruenbacher
|
11374a026a
|
Previous work in progress
|
2009-03-19 20:42:57 +01:00 |
|
Paul Eggert
|
65f7c26e8a
|
patch.c: Include exitfail.h. (main): Set exit_failure, not xalloc_exit_failure. (spew_output): New output arg, to contain status of output file. (main): Use it to get status of output file, and pass this to move_file as needed. Initialize hash table.
|
2009-03-19 01:43:39 +01:00 |
|
Paul Eggert
|
bf3ffa2740
|
(struct outstate, numeric_string, make_backups, backup_if_mismatch, remove_empty_files, reverse_flag_specified, main, reinitialize_almost_everything, get_some_switches, apply_hunk, init_output, copy_till): int -> bool for booleans.
|
2009-03-19 01:43:37 +01:00 |
|
Paul Eggert
|
529748febc
|
Do not include <exitfail.h>. (main): Set xalloc_exit_failure, not exit_failure. Add "&& !skip_rest_of_patch" when deciding to continue ed scripts. (option_help): Use PACKAGE_BUGREPORT rather than hardcoding.
|
2009-03-19 01:43:37 +01:00 |
|
Paul Eggert
|
c9d49949b0
|
(end_defined, apply_hunk): Output #endif without the comment, as POSIX 1003.1-2001 requires.
|
2009-03-19 01:43:35 +01:00 |
|
Paul Eggert
|
1db46b75df
|
Fix paren typo.
|
2009-03-19 01:43:35 +01:00 |
|
Paul Eggert
|
4a5cb147ef
|
(main): Remove useless prototype decl. (mktemp): Don't declare if HAVE_DECL_MKTEMP || defined mktemp. (make_temp): Now accepts char, not int. (not_defined): Prepend newline. All uses changed. (apply_hunk): Fix bug: -D was outputting #ifdef when it should have been outputting #ifndef. Bug report and partial fix by Jason Short. (locate_hunk): Fixed updating of last_offset.
|
2009-03-19 01:43:34 +01:00 |
|
Paul Eggert
|
e53d4bc317
|
(usage): HAVE_SETMODE && O_BINARY -> HAVE_SETMODE_DOS. Include <exitfail.h>. (main): Initialize exit_failure.
|
2009-03-19 01:43:33 +01:00 |
|
Paul Eggert
|
cc739aea96
|
(main): If we skipped an ed patch, exit with nonzero status.
|
2009-03-19 01:43:31 +01:00 |
|
Paul Eggert
|
5931762462
|
(main): Apply do_ed_script even if dry_run, because we need to make progress on the patch file.
|
2009-03-19 01:43:31 +01:00 |
|
Paul Eggert
|
d4d1f093ae
|
(program_name): Remove. (main): Initialize program_name. (option_help): --binary does nothing of O_BINARY is zero. (get_some_switches): Likewise.
|
2009-03-19 01:43:31 +01:00 |
|
Paul Eggert
|
164e59f403
|
GNU patch 2.5.5
|
2009-03-19 01:43:30 +01:00 |
|
Paul Eggert
|
6bc8558d22
|
(option_help, get_some_switches): Don't use setmode unless O_BINARY.
|
2009-03-19 01:43:29 +01:00 |
|
Paul Eggert
|
1b4728fdc6
|
(get_some_switches): Handle patch -o F F' as if it were patch F'.
|
2009-03-19 01:43:29 +01:00 |
|
Paul Eggert
|
a629f3132a
|
(program_name): Remove. (main): Initialize program_name.
|
2009-03-19 01:43:28 +01:00 |
|
Paul Eggert
|
adfb4256f6
|
(main): Default simple_backup_suffix to ".orig".
|
2009-03-19 01:43:28 +01:00 |
|
Paul Eggert
|
281654119b
|
GNU patch 2.5.4
|
2009-03-19 01:43:28 +01:00 |
|
Paul Eggert
|
43f8f04a10
|
GNU patch 2.5.4
|
2009-03-19 01:43:28 +01:00 |
|
Paul Eggert
|
7066e0bbae
|
(version_control_context): New variable. Convert to ANSI prototypes. Adjust to new argmatch calling convention. Similarly for get_version. Complain about creating an existing file only if pch_says_nonexistent returns 2 (not merely nonzero). Similarly for time mismatch check. (get_some_switches): Adjust to new get_version calling convention. Similarly for argmatch.
|
2009-03-19 01:43:27 +01:00 |
|
Paul Eggert
|
b6593c5e26
|
(main, get_some_switches): Pass 0 instead of address of quotearg_quoting_options.
|
2009-03-19 01:43:26 +01:00 |
|
Paul Eggert
|
7efc16b972
|
(option_help): Update bug reporting address to gnu.org.
|
2009-03-19 01:43:25 +01:00 |
|
Paul Eggert
|
42f3dc80e6
|
(longopts, get_some_switches): Add --quoting-style, --posix options. (main, get_some_switches, numeric_string): Quote output operands properly. (init_reject): Create temporary file with O_EXCL to avoid races. Include <quotearg.h>, <xalloc.h>. (create_output_file, init_output): New open_flags arg. All callers changed. (init_reject): No longer takes filename arg. All callers changed. (remove_if_needed): New function. (cleanup): Use it to remove temporary files only if needed. (TMPREJNAME_needs_removal): New var. (main): Set xalloc_fail_func to memory_fatal; needed for xalloc. Initialize quoting style from QUOTING_STYLE. (longopts, get_some_switches): Offset longarg options by CHAR_MAX, not 128; this is needed for EBCDIC ports. (main, locate_hunk, abort_hunk, spew_output): The LINENUM type now might be longer than long, so print and read line numbers more carefully. (main): strippath now defaults to -1, so that we can distinguish unset value from largest possible.
|
2009-03-19 01:43:24 +01:00 |
|
Paul Eggert
|
429ac43c35
|
(main): If skipping patch and Plan A fails, don't bother trying Plan B.
|
2009-03-19 01:43:23 +01:00 |
|
Paul Eggert
|
709d64e59e
|
(main, get_some_switches): Version control is now independent of whether backups are made. (option_help): Put version control options together. (get_some_switches): With CVS 1.9 hack, treat -b foo like -b -z foo, not just -z foo. This change is needed due to recent change in -z. (locate_hunk): Fix bug when locating context diff hunks near end of file with nonzero fuzz.
|
2009-03-19 01:43:21 +01:00 |
|
Paul Eggert
|
ab6ad1d4d3
|
(main): By default, warn about hunks that succeed with nonzero offset.
|
2009-03-19 01:43:20 +01:00 |
|
Paul Eggert
|
be4abc5acf
|
(struct outstate): New type, collecting together some output state vars. (apply_hunk, copy_till, spew_output, init_output): Use it. Keep track of whether some output has been generated. (backup_if_mismatch): New var. (ofp): Remove, in favor of local struct outstate vars. (main): Use struct outstate. Initialize backup_if_mismatch to be the inverse of posixly_correct. Keep track of whether mismatches occur, and use this to implement backup_if_mismatch. Report files that are not empty after patching, but should be. (longopts, option_help, get_some_switches): New options --backup-if-mismatch, --no-backup-if-mismatch. (get_some_switches): -B, -Y, -z no longer set backup_type.
|
2009-03-19 01:43:19 +01:00 |
|
Paul Eggert
|
961b57ce2d
|
(output): Remove; renamed to outfile' and moved to common.h. (main): failed' is count, not boolean. Say "Skipping patch." when deciding to skip patch. (get_some_switches): Set invc when setting inname.
|
2009-03-19 01:43:18 +01:00 |
|
Paul Eggert
|
67b28078fb
|
#include <utime.h> if HAVE_UTIME_H. (struct utimbuf): Declare if ! HAVE_STRUCT_UTIMBUF. (numeric_string): Renamed from numeric_optarg. Add new option saying whether negative values are allowed. (main): PATCH_GET is now an integer, not a boolean. Set patch_get to 0 if posixly_correct, -1 if not, unless user overrides it. Avoid dwim if we've already asked the user to reverse. `failed' is a boolean, not a counter. Omit extra newline before "Patch attempted to create ...". Unless silent, note hunks with nonzero fuzz. Add support for new -T and -Z options. (shortopts, longopts, option_help, get_some_switches): Add -T, -Z; remove -G; -g now takes operand.
|
2009-03-19 01:43:17 +01:00 |
|
Paul Eggert
|
4766b28a8a
|
(main): Count bytes, not lines, when testing whether a file is empty, since it may contain only non-newline chars. pch_says_nonexistent now returns 2 for nonexistent files.
|
2009-03-19 01:43:16 +01:00 |
|
Paul Eggert
|
e8f56b254e
|
(shortopts): Add -g, -G. (longopts): --help now maps to 132, not 'h', to avoid confusion. (get_some_switches): Likewise. Don't invoke setmode on input if --binary; wait until needed. Don't ever invoke setmode on stdout.
|
2009-03-19 01:43:14 +01:00 |
|
Paul Eggert
|
3d151d4d39
|
(main): Initialize patch_get from PATCH_GET. Omit DEFAULT_VERSION_CONTROL hook; it just leads to nonstandarization. (longopts, option_help, get_some_switches): Add support for -g, -G. (option_help): Add bug report address.
|
2009-03-19 01:43:13 +01:00 |
|
Paul Eggert
|
061a2d70a0
|
(noreverse): Now extern. (main): New environment var PATCH_VERSION_CONTROL overrides VERSION_CONTROL. Don't assert(hunk) if we're skipping the patch; we may not have any hunks. When removing a file, back it up if backups are desired. Don't chmod output file if input file did not exist. chmod rej file to input file's mode minus executable bits. (locate_hunk): Go back to old way of a single fuzz parameter, but handle it more precisely: context diffs with partial contexts can only match file ends, since the partial context can occur only at the start or end of file. All callers changed. (create_output_file): Use create_file to create files. (ok_to_reverse): Move to util.c.
|
2009-03-19 01:43:12 +01:00 |
|
Paul Eggert
|
4a290cf42b
|
(main): Call init_time. Add DEFAULT_VERSION_CONTROL hook for people who prefer the old ways. Build temp file names before we might invoke cleanup. Add support for deleted files and clean up the patch-swapping code a bit. Delete empty ancestors of deleted files. When creating temporaries, use file modes of original files. (longopts, get_some_switches): New option --binary. (get_some_switches): Report non-errno errors with fatal', not pfatal'. (create_output_file): New function, which preserves modes of original files and supports binary transput. (init_output, init_reject): Use it. (ok_to_reverse): New function. (TMPDIR): New macro. (make_temp): Use $TMPDIR, $TMP, $TEMP, or TMPDIR, whichever comes first.
|
2009-03-19 01:43:10 +01:00 |
|
Paul Eggert
|
ffd206a4db
|
(main): Remove empty files by default unless POSIXLY_CORRECT is set.
|
2009-03-19 01:43:10 +01:00 |
|
Paul Eggert
|
316054306b
|
(backup): Remove var. (main): Initialize new var posixly_correct. If ! posixly_correct, default backup type is now `existing'. SIMPLE_BACKUP_SUFFIX no longer affects backup type.
|
2009-03-19 01:43:08 +01:00 |
|
Paul Eggert
|
e9f8471085
|
(numeric_optarg): New function. (get_some_switches): Use it.
|
2009-03-19 01:43:07 +01:00 |
|
Paul Eggert
|
878563e25d
|
(get_some_switches): Add special hack for backwards compatibility with CVS 1.9. (-B, -Y, -z): Now set backup_type = simple.
|
2009-03-19 01:43:06 +01:00 |
|
Paul Eggert
|
7da382e763
|
(backup, output, patchname, program_name): New vars. (last_frozen_line): Moved here from inp.h. (TMPREJNAME): Moved here from common.h. (optind_last): Removed. (do_defines, if_defined, not_defined, else_defined, end_defined): Now char const. Prepend with \n (except for not_defined) to allow for files ending in non-newline. (Argv): Now char*const*. (main, get_some_switches): Exit status 0 means success, 1 means hunks were rejected, 2 means trouble. (main, locate_hunk, patch_match): Keep track of patch prefix context separately from suffix context; this fixes several bugs. (main): Initialize bufsize, strippath. Be less chatty unless --verbose. No more NODIR; always have version control available. Require environment variables to be nonempty to have effect. Add support for --dry-run, --output, --verbose. Invoke get_input_file first, before deciding among do_ed_script, plan_a, or plan_b. Clear ofp after closing it, to keep discipline that ofp is either 0 or open, to avoid file descriptor leaks. Conversely, rejfp doesn't need this trick since static analysis is enough to show when it needs to be closed. Don't allow file-creation patches to be applied to existing files. Misordered hunks are now not fatal errors; just go on to the next file. It's a fatal error to fall back on plan B when --output is given, since the moving hand has writ. Add support for binary files. Check for I/O errors. chmod output file ourselves, rather than letting move_file do it; this saves global state. Use better grammar when outputting hunks messages, e.g. avoid 1 hunks'. (main, reinitialize_almost_everything): Remove support for multiple file arguments. Move get_some_switches call from reinitialize_almost_everything to main. (reinitialize_almost_everything): No need to reinitialize things that are no longer global variables, e.g. outname. (shortopts): Remove leading "-"; it's no longer important to return options and arguments in order. '-b' no longer takes operand. -p's operand is no longer optional. Add -i, -Y, -z. Remove -S. (longopts): --suffix is now pared with -z, not -b. --backup now means -b. Add --input, --basename-prefix, --dry-run, --verbose. Remove --skip. --strip's operand is now required. (option_help): New variable. Use style of current coding standards. Change to match current option set. (usage): Use it. (get_some_switches): Get all switches, since +' is defunct. New options -i, -Y, -z, --verbose, --dry-run. Option -S removed. -b now means backup (backup_type == simple), not simple_backup_suffix. -B now implies backup, and requires nonempty operand. -D no longer requires first char of argument to be an identifier. -o -' is now disallowed (formerly output to regular file named "-"). -p operand is now required. -v no longer needs to cleanup (no temp files can exist at that point). -V now implies backup. Set inname, patchname from file name arguments, if any; do not set filearg. It's now an error if extra operands are given. (abort_junk): Check for write errors in reject file. (apply_hunk, copy_till): Return error flag, so that failure to apply out-of-order hunk is no longer fatal. (apply_hunk): New arg after_newline, for patching files not ending in newline. Cache ofp for speed. Check for write errors. (OUTSIDE, IN_IFNDEF, IN_IFDEF, IN_ELSE): Now part of an enumerated type instead of being #defined to small integers. Change while-do to do-while when copying !-part for R_do_defines, since condition is always true the first time through the loop. (init_output, init_reject): Arg is now const *. (copy_till, spew_output): Do not insert `missing'' newlines; propagate them via new after_newline argument. (spew_output): Nothing to copy if last_frozen_line == input lines. Do not close (ofp) if it's null. (dump_line): Remove. (similar): Ignore presence or absence of trailing newlines. Check for only ' ' or '\t', not isspace (as per POSIX.2). (make_temp): Use tmpnam if mktemp is not available. (cleanup): New function. (fatal_exit): Use it. Renamed from my_exit. Take signal to exit with, not exit status (which is now always 2).
|
2009-03-19 01:43:04 +01:00 |
|
Paul Eggert
|
b667ffbc40
|
Remove lint.
|
2009-03-19 01:43:04 +01:00 |
|
Paul Eggert
|
3e13b77488
|
(abort_hunk, apply_hunk, patch_match, similar): Lines may contain NUL and need not end in newline. (copy_till, dump_line): Insert newline if appending after partial line. All invokers changed. (main, get_some_switches, apply_hunk): Allocate *_define[ds], filearg, rejname dynamically. (make_temp): New function. (main): Use it. (main, spew_output, dump_line) Check for I/O errors. Add PARAMS to function declarations.
|
2009-03-19 01:43:02 +01:00 |
|
David J. MacKenzie
|
b3f85ed388
|
entered into RCS
|
2009-03-19 01:43:01 +01:00 |
|
Paul Eggert
|
1c5855e87c
|
Formerly patch.c.~17~
|
2009-03-19 01:43:01 +01:00 |
|
David J. MacKenzie
|
ceb6a853bc
|
Formerly patch.c.~16~
|
2009-03-19 01:43:00 +01:00 |
|
David J. MacKenzie
|
e68005286a
|
Formerly patch.c.~15~
|
2009-03-19 01:43:00 +01:00 |
|
Paul Eggert
|
6c94ccb499
|
Formerly patch.c.~14~
|
2009-03-19 01:43:00 +01:00 |
|
Paul Eggert
|
9fe22bdc5d
|
Initial revision
|
2009-03-19 01:42:59 +01:00 |
|