[git commit master] patch: add more long opts; but remove -g for now

Denys Vlasenko vda.linux at googlemail.com
Fri Jan 22 03:17:07 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=feadfe742ae9cdc8ddeb425e2b7808c2905bfccb
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/patch.c |   33 +++++++++++++++++++++++++--------
 1 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/editors/patch.c b/editors/patch.c
index b36980f..69fa973 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -78,7 +78,10 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
 	enum {
 		OPT_R = (1 << 2),
 		OPT_N = (1 << 3),
-		OPT_dry_run = (1 << 4) * ENABLE_LONG_OPTS,
+		/*OPT_f = (1 << 4), ignored */
+		/*OPT_E = (1 << 5), ignored, this is the default */
+	//	/*OPT_g = (1 << x), ignored */
+		OPT_dry_run = (1 << 6) * ENABLE_LONG_OPTS,
 	};
 
 	xfunc_error_retval = 2;
@@ -87,16 +90,30 @@ 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"
+			"input\0"                 Required_argument "i"
+			"reverse\0"               No_argument       "R"
+			"forward\0"               No_argument       "N"
+		/* "Assume user knows what [s]he is doing, do not ask any questions": */
+			"force\0"                 No_argument       "f" /*ignored*/
+# if ENABLE_DESKTOP
+			"remove-empty-files\0"    No_argument       "E" /*ignored*/
+		/* "Controls actions when a file is under RCS or SCCS control,
+		 * and does not exist or is read-only and matches the default version,
+		 * or when a file is under ClearCase control and does not exist..."
+		 * IOW: does anyone really wants this? */
+		//	"get\0"                   Required_argument "g" /*ignored*/
+# endif
+			"dry-run\0"               No_argument       "\xfd"
+# if ENABLE_DESKTOP
+			"backup-if-mismatch\0"    No_argument       "\xfe" /*ignored*/
+			"no-backup-if-mismatch\0" No_argument       "\xff" /*ignored*/
+# endif
 			;
 		applet_long_options = patch_longopts;
 #endif
-		opt = getopt32(argv, "p:i:RNg:", &p, &i, NULL);
+		/* -f,-E are ignored */
+		opt = getopt32(argv, "p:i:RN""fE"/*"g:"*/, &p, &i /*,NULL*/);
 		if (opt & OPT_R)
 			plus = '-';
 		patch_level = xatoi(p); /* can be negative! */
-- 
1.6.3.3



More information about the busybox-cvs mailing list