[PATCH] patch: ignore a few more flags for compatibility with gnu diff
Matheus Izvekov
mizvekov at gmail.com
Wed Jan 20 02:47:46 UTC 2010
Signed-off-by: Matheus Izvekov <mizvekov at gmail.com>
---
editors/patch.c | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/editors/patch.c b/editors/patch.c
index b36980f..3c68200 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -76,9 +76,13 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
char plus = '+';
unsigned opt;
enum {
- OPT_R = (1 << 2),
- OPT_N = (1 << 3),
- OPT_dry_run = (1 << 4) * ENABLE_LONG_OPTS,
+ OPT_R = (1 << 3),
+ OPT_N = (1 << 4),
+ OPT_E = (1 << 5), /* ignored, this is the default */
+ OPT_f = (1 << 6), /* ignored */
+ OPT_backup_if_mismatch = (1 << 7) * ENABLE_LONG_OPTS,
+ OPT_no_backup_if_mismatch = (1 << 8) * ENABLE_LONG_OPTS,
+ OPT_dry_run = (1 << 9) * ENABLE_LONG_OPTS,
};
xfunc_error_retval = 2;
@@ -87,16 +91,20 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
const char *i = "-"; /* compat */
#if ENABLE_LONG_OPTS
static const char patch_longopts[] ALIGN1 =
- "strip\0" Required_argument "p"
- "get\0" Required_argument "g"
- "input\0" Required_argument "i"
- "reverse\0" No_argument "R"
- "forward\0" No_argument "N"
- "dry-run\0" No_argument "\xff"
+ "strip\0" Required_argument "p"
+ "get\0" Required_argument "g"
+ "input\0" Required_argument "i"
+ "reverse\0" No_argument "R"
+ "forward\0" No_argument "N"
+ "remove-empty-files\0" No_argument "E"
+ "force\0" No_argument "f"
+ "backup-if-mismatch\0" No_argument "\xfd"
+ "no-backup-if-mismatch\0" No_argument "\xfe"
+ "dry-run\0" No_argument "\xff"
;
applet_long_options = patch_longopts;
#endif
- opt = getopt32(argv, "p:i:RNg:", &p, &i, NULL);
+ opt = getopt32(argv, "p:i:g:RNEf", &p, &i, NULL);
if (opt & OPT_R)
plus = '-';
patch_level = xatoi(p); /* can be negative! */
--
1.6.6
More information about the busybox
mailing list