ntpd: default to FEATURE_NTP_AUTH=y
[oweals/busybox.git] / editors / patch_bbox.c
index 62477af163f84d440eaac704798af83626cd911d..8e09ef4888b667b307fdf30df85d5d8812f3d11b 100644 (file)
@@ -1,22 +1,22 @@
 /* vi: set sw=4 ts=4: */
 /*
- *  busybox patch applet to handle the unified diff format.
- *  Copyright (C) 2003 Glenn McGrath
+ * busybox patch applet to handle the unified diff format.
+ * Copyright (C) 2003 Glenn McGrath
  *
- *  Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  *
- *  This applet is written to work with patches generated by GNU diff,
- *  where there is equivalent functionality busybox patch shall behave
- *  as per GNU patch.
+ * This applet is written to work with patches generated by GNU diff,
+ * where there is equivalent functionality busybox patch shall behave
+ * as per GNU patch.
  *
- *  There is a SUSv3 specification for patch, however it looks to be
- *  incomplete, it doesnt even mention unified diff format.
- *  http://www.opengroup.org/onlinepubs/007904975/utilities/patch.html
+ * There is a SUSv3 specification for patch, however it looks to be
+ * incomplete, it doesnt even mention unified diff format.
+ * http://www.opengroup.org/onlinepubs/007904975/utilities/patch.html
  *
- *  Issues
- *   - Non-interactive
- *   - Patches must apply cleanly or patch (not just one hunk) will fail.
- *   - Reject file isnt saved
+ * Issues
+ * - Non-interactive
+ * - Patches must apply cleanly or patch (not just one hunk) will fail.
+ * - Reject file isnt saved
  */
 
 #include "libbb.h"
@@ -111,10 +111,9 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
                        "no-backup-if-mismatch\0" No_argument       "\xff" /*ignored*/
 # endif
                        ;
-               applet_long_options = patch_longopts;
 #endif
                /* -f,-E,-g are ignored */
-               opt = getopt32(argv, "p:i:RN""fEg:", &p, &i, NULL);
+               opt = getopt32long(argv, "p:i:RN""fEg:", patch_longopts, &p, &i, NULL);
                if (opt & OPT_R)
                        plus = '-';
                patch_level = xatoi(p); /* can be negative! */
@@ -188,8 +187,8 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
                        unsigned src_last_line = 1;
                        unsigned dst_last_line = 1;
 
-                       if ((sscanf(patch_line, "@@ -%d,%d +%d,%d", &src_beg_line, &src_last_line, &dst_beg_line, &dst_last_line) < 3)
-                        && (sscanf(patch_line, "@@ -%d +%d,%d", &src_beg_line, &dst_beg_line, &dst_last_line) < 2)
+                       if ((sscanf(patch_line, "@@ -%u,%u +%u,%u", &src_beg_line, &src_last_line, &dst_beg_line, &dst_last_line) < 3)
+                        && (sscanf(patch_line, "@@ -%u +%u,%u", &src_beg_line, &dst_beg_line, &dst_last_line) < 2)
                        ) {
                                /* No more hunks for this file */
                                break;