rev |
line source |
pascal@19991
|
1 --- busybox-1.26/editors/diff.c
|
pascal@19991
|
2 +++ busybox-1.26/editors/diff.c
|
pascal@19991
|
3 @@ -111,6 +111,7 @@
|
pascal@19991
|
4 //usage: "\n -B Ignore changes whose lines are all blank"
|
pascal@19991
|
5 //usage: "\n -d Try hard to find a smaller set of changes"
|
pascal@19991
|
6 //usage: "\n -i Ignore case differences"
|
pascal@19991
|
7 +//usage: "\n -l Ignore symbolic links"
|
pascal@19991
|
8 //usage: "\n -L Use LABEL instead of the filename in the unified header"
|
pascal@19991
|
9 //usage: "\n -N Treat absent files as empty"
|
pascal@19991
|
10 //usage: "\n -q Output only whether files differ"
|
pascal@19991
|
11 @@ -142,6 +143,7 @@
|
pascal@19991
|
12 FLAG_b,
|
pascal@19991
|
13 FLAG_d,
|
pascal@19991
|
14 FLAG_i,
|
pascal@19991
|
15 + FLAG_l,
|
pascal@19991
|
16 FLAG_L, /* never used, handled by getopt32 */
|
pascal@19991
|
17 FLAG_N,
|
pascal@19991
|
18 FLAG_q,
|
pascal@19991
|
19 @@ -756,6 +758,14 @@
|
pascal@19991
|
20 j = fread(buf1, 1, sz, fp[1]);
|
pascal@19991
|
21 if (i != j) {
|
pascal@19991
|
22 differ = true;
|
pascal@19991
|
23 + /* Ensure we detect binary file even if a file is empty or very
|
pascal@19991
|
24 + short. */
|
pascal@19991
|
25 + for (k = 0; k < i; k++)
|
pascal@19991
|
26 + if (!buf0[k])
|
pascal@19991
|
27 + binary = true;
|
pascal@19991
|
28 + for (k = 0; k < j; k++)
|
pascal@19991
|
29 + if (!buf1[k])
|
pascal@19991
|
30 + binary = true;
|
pascal@19991
|
31 i = MIN(i, j);
|
pascal@19991
|
32 }
|
pascal@19991
|
33 if (i == 0)
|
pascal@19991
|
34 @@ -869,7 +879,9 @@
|
pascal@19991
|
35 * Using list.len to specify its length,
|
pascal@19991
|
36 * add_to_dirlist will remove it. */
|
pascal@19991
|
37 list[i].len = strlen(p[i]);
|
pascal@19991
|
38 - recursive_action(p[i], ACTION_RECURSE | ACTION_FOLLOWLINKS,
|
pascal@19991
|
39 + recursive_action(p[i],
|
pascal@19991
|
40 + (option_mask32 & FLAG(l)) ? ACTION_RECURSE :
|
pascal@19991
|
41 + ACTION_RECURSE | ACTION_FOLLOWLINKS,
|
pascal@19991
|
42 add_to_dirlist, skip_dir, &list[i], 0);
|
pascal@19991
|
43 /* Sort dl alphabetically.
|
pascal@19991
|
44 * GNU diff does this ignoring any number of trailing dots.
|
pascal@19991
|
45 @@ -983,7 +995,7 @@
|
pascal@19991
|
46 #if ENABLE_FEATURE_DIFF_LONG_OPTIONS
|
pascal@19991
|
47 applet_long_options = diff_longopts;
|
pascal@19991
|
48 #endif
|
pascal@19991
|
49 - getopt32(argv, "abdiL:*NqrsS:tTU:+wupBE",
|
pascal@19991
|
50 + getopt32(argv, "abdilL:*NqrsS:tTU:+wupBE",
|
pascal@19991
|
51 &L_arg, &s_start, &opt_U_context);
|
pascal@19991
|
52 argv += optind;
|
pascal@19991
|
53 while (L_arg)
|