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