aboutsummaryrefslogtreecommitdiff
path: root/toys/patch.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2008-01-19 17:08:39 -0600
committerRob Landley <rob@landley.net>2008-01-19 17:08:39 -0600
commit2896480c4918f2accccb8301bec457a7bff7377e (patch)
tree622527b0fcb9b5ed9d8b7fb50db316dc00111b2c /toys/patch.c
parent58ecc3e589c2edc0ef4f33d4419b0b2e7ac6a83d (diff)
downloadtoybox-2896480c4918f2accccb8301bec457a7bff7377e.tar.gz
Zap toys/Config.in and instead create generated/Config.in from contents of
toys/*.c. Move relevant info into comment at the top of each toys/*.c. Also convert more of Makefile into a thin wrapper around shell scripts that actually do the work. (Makefile is only still there for the user interface.)
Diffstat (limited to 'toys/patch.c')
-rw-r--r--toys/patch.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/toys/patch.c b/toys/patch.c
index 2f1db0ec..53be2631 100644
--- a/toys/patch.c
+++ b/toys/patch.c
@@ -1,13 +1,11 @@
-/* vi: set sw=4 ts=4: */
-/*
+/* vi: set sw=4 ts=4:
+ *
* patch.c - Apply a "universal" diff.
*
- * SUSv3 at http://www.opengroup.org/onlinepubs/009695399/utilities/patch.html
- * but who cares about "ed"?
+ * Copyright 2007 Rob Landley <rob@landley.net>
*
- * -u ignored
- * -R reverse (remove applied hunks, apply removed hunks)
- * -p num remove this many slashes from start of path (default = all)
+ * see http://www.opengroup.org/onlinepubs/009695399/utilities/patch.html
+ * (But only does -u, because who still cares about "ed"?)
*
* TODO:
* -b backup
@@ -15,7 +13,6 @@
* -N ignore already applied
* -d chdir first
* -D define wrap #ifdef and #ifndef around changes
- * -i patchfile apply patch from filename rather than stdin
* -o outfile output here instead of in place
* -r rejectfile write rejected hunks to this file
*
@@ -23,7 +20,26 @@
* -f force (no questions asked)
* -F fuzz (number, default 2)
* [file] which file to patch
- */
+
+config PATCH
+ bool "patch"
+ default y
+ help
+ usage: patch [-i file] [-p depth] [-Ru]
+
+ Apply a unified diff to one or more files.
+
+ -i Input file (defaults=stdin)
+ -p number of '/' to strip from start of file paths (default=all)
+ -R Reverse patch.
+ -u Ignored (only handles "unified" diffs)
+
+ This version of patch only handles unified diffs, and only modifies
+ a file when all all hunks to that file apply. Patch prints failed
+ hunks to stderr, and exits with nonzero status if any hunks fail.
+
+ A file compared against /dev/null is created/deleted as appropriate.
+*/
#include "toys.h"