Age | Commit message (Collapse) | Author |
|
|
|
|
|
On empty lines, we'd read one byte before the start of the buffer.
|
|
|
|
(It was outputting the patch hunk where it went, which reverted the context.)
|
|
This only touches 24 of the 68 toys/posix/ files --- the others were
already canonical.
Potentially contentious, so worth stating explicitly, is that there
were 8 matches for "COMMAND..." amongst all existing help output,
with 7 matches for various inconsistent variants involving something
with "ARG", so I resolved that in favor of using "COMMAND..." (which
is also shorter overall, and avoids nested []s).
|
|
|
|
|
|
POSIX only mentions -i/stdin, but GNU patch -- and Larry Wall's patch 1.3,
found via https://en.wikipedia.org/wiki/Patch_(Unix) -- also support
supplying the name of the file to patch and the name of the patch file
as optional arguments.
The AOSP build makes use of this syntax to patch snakeyaml to remove
references to java.beans.* stuff.
|
|
(All ignored, because they disable stuff we don't do.)
|
|
as unusual timestamp formats
After further research and testing, I've produced a patch which handles
all filenames with special characters by copying the GNU quoting
behavior, and also treats anything following a tab as a timestamp. This
increases both ability to handle possible filenames and ability to
apply patches found in the field.
In diff, quote and escape filenames according to the following rules.
* Surround the filename with quotes if it contains a byte less than 0x20,
a byte greater than or equal to 0x80, space, backslash, or quote.
* Replace alert, backspace, form feed, newline, carriage return, tab, vertical
tab, backslash, and quote with \a, \b, \f, \n, \r, \t, \v, \\, and \",
respectively.
* Replace other bytes less than 0x20 or greater than or equal to 0x80 with a
backslash followed by the three octal digits representing the value of the
byte.
* Treat valid UTF-8 characters involving sequences of bytes greater than or
equal to 0x80 the same as other sequences of such bytes.
In patch, process quoted and escaped filenames according to the following
rules.
* If the filename does not begin with a quote, do not modify the filename.
* Remove quotes surrounding the filename.
* In quoted filenames, replace \a, \b, \f, \n, \r, \t, \v, \\, and \" with
alert, backspace, form feed, newline, carriage return, tab, vertical tab,
backslash, and quote, respectively.
* In quoted filenames, replace a backslash followed by octal digits with the
byte with that value in octal.
Also, in patch, treat anything on a +++ or --- line following a tab character
after the beginning of the filename as a timestamp, rather than part of the
filename.
|
|
|
|
Patch dates are optional these days, and I should properly work back from the
end and only peel off properly formatted tab+date, but "tab followed by
digit" is probably good enough and nobody's ever complained about just tab.
And we still don't support patching filenames with newlines in them...)
|
|
|
|
Used by AOSP build.
Also switch to new FLAG macro.
Bug: http://b/122739027
|
|
Be consistent about upper versus lower case. (Upper seems to have the
majority, so I went with that, though I'm happy to provide the opposite
patch as long as we're consistent!)
Be consistent about using \t. (Though saving a few bytes seems like it
might be better done in the code that generates help.h rather than
directly in the source, since tabs make careful ASCII art layout hard
enough that we regularly have things misaligned.)
Remove trailing periods (most of which seem to have been added by me).
Always use the US "human readable" rather than my British
"human-readable", and be more consistent about declaring whether we're
showing multiples of 1000 or 1024.
Just say "verbose" rather than adding a useless "mode" or "output".
|
|
|
|
|
|
add xopenro() that takes one argument and understands "-" means stdin,
and switch over lots of users.
|
|
|
|
(Matches beginning and EOF at once.)
|
|
|
|
|
|
|
|
|
|
information about why a patch didn't apply. (Offset of first nonmatching character at each line during seek phase.)
|
|
|
|
|
|
right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
The actual code should be the same afterward, this is just cosmetic refactoring.
|
|
|
|
_and_ first hunk being replaced is 0 lines at start of file, not one or the other.
|
|
FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
|
|
|
|
|
|
|
|
|