<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/editors/cmp.c, branch waitfor</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=waitfor</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=waitfor'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2026-07-03T06:14:23+00:00</updated>
<entry>
<title>cmp: add KMG suffix for cmp -n MAXCOUNT</title>
<updated>2026-07-03T06:14:23+00:00</updated>
<author>
<name>Anubhav Kokane</name>
<email>dev.anubhavk@gmail.com</email>
</author>
<published>2026-07-02T17:32:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=71f9960b33f2faddd8b1c9cd1681208c6222e57e'/>
<id>urn:sha1:71f9960b33f2faddd8b1c9cd1681208c6222e57e</id>
<content type='text'>
Change input to getopt32 from int to char * so that
max_count is parsed as string. Use xatol_sfx to convert
string to long.

function                                             old     new   delta
cmp_main                                             595     631     +36
.rodata                                           107121  107120      -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 36/-1)              Total: 35 bytes

Signed-off-by: Anubhav Kokane &lt;dev.anubhavk@gmail.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>cmp: fix -n causing all diffs to be output, implement size suffixes for SKIP</title>
<updated>2026-01-18T01:41:20+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2026-01-18T01:38:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=fc9d352b4cae7bd962723480d1323fb1b5f46e32'/>
<id>urn:sha1:fc9d352b4cae7bd962723480d1323fb1b5f46e32</id>
<content type='text'>
function                                             old     new   delta
packed_usage                                       35802   35828     +26
cmp_main                                             616     595     -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 26/-21)              Total: 5 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>cmp: stop skipping bytes if EOF is reached</title>
<updated>2026-01-18T00:41:19+00:00</updated>
<author>
<name>Giorgi Tchankvetadze</name>
<email>giorgitchankvetadze1997@gmail.com</email>
</author>
<published>2025-12-06T10:56:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=3bfbce8312b93ef76555da77ac4967d30aeec9fa'/>
<id>urn:sha1:3bfbce8312b93ef76555da77ac4967d30aeec9fa</id>
<content type='text'>
Currently, if a skip value is larger than the file size, cmp will continue
to loop and call getc() until the skip count is satisfied, even though
EOF has been reached.

For large skip values (e.g., 1 billion), this results in significant
CPU waste and execution time (e.g., 11 seconds on a modern CPU).

This patch checks for EOF inside the skip loop and breaks early.

Test case:
$ touch empty.txt
$ time ./busybox cmp empty.txt empty.txt 1000000000 1000000000

Before:
real    0m10.937s

After:
real    0m0.002s

function                                             old     new   delta
cmp_main                                             594     616     +22

Signed-off-by: Giorgi Tchankvetadze &lt;giorgitchankvetadze1997@gmail.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>Update applet size estimates</title>
<updated>2023-07-10T15:25:21+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2023-07-10T15:25:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=5353df91cba7b397b9407701681708d0a1518df6'/>
<id>urn:sha1:5353df91cba7b397b9407701681708d0a1518df6</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>Add support for long options to cmp</title>
<updated>2022-01-23T19:24:32+00:00</updated>
<author>
<name>Walter Lozano</name>
<email>walter.lozano@collabora.com</email>
</author>
<published>2022-01-21T14:00:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=6dd6a6c42d1465d8cca2539476f6bffd5e1353dd'/>
<id>urn:sha1:6dd6a6c42d1465d8cca2539476f6bffd5e1353dd</id>
<content type='text'>
In order to improve compatibility with GNU cmp add support for long
options to busybox cmp.

function                                             old     new   delta
static.cmp_longopts                                    -      36     +36
cmp_main                                             589     594      +5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 41/0)               Total: 41 bytes

Signed-off-by: Walter Lozano &lt;walter.lozano@collabora.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>cmp: code shrink</title>
<updated>2021-12-17T21:43:45+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2021-12-17T21:43:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=c1eac153e8b89cfc9d550991735c09bad1579201'/>
<id>urn:sha1:c1eac153e8b89cfc9d550991735c09bad1579201</id>
<content type='text'>
function                                             old     new   delta
.rodata                                           104203  104201      -2

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>cmp: add support for -n</title>
<updated>2021-12-17T21:07:06+00:00</updated>
<author>
<name>Walter Lozano</name>
<email>walter.lozano@collabora.com</email>
</author>
<published>2021-11-25T16:11:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=579894bfd28ffb38f7dabc7862d4e7ebfade2865'/>
<id>urn:sha1:579894bfd28ffb38f7dabc7862d4e7ebfade2865</id>
<content type='text'>
Add support to for "-n" to cmp in order to compare at most n bytes.

function                                             old     new   delta
cmp_main                                             552     589     +37
.rodata                                           104198  104203      +5
packed_usage                                       34102   34074     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 42/-28)             Total: 14 bytes

Signed-off-by: Walter Lozano &lt;walter.lozano@collabora.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>*: --help tweaks</title>
<updated>2021-06-14T18:47:20+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2021-06-14T18:47:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=e2b9215868a3d72691e5bc0f887354254606447b'/>
<id>urn:sha1:e2b9215868a3d72691e5bc0f887354254606447b</id>
<content type='text'>
function                                             old     new   delta
packed_usage                                       33589   33552     -37

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>config: update size information</title>
<updated>2018-12-28T02:20:17+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-12-28T02:20:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=b097a84d62dcfcf201a695b54bcfafae70cac8a6'/>
<id>urn:sha1:b097a84d62dcfcf201a695b54bcfafae70cac8a6</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>regularize format of source file headers, no code changes</title>
<updated>2017-09-18T14:28:43+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2017-09-18T14:28:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=0c4dbd481aedb5d22c1048e7f7eb547a3b5e50a5'/>
<id>urn:sha1:0c4dbd481aedb5d22c1048e7f7eb547a3b5e50a5</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
</feed>
