Skip to content

Commit 3deb8ec

Browse files
author
郭桦炜
committed
toybox问题修复
Signed-off-by: 郭桦炜 <guohuawei1@huawei.com>
1 parent d6da0cd commit 3deb8ec

File tree

18 files changed

+762
-513
lines changed

18 files changed

+762
-513
lines changed

generated/flags.h

+122-92
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,13 @@
335335
#undef FOR_clear
336336
#endif
337337

338-
// cmp <1>2ls(silent)(quiet)[!ls] <1>2ls(silent)(quiet)[!ls]
338+
// cmp <1>4ls(silent)(quiet)n#<1[!ls] <1>4ls(silent)(quiet)n#<1[!ls]
339339
#undef OPTSTR_cmp
340-
#defineOPTSTR_cmp "<1>2ls(silent)(quiet)[!ls]"
340+
#defineOPTSTR_cmp "<1>4ls(silent)(quiet)n#<1[!ls]"
341341
#ifdefCLEANUP_cmp
342342
#undef CLEANUP_cmp
343343
#undef FOR_cmp
344+
#undef FLAG_n
344345
#undef FLAG_s
345346
#undef FLAG_l
346347
#endif
@@ -448,9 +449,9 @@
448449
#undef FLAG_c
449450
#endif
450451

451-
// cut b*|c*|f*|F*|C*|O(output-delimiter):d:sDn[!cbf] b*|c*|f*|F*|C*|O(output-delimiter):d:sDn[!cbf]
452+
// cut b*|c*|f*|F(regex-fields)*|C*|O(output-delimiter):d:sD(allow-duplicates)n[!cbfF] b*|c*|f*|F(regex-fields)*|C*|O(output-delimiter):d:sD(allow-duplicates)n[!cbfF]
452453
#undef OPTSTR_cut
453-
#defineOPTSTR_cut "b*|c*|f*|F*|C*|O(output-delimiter):d:sDn[!cbf]"
454+
#defineOPTSTR_cut "b*|c*|f*|F(regex-fields)*|C*|O(output-delimiter):d:sD(allow-duplicates)n[!cbfF]"
454455
#ifdefCLEANUP_cut
455456
#undef CLEANUP_cut
456457
#undef FOR_cut
@@ -1075,9 +1076,9 @@
10751076
#undef FLAG_t
10761077
#endif
10771078

1078-
// grep (line-buffered)(color):;(exclude-dir)*S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rRsvwcl(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EFw] (line-buffered)(color):;(exclude-dir)*S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rRsvwcl(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EFw]
1079+
// grep (line-buffered)(color):;(exclude-dir)*S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rRsvwc(count)L(files-without-match)l(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EF] (line-buffered)(color):;(exclude-dir)*S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rRsvwc(count)L(files-without-match)l(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EF]
10791080
#undef OPTSTR_grep
1080-
#defineOPTSTR_grep "(line-buffered)(color):;(exclude-dir)*S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rRsvwcl(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EFw]"
1081+
#defineOPTSTR_grep "(line-buffered)(color):;(exclude-dir)*S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rRsvwc(count)L(files-without-match)l(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EF]"
10811082
#ifdefCLEANUP_grep
10821083
#undef CLEANUP_grep
10831084
#undef FOR_grep
@@ -1645,14 +1646,15 @@
16451646
#undef FLAG_S
16461647
#endif
16471648

1648-
// ls (color):;(full-time)(show-control-chars)ZgoACFHLRSabcdfhikl@mnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL][!qb] (color):;(full-time)(show-control-chars)ZgoACFHLRSabcdfhikl@mnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL][!qb]
1649+
// ls (sort):(color):;(full-time)(block-size)#=1024<1(show-control-chars)?(group-directories-first)tZgoACFHLNRSUXabcdfhikl@mnpqrstuw#=80<0x1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL][-Nqb] (sort):(color):;(full-time)(block-size)#=1024<1(show-control-chars)?(group-directories-first)tZgoACFHLNRSUXabcdfhikl@mnpqrstuw#=80<0x1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL][-Nqb]
16491650
#undef OPTSTR_ls
1650-
#defineOPTSTR_ls "(color):;(full-time)(show-control-chars)ZgoACFHLRSabcdfhikl@mnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL][!qb]"
1651+
#defineOPTSTR_ls "(sort):(color):;(full-time)(block-size)#=1024<1(show-control-chars)?(group-directories-first)tZgoACFHLNRSUXabcdfhikl@mnpqrstuw#=80<0x1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL][-Nqb]"
16511652
#ifdefCLEANUP_ls
16521653
#undef CLEANUP_ls
16531654
#undef FOR_ls
16541655
#undef FLAG_1
16551656
#undef FLAG_x
1657+
#undef FLAG_w
16561658
#undef FLAG_u
16571659
#undef FLAG_t
16581660
#undef FLAG_s
@@ -1670,8 +1672,11 @@
16701672
#undef FLAG_c
16711673
#undef FLAG_b
16721674
#undef FLAG_a
1675+
#undef FLAG_X
1676+
#undef FLAG_U
16731677
#undef FLAG_S
16741678
#undef FLAG_R
1679+
#undef FLAG_N
16751680
#undef FLAG_L
16761681
#undef FLAG_H
16771682
#undef FLAG_F
@@ -1680,9 +1685,13 @@
16801685
#undef FLAG_o
16811686
#undef FLAG_g
16821687
#undef FLAG_Z
1688+
#undef FLAG_X7E
1689+
#undef FLAG_X21
16831690
#undef FLAG_show_control_chars
1691+
#undef FLAG_block_size
16841692
#undef FLAG_full_time
16851693
#undef FLAG_color
1694+
#undef FLAG_sort
16861695
#endif
16871696

16881697
// lsattr vldaR vldaR
@@ -1706,7 +1715,7 @@
17061715
#undef FOR_lsmod
17071716
#endif
17081717

1709-
// lsof lp*t
1718+
// lsof lp*t lp*t
17101719
#undef OPTSTR_lsof
17111720
#defineOPTSTR_lsof "lp*t"
17121721
#ifdefCLEANUP_lsof
@@ -2207,9 +2216,14 @@
22072216
#undef FLAG_s
22082217
#endif
22092218

2210-
// ping <1>1m#t#<0>255=64c#<0=3s#<0>4088=56i%W#<0=3w#<0qf46I:[-46] <1>1m#t#<0>255=64c#<0=3s#<0>4088=56i%W#<0=3w#<0qf46I:[-46]
2219+
// ping <1>1m#t#<0>255=64c#<0=3s#<0>65512=56i%W#<0=3w#<0qf46I:[-46] <1>1m#t#<0>255=64c#<0=3s#<0>65512=56i%W#<0=3w#<0qf46I:[-46]
22112220
#undef OPTSTR_ping
2221+
#ifdefTOYBOX_OH_ADAPT
2222+
/* fix "ping -s 65500" fail problem*/
2223+
#defineOPTSTR_ping "<1>1m#t#<0>255=64c#<0=3s#<0>65512=56i%W#<0=3w#<0qf46I:[-46]"
2224+
#else
22122225
#defineOPTSTR_ping "<1>1m#t#<0>255=64c#<0=3s#<0>4088=56i%W#<0=3w#<0qf46I:[-46]"
2226+
#endif
22132227
#ifdefCLEANUP_ping
22142228
#undef CLEANUP_ping
22152229
#undef FOR_ping
@@ -3761,11 +3775,13 @@
37613775
#endif
37623776

37633777
#ifdefFOR_cmp
3778+
#defineCLEANUP_cmp
37643779
#ifndefTT
37653780
#defineTT this.cmp
37663781
#endif
3767-
#defineFLAG_s (1<<0)
3768-
#defineFLAG_l (1<<1)
3782+
#defineFLAG_n (1LL<<0)
3783+
#defineFLAG_s (1LL<<1)
3784+
#defineFLAG_l (1LL<<2)
37693785
#endif
37703786

37713787
#ifdefFOR_comm
@@ -3859,19 +3875,20 @@
38593875
#endif
38603876

38613877
#ifdefFOR_cut
3878+
#defineCLEANUP_cut
38623879
#ifndefTT
38633880
#defineTT this.cut
38643881
#endif
3865-
#defineFLAG_n (1<<0)
3866-
#defineFLAG_D (1<<1)
3867-
#defineFLAG_s (1<<2)
3868-
#defineFLAG_d (1<<3)
3869-
#defineFLAG_O (1<<4)
3870-
#defineFLAG_C (1<<5)
3871-
#defineFLAG_F (1<<6)
3872-
#defineFLAG_f (1<<7)
3873-
#defineFLAG_c (1<<8)
3874-
#defineFLAG_b (1<<9)
3882+
#defineFLAG_n (1LL<<0)
3883+
#defineFLAG_D (1LL<<1)
3884+
#defineFLAG_s (1LL<<2)
3885+
#defineFLAG_d (1LL<<3)
3886+
#defineFLAG_O (1LL<<4)
3887+
#defineFLAG_C (1LL<<5)
3888+
#defineFLAG_F (1LL<<6)
3889+
#defineFLAG_f (1LL<<7)
3890+
#defineFLAG_c (1LL<<8)
3891+
#defineFLAG_b (1LL<<9)
38753892
#endif
38763893

38773894
#ifdefFOR_date
@@ -4392,41 +4409,43 @@
43924409
#endif
43934410

43944411
#ifdefFOR_grep
4412+
#defineCLEANUP_grep
43954413
#ifndefTT
43964414
#defineTT this.grep
43974415
#endif
4398-
#defineFLAG_x (1<<0)
4399-
#defineFLAG_m (1<<1)
4400-
#defineFLAG_A (1<<2)
4401-
#defineFLAG_B (1<<3)
4402-
#defineFLAG_C (1<<4)
4403-
#defineFLAG_f (1<<5)
4404-
#defineFLAG_e (1<<6)
4405-
#defineFLAG_q (1<<7)
4406-
#defineFLAG_l (1<<8)
4407-
#defineFLAG_c (1<<9)
4408-
#defineFLAG_w (1<<10)
4409-
#defineFLAG_v (1<<11)
4410-
#defineFLAG_s (1<<12)
4411-
#defineFLAG_R (1<<13)
4412-
#defineFLAG_r (1<<14)
4413-
#defineFLAG_o (1<<15)
4414-
#defineFLAG_n (1<<16)
4415-
#defineFLAG_i (1<<17)
4416-
#defineFLAG_h (1<<18)
4417-
#defineFLAG_b (1<<19)
4418-
#defineFLAG_a (1<<20)
4419-
#defineFLAG_I (1<<21)
4420-
#defineFLAG_H (1<<22)
4421-
#defineFLAG_F (1<<23)
4422-
#defineFLAG_E (1<<24)
4423-
#defineFLAG_z (1<<25)
4424-
#defineFLAG_Z (1<<26)
4425-
#defineFLAG_M (1<<27)
4426-
#defineFLAG_S (1<<28)
4427-
#defineFLAG_exclude_dir (1<<29)
4428-
#defineFLAG_color (1<<30)
4429-
#defineFLAG_line_buffered (1<<31)
4416+
#defineFLAG_x (1LL<<0)
4417+
#defineFLAG_m (1LL<<1)
4418+
#defineFLAG_A (1LL<<2)
4419+
#defineFLAG_B (1LL<<3)
4420+
#defineFLAG_C (1LL<<4)
4421+
#defineFLAG_f (1LL<<5)
4422+
#defineFLAG_e (1LL<<6)
4423+
#defineFLAG_q (1LL<<7)
4424+
#defineFLAG_l (1LL<<8)
4425+
#defineFLAG_L (1LL<<9)
4426+
#defineFLAG_c (1LL<<10)
4427+
#defineFLAG_w (1LL<<11)
4428+
#defineFLAG_v (1LL<<12)
4429+
#defineFLAG_s (1LL<<13)
4430+
#defineFLAG_R (1LL<<14)
4431+
#defineFLAG_r (1LL<<15)
4432+
#defineFLAG_o (1LL<<16)
4433+
#defineFLAG_n (1LL<<17)
4434+
#defineFLAG_i (1LL<<18)
4435+
#defineFLAG_h (1LL<<19)
4436+
#defineFLAG_b (1LL<<20)
4437+
#defineFLAG_a (1LL<<21)
4438+
#defineFLAG_I (1LL<<22)
4439+
#defineFLAG_H (1LL<<23)
4440+
#defineFLAG_F (1LL<<24)
4441+
#defineFLAG_E (1LL<<25)
4442+
#defineFLAG_z (1LL<<26)
4443+
#defineFLAG_Z (1LL<<27)
4444+
#defineFLAG_M (1LL<<28)
4445+
#defineFLAG_S (1LL<<29)
4446+
#defineFLAG_exclude_dir (1LL<<30)
4447+
#defineFLAG_color (1LL<<31)
4448+
#defineFLAG_line_buffered (1LL<<32)
44304449
#endif
44314450

44324451
#ifdefFOR_groupadd
@@ -4871,41 +4890,50 @@
48714890
#endif
48724891

48734892
#ifdefFOR_ls
4893+
#defineCLEANUP_ls
48744894
#ifndefTT
48754895
#defineTT this.ls
48764896
#endif
4877-
#defineFLAG_1 (1<<0)
4878-
#defineFLAG_x (1<<1)
4879-
#defineFLAG_u (1<<2)
4880-
#defineFLAG_t (1<<3)
4881-
#defineFLAG_s (1<<4)
4882-
#defineFLAG_r (1<<5)
4883-
#defineFLAG_q (1<<6)
4884-
#defineFLAG_p (1<<7)
4885-
#defineFLAG_n (1<<8)
4886-
#defineFLAG_m (1<<9)
4887-
#defineFLAG_l (1<<10)
4888-
#defineFLAG_k (1<<11)
4889-
#defineFLAG_i (1<<12)
4890-
#defineFLAG_h (1<<13)
4891-
#defineFLAG_f (1<<14)
4892-
#defineFLAG_d (1<<15)
4893-
#defineFLAG_c (1<<16)
4894-
#defineFLAG_b (1<<17)
4895-
#defineFLAG_a (1<<18)
4896-
#defineFLAG_S (1<<19)
4897-
#defineFLAG_R (1<<20)
4898-
#defineFLAG_L (1<<21)
4899-
#defineFLAG_H (1<<22)
4900-
#defineFLAG_F (1<<23)
4901-
#defineFLAG_C (1<<24)
4902-
#defineFLAG_A (1<<25)
4903-
#defineFLAG_o (1<<26)
4904-
#defineFLAG_g (1<<27)
4905-
#defineFLAG_Z (1<<28)
4906-
#defineFLAG_show_control_chars (1<<29)
4907-
#defineFLAG_full_time (1<<30)
4908-
#defineFLAG_color (1<<31)
4897+
#defineFLAG_1 (1LL<<0)
4898+
#defineFLAG_x (1LL<<1)
4899+
#defineFLAG_w (1LL<<2)
4900+
#defineFLAG_u (1LL<<3)
4901+
#defineFLAG_t (1LL<<4)
4902+
#defineFLAG_s (1LL<<5)
4903+
#defineFLAG_r (1LL<<6)
4904+
#defineFLAG_q (1LL<<7)
4905+
#defineFLAG_p (1LL<<8)
4906+
#defineFLAG_n (1LL<<9)
4907+
#defineFLAG_m (1LL<<10)
4908+
#defineFLAG_l (1LL<<11)
4909+
#defineFLAG_k (1LL<<12)
4910+
#defineFLAG_i (1LL<<13)
4911+
#defineFLAG_h (1LL<<14)
4912+
#defineFLAG_f (1LL<<15)
4913+
#defineFLAG_d (1LL<<16)
4914+
#defineFLAG_c (1LL<<17)
4915+
#defineFLAG_b (1LL<<18)
4916+
#defineFLAG_a (1LL<<19)
4917+
#defineFLAG_X (1LL<<20)
4918+
#defineFLAG_U (1LL<<21)
4919+
#defineFLAG_S (1LL<<22)
4920+
#defineFLAG_R (1LL<<23)
4921+
#defineFLAG_N (1LL<<24)
4922+
#defineFLAG_L (1LL<<25)
4923+
#defineFLAG_H (1LL<<26)
4924+
#defineFLAG_F (1LL<<27)
4925+
#defineFLAG_C (1LL<<28)
4926+
#defineFLAG_A (1LL<<29)
4927+
#defineFLAG_o (1LL<<30)
4928+
#defineFLAG_g (1LL<<31)
4929+
#defineFLAG_Z (1LL<<32)
4930+
#defineFLAG_X7E (1LL<<33)
4931+
#defineFLAG_X21 (1LL<<34)
4932+
#defineFLAG_show_control_chars (1LL<<35)
4933+
#defineFLAG_block_size (1LL<<36)
4934+
#defineFLAG_full_time (1LL<<37)
4935+
#defineFLAG_color (1LL<<38)
4936+
#defineFLAG_sort (1LL<<39)
49094937
#endif
49104938

49114939
#ifdefFOR_lsattr
@@ -4926,12 +4954,13 @@
49264954
#endif
49274955

49284956
#ifdefFOR_lsof
4957+
#defineCLEANUP_lsof
49294958
#ifndefTT
49304959
#defineTT this.lsof
49314960
#endif
4932-
#defineFLAG_t (FORCED_FLAG<<0)
4933-
#defineFLAG_p (FORCED_FLAG<<1)
4934-
#defineFLAG_l (FORCED_FLAG<<2)
4961+
#defineFLAG_t (1LL<<0)
4962+
#defineFLAG_p (1LL<<1)
4963+
#defineFLAG_l (1LL<<2)
49354964
#endif
49364965

49374966
#ifdefFOR_lspci
@@ -5340,12 +5369,13 @@
53405369
#endif
53415370

53425371
#ifdefFOR_pidof
5372+
#defineCLEANUP_pidof
53435373
#ifndefTT
53445374
#defineTT this.pidof
53455375
#endif
5346-
#defineFLAG_x (1<<0)
5347-
#defineFLAG_o (1<<1)
5348-
#defineFLAG_s (1<<2)
5376+
#defineFLAG_x (1LL<<0)
5377+
#defineFLAG_o (1LL<<1)
5378+
#defineFLAG_s (1LL<<2)
53495379
#endif
53505380

53515381
#ifdefFOR_ping

generated/globals.h

+7-4
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,8 @@ struct cksum_data {
11991199
// toys/posix/cmp.c
12001200

12011201
structcmp_data {
1202+
longn;
1203+
12021204
intfd;
12031205
char*name;
12041206
};
@@ -1237,6 +1239,7 @@ struct cut_data {
12371239
char*d, *O;
12381240
structarg_list*select[5]; // we treat them the same, so loop through
12391241

1242+
unsignedline;
12401243
intpairs;
12411244
regex_treg;
12421245
};
@@ -1311,8 +1314,8 @@ struct grep_data {
13111314

13121315
char*purple, *cyan, *red, *green, *grey;
13131316
structdouble_list*reg;
1314-
charindelim, outdelim;
1315-
intfound, tried;
1317+
intfound, tried, delim;
1318+
structarg_list*fixed[256];
13161319
};
13171320

13181321
// toys/posix/head.c
@@ -1359,8 +1362,8 @@ struct logger_data {
13591362
// toys/posix/ls.c
13601363

13611364
structls_data {
1362-
longl;
1363-
char*color;
1365+
longw, l, block_size;
1366+
char*color, *sort;
13641367

13651368
structdirtree*files, *singledir;
13661369
unsignedscreen_width;

0 commit comments

Comments
 (0)
close