Commit Graph

62 Commits

Author SHA1 Message Date
Aaro Koskinen
a47fccaa63 diff: fix -B with single line changes
Fix -B with single line changes. They were always ignored regardless
if they were blank or not.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31 16:50:49 +02:00
Maninder Singh
97c6491b4e typo fixes
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-25 13:46:36 +02:00
Denys Vlasenko
39f017293a diff: fix a bug in diffing against stdin. Closes 7784
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-11 16:41:54 +01:00
Denys Vlasenko
73225b6d6e switch editors/* to embedded-in-source kbuild system
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-13 12:45:33 +01:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Denys Vlasenko
14bd16ac56 more tweak for bionic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08 08:49:40 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Denys Vlasenko
d616ab6bbb reformime: do not require \r\n
function                                             old     new   delta
parse                                                958    1063    +105
packed_usage                                       28691   28712     +21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-22 03:46:33 +02:00
Pere Orga
6a3e01d5a9 move help text from include/usage.src.h to debianutils/*.c e2fsprogs/*.c editors/*.c loginutils/*.c mailutils/*.c
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-03 01:33:55 +02:00
Roman Borisov
95f5c52e6f diff: optimize diffing of files with the same metadata
Signed-off-by: Roman Borisov <ext-roman.borisov@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-27 23:24:09 +02:00
Alexander Shishkin
f18a82d9b3 diff: return 1 when skipping directories with -r, but without -N
Diff in diffutils will return 1 in case -r option is specified without
-N something exists only in one of the directories.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 01:09:12 +01:00
Denys Vlasenko
fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Alexander Shishkin
6722737ece *: introduce and use xmkstemp. -65 bytes.
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22 13:27:16 +02:00
Denys Vlasenko
25b4755302 typo fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-30 01:19:47 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
75703eb8d5 diff: make diff -r much less eager to recurse into directories
function                                             old     new   delta
skip_dir                                              44     120     +76
diff_main                                           1175    1185     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-10 16:25:47 +02:00
Denys Vlasenko
32a6baeefa diff: cosmetic change on top of last commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-09 19:44:38 +02:00
Matheus Izvekov
61f5f7823c diff: fix "diff dir1 dir2/". Closes bug 2203
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-09 19:40:00 +02:00
Dan Fandrich
1821d188ca diff: more compiler compat fixes. no code changes
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 04:04:56 +01:00
Dan Fandrich
f111b67100 diff: make code more portable
function                                             old     new   delta
create_J                                            1835    1849     +14
diffreg                                             1268    1255     -13

Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 00:10:30 +01:00
Matheus Izvekov
6f99c91e43 diff: fix flag -B, cleanups and a couple more tests V2
function                                             old     new   delta
diffreg                                             1157    1268    +111
uni_range                                             51       -     -51

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-22 04:20:16 +01:00
Denys Vlasenko
94ca6943bc *: small code shrinks and compile fix for unicode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:51:09 +01:00
Matheus Izvekov
94a6fd1eeb diff: don't exit in case we can't open input files. -2 bytes
>>From d4cf19d20596bca797d58563f4404cf6a4932977 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 23:27:56 -0200
Subject: [PATCH] diff: don't exit in case we can't open input files

This prevents recursion being aborted due to failures to open files.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:46:14 +01:00
Matheus Izvekov
404f14407c diff: don't use FILE_and_pos_t where it's not needed. -31 bytes
>>From 3ead41fc3cbdd904e478ff7a710f5960c8ed4288 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 22:14:46 -0200
Subject: [PATCH] diff: don't use FILE_and_pos_t where it's not needed. -31 bytes

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:46:01 +01:00
Matheus Izvekov
4de4cb6b9b diff: correct handling of labels. -10 bytes
>>From 05eeb173f0431b4fbed7684d7a9cea42f747f63e Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 20:33:55 -0200
Subject: [PATCH] diff: correct handling of labels

This fixes an issue where diff would apply labels to files in the
inverse order, when using -L or --label.
This fixes it in order to be compatible with gnu diff.
It also makes it not an error to specify more than one label.
The behavior for such cases is that they override the label for the new
file.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:45:45 +01:00
Matheus Izvekov
b32aa0c274 diff: support long options
>>From 7b74284ebe6222cb714c37cdbb94633965f29e9b Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 18:36:52 -0200
Subject: [PATCH] diff: support long options

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:45:23 +01:00
Matheus Izvekov
fe1ce2e43e diff: implement flag -B (Ignore changes whose lines are all blank)
>>From 7c3ce93213590bd0592435dc27d1272d0fd3309b Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 15:52:31 -0200
Subject: [PATCH] diff: implement flag -B (Ignore changes whose lines are all blank)

function                                             old     new   delta
diffreg                                             1196    1240     +44
.rodata                                             6538    6561     +23
packed_usage                                         457     478     +21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 88/0)               Total: 88 bytes
   text	   data	    bss	    dec	    hex	filename
  70123	    733	   8576	  79432	  13648	busybox_old
  70190	    733	   8576	  79499	  1368b	busybox_unstripped

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:45:05 +01:00
Matheus Izvekov
b7a044043c diff: honor flag -i (ignore case differences)
>>From 503a1e1d2597f7cdf86a9ea39ebd2aee050ca759 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 14:06:26 -0200
Subject: [PATCH] diff: honor flag -i (ignore case differences)

function                                             old     new   delta
read_token                                           157     178     +21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 21/0)               Total: 21 bytes
   text	   data	    bss	    dec	    hex	filename
  70102	    733	   8576	  79411	  13633	busybox_old
  70123	    733	   8576	  79432	  13648	busybox_unstripped

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:44:44 +01:00
Denys Vlasenko
9e0879a1cb diff: add NOINLINE
function                                             old     new   delta
create_J                                               -    1805   +1805
diffreg                                             3159    1176   -1983
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 1805/-1983)       Total: -178 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-18 06:15:57 +01:00
Denys Vlasenko
032bf65533 diff: defeat gcc's optimization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-18 05:22:34 +01:00
Matheus Izvekov
d4a7728dc3 diff: rewrite. much smaller and more correct
function                                             old     new   delta
diffreg                                             1815    3156   +1341
diff_main                                            860    1194    +334
read_token                                             -     161    +161
skip_dir                                               -      44     +44
seek_ft                                                -      31     +31
fetch                                                362     392     +30
line_compar                                            -      21     +21
add_to_dirlist                                        65      61      -4
print_only                                            16       -     -16
skipline                                              51       -     -51
newcand                                               85       -     -85
asciifile                                             89       -     -89
print_status                                         178      73    -105
make_temp                                            148       -    -148
files_differ                                         168       -    -168
get_recursive_dirlist                                182       -    -182
sort                                                 226       -    -226
prepare                                              283       -    -283
change                                               283       -    -283
do_diff                                              416       -    -416
dump_unified_vec                                     457       -    -457
check                                               1512     595    -917
------------------------------------------------------------------------------
(add/remove: 4/12 grow/shrink: 3/3 up/down: 1962/-3430)     Total: -1468 bytes

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-18 04:57:17 +01:00
Denys Vlasenko
8684cbb5cc libbb: robustify isXXXX(). +39 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-18 11:34:43 +01:00
Denys Vlasenko
d8dd25a2a7 diff: debug macros; one trivial size optimization
function                                             old     new   delta
diffreg                                             1781    1815     +34
isqrt                                                 64       -     -64
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 34/-64)            Total: -30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-21 01:23:19 +02:00
Denys Vlasenko
3e02050314 diff: fix bug 613 (diff -ub segfaults)
function                                             old     new   delta
dump_unified_vec                                     435     457     +22
diff_main                                            855     860      +5
diffreg                                             1786    1781      -5
do_diff                                              428     416     -12
change                                               325     283     -42
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/3 up/down: 27/-59)            Total: -32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-21 01:22:18 +02:00
Denys Vlasenko
38d9072b2c diff: tiny compat tweak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 12:55:13 +02:00
Denis Vlasenko
5e34ff29bc *: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00:00
Denis Vlasenko
4c83025ea6 diff: emit /dev/null if diff -rN diffs a file against /dev/null
function                                             old     new   delta
diffreg                                             1782    1786      +4
2008-11-23 14:40:00 +00:00
Denis Vlasenko
582dff0514 volume identification: abolish /proc/partitions and /proc/cdroms
scanning. It does not catch volume managers and such.
Adding even more cruft is bad, so I decided to simply
scan /dev/* for any block devices. See how much better
it finds devices now:

# ./busybox_old blkid
/dev/sda1: LABEL="/boot" UUID="7931e231-dcb4-4b6d-9301-f7354ae24061"
/dev/dm-0: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"
/dev/dm-1: UUID="edc2a920-ef83-437e-ba64-d3b6dc851267"
/dev/sdb1: UUID="6F84-ED0F"

# ./busybox blkid
/dev/sdb1: UUID="6F84-ED0F"
/dev/root: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"
/dev/dm-1: UUID="edc2a920-ef83-437e-ba64-d3b6dc851267"
/dev/dm-0: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"
/dev/sda1: LABEL="/boot" UUID="7931e231-dcb4-4b6d-9301-f7354ae24061"
/dev/mapper/VolGroup00-LogVol01: UUID="edc2a920-ef83-437e-ba64-d3b6dc851267"
/dev/mapper/VolGroup00-LogVol00: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"

function                                             old     new   delta
static.drive_name_string                              12       -     -12
append_mount_options                                 205     190     -15
volume_id_open_node                                   37      18     -19
uuidcache_check_device                               485     257    -228
uuidcache_init                                       637      36    -601
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/4 up/down: 0/-875)           Total: -875 bytes
   text    data     bss     dec     hex filename
 792218     592    6648  799458   c32e2 busybox_old
 791260     592    6648  798500   c2f24 busybox_unstripped
2008-10-19 19:36:30 +00:00
Denis Vlasenko
deeed59de0 libbb: introduce and use xrealloc_vector
function                                             old     new   delta
xrealloc_vector_helper                                 -      51     +51
create_list                                           84      99     +15
getopt_main                                          690     695      +5
passwd_main                                         1049    1053      +4
get_cached                                            85      89      +4
msh_main                                            1377    1380      +3
add_match                                             42      41      -1
read_lines                                           720     718      -2
grave                                               1068    1066      -2
fill_match_lines                                     143     141      -2
add_to_dirlist                                        67      65      -2
add_input_file                                        49      47      -2
act                                                  252     250      -2
fsck_main                                           2252    2246      -6
man_main                                             765     757      -8
bb_internal_initgroups                               228     220      -8
cut_main                                            1052    1041     -11
add_edge_to_node                                      55      43     -12
dpkg_main                                           3851    3835     -16
ifupdown_main                                       2202    2178     -24
sort_main                                            838     812     -26
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/15 up/down: 82/-124)          Total: -42 bytes
2008-07-08 05:14:36 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
defc1ea340 *: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text    data     bss     dec     hex filename
 808035     611    6868  815514   c719a busybox_old
 804472     611    6868  811951   c63af busybox_unstripped
2008-06-27 02:52:20 +00:00
Denis Vlasenko
cc3f20b9bd fix breakage found by randomconfig 2008-06-23 22:31:52 +00:00
Denis Vlasenko
d50dda8c35 *: use llist_pop for traverse-and-free list operation
function                                             old     new   delta
append_file_list_to_list                             109     111      +2
udhcpc_main                                         2414    2413      -1
run_parts_main                                       325     324      -1
od_main                                             2324    2323      -1
getopt_main                                          709     707      -2
env_main                                             253     251      -2
sed_main                                             659     656      -3
ps_main                                              522     519      -3
traceroute_main                                     3960    3954      -6
sort_main                                            844     838      -6
diff_main                                            866     858      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/10 up/down: 2/-33)            Total: -31 bytes
2008-06-15 05:40:56 +00:00
Denis Vlasenko
a05c0716c2 grep: make "-f -" work (+ testsuite)
diff: small code shrink

function                                             old     new   delta
grep_main                                            722     714      -8
diffreg                                             1825    1793     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-40)             Total: -40 bytes
2008-06-07 05:19:31 +00:00
Denis Vlasenko
dccfe05e17 diff: improve comments (no code chages) 2008-03-24 18:40:32 +00:00
Denis Vlasenko
c4c2cd44d2 diff: exclude D_EMPTY code if there is no support for -r
function                                             old     new   delta
diffreg                                             1808    1825     +17
files_differ                                         189     166     -23
2008-03-24 16:55:13 +00:00
Denis Vlasenko
e9d67a81c8 diff: fix small bug; don't make a copy for "/dev/null" case 2008-03-24 16:28:47 +00:00
Denis Vlasenko
7fe0ebac5f diff: reordering and renaming of variables
function                                             old     new   delta
diff_main                                            843     848      +5
get_recursive_dirlist                                177     180      +3
add_to_dirlist                                        64      66      +2
change                                               329     326      -3
files_differ                                         182     176      -6
diffreg                                             1823    1808     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/3 up/down: 10/-24)            Total: -14 bytes
2008-03-24 16:19:21 +00:00
Denis Vlasenko
73132b9c12 diff: make a few variables local
function                                             old     new   delta
diffreg                                             1844    1823     -21
2008-03-24 15:04:24 +00:00
Denis Vlasenko
04211fd204 diff: make it work on pipes etc (needed for kernel compile)
function                                             old     new   delta
get_recursive_dirlist                                  -     177    +177
make_temp                                              -     144    +144
diffreg                                             1818    1844     +26
files_differ                                         175     182      +7
diff_main                                            842     843      +1
get_dir                                              177       -    -177
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/0 up/down: 355/-177)          Total: 178 bytes
2008-03-24 14:44:59 +00:00