Mirror of git://git.busybox.net/busybox with our patches on top
Source
xxxxxxxxxx
Index: coreutils/Config.in
===================================================================
RCS file: /var/cvs/busybox/coreutils/Config.in,v
retrieving revision 1.24
diff -u -r1.24 Config.in
--- a/coreutils/Config.in 15 Mar 2004 08:28:19 -0000 1.24
+++ b/coreutils/Config.in 31 Mar 2004 11:51:17 -0000
@@ -59,6 +59,21 @@
cmp is used to compare two files and returns the result
to standard output.
+config CONFIG_FEATURE_CMP_SKIP
+ bool " Enable optional arguments SKIP1 and SKIP2"
+ default n
+ depends on CONFIG_CMP
+ help
+ SKIP1 and SKIP2 specify how many bytes to ignore
+ at the start of each file.
+
+config CONFIG_FEATURE_CMP_LIMIT
+ bool " Enable limit of inputs"
+ default n
+ depends on CONFIG_CMP
+ help
+ Enable cmp option (-n).
+
config CONFIG_CP
bool "cp"
default n
Index: coreutils/cmp.c
===================================================================
RCS file: /var/cvs/busybox/coreutils/cmp.c,v
retrieving revision 1.9
diff -u -r1.9 cmp.c
--- a/coreutils/cmp.c 19 Mar 2003 09:11:32 -0000 1.9
+++ b/coreutils/cmp.c 31 Mar 2004 11:51:17 -0000
@@ -39,6 +39,12 @@
#include <unistd.h>
#include "busybox.h"
+#ifdef CONFIG_FEATURE_CMP_SKIP
+#define MAX_OPTIONAL_ARGS 3
+#else
+#define MAX_OPTIONAL_ARGS 1
+#endif
+
static FILE *cmp_xfopen_input(const char *filename)
{
FILE *fp;
@@ -58,12 +64,57 @@
static const char fmt_l_opt[] = "%.0s%.0s%d %3o %3o\n"; /* nicer gnu format */
#endif
-static const char opt_chars[] = "sl";
+#ifdef CONFIG_FEATURE_CMP_LIMIT
+#define OPTCHR_LIMIT "n:"
+#define OPTARG_LIMIT ,&limit_str
+#else
+#define OPTCHR_LIMIT
+#define OPTARG_LIMIT
+#endif
+
+static const char opt_chars[] = "sl" OPTCHR_LIMIT;
enum {
OPT_s = 1,
- OPT_l = 2
+ OPT_l = 2,
+ OPT_n = 4
+};
+
+#ifdef CONFIG_LFS
+#define SUFFIX_STRUCT suffix_mult64
+#define PARSE_FUNC bb_xgetllarg10_sfx
+#else
+#define SUFFIX_STRUCT suffix_mult
+#define PARSE_FUNC bb_xgetlarg10_sfx
+#endif
+
+#if defined(CONFIG_FEATURE_CMP_SKIP) || defined(CONFIG_FEATURE_CMP_LIMIT)
+static const struct SUFFIX_STRUCT suffixes[] = {
+ { "k", 1UL << 10 },
+ { "M", 1UL << 20 },
+ { "G", 1UL << 30 },
+#ifdef CONFIG_LFS
+ { "T", 1ULL << 40 },
+ { "P", 1ULL << 50 },
+ { "E", 1ULL << 60 },
+#endif
+ { NULL, 0 }
};
+#endif