2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-08-17 07:47:37 +01:00
< meta name = "generator" content = "ZealOS V1.00" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
2021-07-29 03:20:15 +01:00
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
2021-07-03 05:07:57 +01:00
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = "font-family:monospace;font-size:12pt" >
2021-07-03 05:07:57 +01:00
< a name = "l1" > < / a > < span class = cF0 > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Cmd Line (Typically)" < / span > < span class = cF0 >
< a name = "l2" > < / a >
< a name = "l3" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > FND_REPLACE< / span > < span class = cF0 > < / span > < span class = cFE > 0< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l4" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > FND_SKIP< / span > < span class = cF0 > < / span > < span class = cFE > 1< / span > < span class = cF0 >
< a name = "l5" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > FND_ALL< / span > < span class = cF0 > < / span > < span class = cFE > 2< / span > < span class = cF0 >
< a name = "l6" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > FND_ED< / span > < span class = cF0 > < / span > < span class = cFE > 3< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l7" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > FND_ABORT_FILE< / span > < span class = cF0 > < / span > < span class = cFE > 4< / span > < span class = cF0 >
< a name = "l8" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > FND_SKIP_FILE< / span > < span class = cF0 > < / span > < span class = cFE > 5< / span > < span class = cF0 >
< a name = "l9" > < / a >
< a name = "l10" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > PopUpFindMenu< / span > < span class = cF0 > ()
< a name = "l11" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l12" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i;
< a name = "l13" > < / a > < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc = < / span > < span class = cF5 > DocNew< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l14" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l15" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " $CM+LX,2,4$$BT,\" REPLACE\" ,LE=FND_REPLACE$" < / span > < span class = cF0 >
< a name = "l16" > < / a > < / span > < span class = cF6 > " $CM+LX,22,0$$BT,\" SKIP\" ,LE=FND_SKIP$" < / span > < span class = cF0 >
< a name = "l17" > < / a > < / span > < span class = cF6 > " $CM+LX,2,4$$BT,\" ALL\" ,LE=FND_ALL$" < / span > < span class = cF0 >
< a name = "l18" > < / a > < / span > < span class = cF6 > " $CM+LX,22,0$$BT,\" ABORT ALL\" ,LE=DOCM_CANCEL$" < / span > < span class = cF0 >
< a name = "l19" > < / a > < / span > < span class = cF6 > " $CM+LX,2,4$$BT,\" EDIT\" ,LE=FND_ED$" < / span > < span class = cF0 >
< a name = "l20" > < / a > < / span > < span class = cF6 > " $CM+LX,22,0$$BT,\" ABORT FILE\" ,LE=FND_ABORT_FILE$" < / span > < span class = cF0 >
< a name = "l21" > < / a > < / span > < span class = cF6 > " $CM+LX,2,4$$BT,\" SKIP FILE\" ,LE=FND_SKIP_FILE$\n" < / span > < span class = cF0 > );
< a name = "l22" > < / a > i = < / span > < span class = cF5 > PopUpMenu< / span > < span class = cF0 > (doc);
< a name = "l23" > < / a > < / span > < span class = cF5 > DocDel< / span > < span class = cF0 > (doc);
2021-07-03 05:07:57 +01:00
< a name = "l24" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l25" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > i;
2021-07-03 05:07:57 +01:00
< a name = "l26" > < / a > }
< a name = "l27" > < / a >
< a name = "l28" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > FindFile< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *needle_str, < / span > < span class = cF1 > U8< / span > < span class = cF0 > *haystack_filename, < / span > < span class = cF9 > I64< / span > < span class = cF0 > *_fuf_flags, < / span > < span class = cF1 > U8< / span > < span class = cF0 > *replace_text)
2021-07-26 20:29:49 +01:00
< a name = "l29" > < / a > {< / span > < span class = cF2 > //Have you confused with < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/Kernel/BlkDev/DiskFind.CC.html#l65" > < span class = cF4 > FileFind< / span > < / a > < span class = cF2 > ()?< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l30" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > first_on_line, write_this_file = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > , cont = !< / span > < span class = cF5 > Bt< / span > < span class = cF0 > (_fuf_flags, < / span > < span class = cF3 > FUf_CANCEL< / span > < span class = cF0 > );
< a name = "l31" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *src, *dst, *dst2, *name_buf = < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
< a name = "l32" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i, j, plen, rlen, dlen, count = < / span > < span class = cFE > 0< / span > < span class = cF0 > ,old_flags, ss_flags;
< a name = "l33" > < / a > < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *cur_l, *doc = < / span > < span class = cF5 > DocRead< / span > < span class = cF0 > (haystack_filename, < / span > < span class = cF3 > DOCF_PLAIN_TEXT_TABS< / span > < span class = cF0 > | < / span > < span class = cF3 > DOCF_NO_CURSOR< / span > < span class = cF0 > );
< a name = "l34" > < / a > < / span > < span class = cF9 > CDocEntry< / span > < span class = cF0 > *doc_e;
2021-07-03 05:07:57 +01:00
< a name = "l35" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l36" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > _fuf_flags, < / span > < span class = cF3 > FUf_IGNORE< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l37" > < / a > ss_flags = < / span > < span class = cF3 > SFF_IGNORE_CASE< / span > < span class = cF0 > ;
< a name = "l38" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l39" > < / a > ss_flags = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l40" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > _fuf_flags, < / span > < span class = cF3 > FUf_WHOLE_LABELS< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l41" > < / a > ss_flags |= < / span > < span class = cF3 > SFG_WHOLE_LABELS< / span > < span class = cF0 > ;
< a name = "l42" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > _fuf_flags, < / span > < span class = cF3 > FUf_WHOLE_LABELS_BEFORE< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l43" > < / a > ss_flags |= < / span > < span class = cF3 > SFF_WHOLE_LABELS_BEFORE< / span > < span class = cF0 > ;
< a name = "l44" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > _fuf_flags, < / span > < span class = cF3 > FUf_WHOLE_LABELS_AFTER< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l45" > < / a > ss_flags |= < / span > < span class = cF3 > SFF_WHOLE_LABELS_AFTER< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l46" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l47" > < / a > plen = < / span > < span class = cF5 > StrLen< / span > < span class = cF0 > (needle_str);
< a name = "l48" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (replace_text)
< a name = "l49" > < / a > rlen = < / span > < span class = cF5 > StrLen< / span > < span class = cF0 > (replace_text);
< a name = "l50" > < / a > doc_e = doc-> head.next;
< a name = "l51" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (doc_e != doc & & cont)
< a name = "l52" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l53" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc_e-> type_u8 == < / span > < span class = cF3 > DOCT_TEXT< / span > < span class = cF0 > )
< a name = "l54" > < / a > {
< a name = "l55" > < / a > src = doc_e-> tag;
< a name = "l56" > < / a > first_on_line = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l57" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (src & & cont)
< a name = "l58" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l59" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (src = < / span > < span class = cF5 > StrFind< / span > < span class = cF7 > (< / span > < span class = cF0 > needle_str, src, ss_flags< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l60" > < / a > {
< a name = " l61 " > < / a > count++;
< a name = "l62" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (first_on_line || < / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > _fuf_flags, < / span > < span class = cF3 > FUf_REPLACE< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l63" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l64" > < / a > first_on_line = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l65" > < / a > < / span > < span class = cF5 > PutFileLink< / span > < span class = cF0 > (haystack_filename,, doc_e-> y + < / span > < span class = cFE > 1< / span > < span class = cF0 > , < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > );
< a name = "l66" > < / a > name_buf = < / span > < span class = cF5 > MStrPrint< / span > < span class = cF0 > (< / span > < span class = cF6 > " %s,%d" < / span > < span class = cF0 > , haystack_filename, doc_e-> y + < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l67" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (cur_l = < / span > < span class = cF5 > DocPut< / span > < span class = cF0 > )
< a name = "l68" > < / a > {
< a name = "l69" > < / a > old_flags = cur_l-> flags & < / span > < span class = cF3 > DOCF_PLAIN_TEXT< / span > < span class = cF0 > ;
< a name = "l70" > < / a > cur_l-> flags |= < / span > < span class = cF3 > DOCF_PLAIN_TEXT< / span > < span class = cF0 > ;
< a name = "l71" > < / a > }
< a name = "l72" > < / a > < / span > < span class = cF6 > " %s\n" < / span > < span class = cF0 > , doc_e-> tag;
< a name = "l73" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (cur_l)
< a name = "l74" > < / a > cur_l-> flags = cur_l-> flags & ~< / span > < span class = cF3 > DOCF_PLAIN_TEXT< / span > < span class = cF0 > | old_flags;
< a name = "l75" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l76" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > _fuf_flags, < / span > < span class = cF3 > FUf_REPLACE< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l77" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l78" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > _fuf_flags, < / span > < span class = cF3 > FUf_ALL< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l79" > < / a > i = < / span > < span class = cF3 > FND_ALL< / span > < span class = cF0 > ;
< a name = "l80" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l81" > < / a > {
< a name = "l82" > < / a > i = < / span > < span class = cF5 > PopUpFindMenu< / span > < span class = cF0 > ;
< a name = "l83" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (i < < / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l84" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l85" > < / a > < / span > < span class = cF5 > LBts< / span > < span class = cF0 > (_fuf_flags, < / span > < span class = cF3 > FUf_CANCEL< / span > < span class = cF0 > );
< a name = "l86" > < / a > cont = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l87" > < / a > write_this_file = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l88" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l89" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 > < / span > < span class = cF1 > if< / span > < span class = cF0 > (i == < / span > < span class = cF3 > FND_ALL< / span > < span class = cF0 > )
< a name = "l90" > < / a > < / span > < span class = cF5 > LBts< / span > < span class = cF0 > (_fuf_flags, < / span > < span class = cF3 > FUf_ALL< / span > < span class = cF0 > );
< a name = "l91" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 > < / span > < span class = cF1 > if< / span > < span class = cF0 > (i == < / span > < span class = cF3 > FND_ABORT_FILE< / span > < span class = cF0 > )
< a name = "l92" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l93" > < / a > cont = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l94" > < / a > write_this_file = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l95" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l96" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 > < / span > < span class = cF1 > if< / span > < span class = cF0 > (i == < / span > < span class = cF3 > FND_SKIP_FILE< / span > < span class = cF0 > )
< a name = "l97" > < / a > cont=< / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l98" > < / a > }
< a name = "l99" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (i == < / span > < span class = cF3 > FND_REPLACE< / span > < span class = cF0 > || i == < / span > < span class = cF3 > FND_ALL< / span > < span class = cF0 > )
< a name = "l100" > < / a > {
< a name = "l101" > < / a > dlen = < / span > < span class = cF5 > StrLen< / span > < span class = cF0 > (doc_e-> tag);
< a name = "l102" > < / a > dst = < / span > < span class = cF5 > MAlloc< / span > < span class = cF0 > (dlen + < / span > < span class = cFE > 1< / span > < span class = cF0 > + rlen - plen);
< a name = "l103" > < / a > dst2 = dst;
< a name = "l104" > < / a > j = src - doc_e-> tag;
< a name = "l105" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; i < j; i++)
< a name = "l106" > < / a > *dst++ = doc_e-> tag[i];
< a name = "l107" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; i < rlen; i++)
< a name = "l108" > < / a > *dst++ = replace_text[i];
< a name = "l109" > < / a > src = dst;
< a name = "l110" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = j + plen; i < = dlen; i++)
< a name = "l111" > < / a > *dst++ = doc_e-> tag[i];
< a name = "l112" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (doc_e-> tag);
< a name = "l113" > < / a > doc_e-> tag = dst2;
< a name = "l114" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (cur_l = < / span > < span class = cF5 > DocPut< / span > < span class = cF0 > )
< a name = "l115" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l116" > < / a > old_flags = cur_l-> flags & < / span > < span class = cF3 > DOCF_PLAIN_TEXT< / span > < span class = cF0 > ;
< a name = "l117" > < / a > cur_l-> flags |= < / span > < span class = cF3 > DOCF_PLAIN_TEXT< / span > < span class = cF0 > ;
< a name = "l118" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l119" > < / a > < / span > < span class = cF6 > " %12s,%04d*%s\n" < / span > < span class = cF0 > , haystack_filename, doc_e-> y + < / span > < span class = cFE > 1< / span > < span class = cF0 > , dst2;
< a name = "l120" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (cur_l)
< a name = "l121" > < / a > cur_l-> flags = cur_l-> flags & ~< / span > < span class = cF3 > DOCF_PLAIN_TEXT< / span > < span class = cF0 > | old_flags;
< a name = "l122" > < / a > write_this_file = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l123" > < / a > }
< a name = "l124" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l125" > < / a > {
< a name = "l126" > < / a > src++;
< a name = "l127" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (i == < / span > < span class = cF3 > FND_ED< / span > < span class = cF0 > )
< a name = "l128" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l129" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (name_buf);
< a name = "l130" > < / a > name_buf = < / span > < span class = cF5 > StrNew< / span > < span class = cF0 > (doc-> filename.name);
< a name = "l131" > < / a > doc-> flags & = ~< / span > < span class = cF3 > DOCF_NO_CURSOR< / span > < span class = cF0 > ;
< a name = "l132" > < / a > doc-> cur_entry = doc_e;
< a name = "l133" > < / a > doc-> cur_col = doc_e-> min_col;
< a name = "l134" > < / a > < / span > < span class = cF5 > DocWrite< / span > < span class = cF0 > (doc);
< a name = "l135" > < / a > < / span > < span class = cF5 > DocDel< / span > < span class = cF0 > (doc);
< a name = "l136" > < / a > < / span > < span class = cF6 > " Wrote:%s\n" < / span > < span class = cF0 > , name_buf;
< a name = "l137" > < / a > < / span > < span class = cF5 > Ed< / span > < span class = cF0 > (name_buf);
< a name = "l138" > < / a > doc = < / span > < span class = cF5 > DocRead< / span > < span class = cF0 > (name_buf, < / span > < span class = cF3 > DOCF_PLAIN_TEXT_TABS< / span > < span class = cF0 > );
< a name = "l139" > < / a > doc_e = doc-> cur_entry;
< a name = "l140" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc_e-> last != doc)
< a name = "l141" > < / a > doc_e = doc_e-> last;
< a name = "l142" > < / a > src = < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
< a name = "l143" > < / a > write_this_file = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l144" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l145" > < / a > }
< a name = "l146" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l147" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l148" > < / a > src++;
< a name = "l149" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (name_buf);
< a name = "l150" > < / a > name_buf = < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
< a name = "l151" > < / a > }
< a name = "l152" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l153" > < / a > }
< a name = "l154" > < / a > doc_e = doc_e-> next;
< a name = "l155" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l156" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (write_this_file)
< a name = "l157" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l158" > < / a > < / span > < span class = cF5 > DocWrite< / span > < span class = cF0 > (doc);
< a name = "l159" > < / a > < / span > < span class = cF6 > " Wrote:%s\n" < / span > < span class = cF0 > , doc-> filename.name;
< a name = "l160" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l161" > < / a > < / span > < span class = cF5 > DocDel< / span > < span class = cF0 > (doc);
2021-07-03 05:07:57 +01:00
< a name = "l162" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l163" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > count;
2021-07-03 05:07:57 +01:00
< a name = "l164" > < / a > }
< a name = "l165" > < / a >
< a name = "l166" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > Find< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *needle_str, < / span > < span class = cF1 > U8< / span > < span class = cF0 > *files_find_mask=< / span > < span class = cF6 > " *" < / span > < span class = cF0 > , < / span > < span class = cF1 > U8< / span > < span class = cF0 > *fu_flags=< / span > < span class = cF3 > NULL< / span > < span class = cF0 > , < / span > < span class = cF1 > U8< / span > < span class = cF0 > *replace_text=< / span > < span class = cF3 > NULL< / span > < span class = cF0 > )
< a name = "l167" > < / a > {< / span > < span class = cF2 > /*Find occurrences of a string in files.< / span > < span class = cF0 >
< a name = "l168" > < / a > < / span > < span class = cF2 > This does not do regular expressions.< / span > < span class = cF0 >
< a name = "l169" > < / a > < / span > < span class = cF2 > Anyway, it's good for searching and replacing.< / span > < span class = cF0 >
< a name = "l170" > < / a > < / span > < span class = cF2 > Let's say it stands for global replace ;-)< / span > < span class = cF0 >
< a name = "l171" > < / a >
< a name = "l172" > < / a > < / span > < span class = cF2 > " +r" =recurse< / span > < span class = cF0 >
< a name = "l173" > < / a > < / span > < span class = cF2 > " +i" =ignore case< / span > < span class = cF0 >
< a name = "l174" > < / a > < / span > < span class = cF2 > " +l" =whole labels only.< / span > < span class = cF0 >
< a name = "l175" > < / a > < / span > < span class = cF2 > This will check for a nonlabel character before< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l176" > < / a > < / span > < span class = cF2 > and after.< / span > < span class = cF0 > < / span > < span class = cF2 > If you have a var, " dd" and don't< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l177" > < / a > < / span > < span class = cF2 > want to match words like " Add" , you< / span > < span class = cF0 >
< a name = "l178" > < / a > < / span > < span class = cF2 > set this flag and it will see that the characters< / span > < span class = cF0 >
< a name = "l179" > < / a > < / span > < span class = cF2 > before or after " dd" are label characters.< / span > < span class = cF0 >
< a name = "l180" > < / a > < / span > < span class = cF2 > " +lb" =only checks for label chars before.< / span > < span class = cF0 >
< a name = "l181" > < / a > < / span > < span class = cF2 > " +la" =only checks for label chars after.< / span > < span class = cF0 >
< a name = "l182" > < / a > < / span > < span class = cF2 > */< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l183" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > count = < / span > < span class = cFE > 0< / span > < span class = cF0 > , fuf_flags = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l184" > < / a > < / span > < span class = cF9 > CDirEntry< / span > < span class = cF0 > *tmpde, *tmpde1;
2021-07-03 05:07:57 +01:00
< a name = "l185" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l186" > < / a > < / span > < span class = cF5 > FlagsScan< / span > < span class = cF0 > (& fuf_flags, < / span > < span class = cF5 > Define< / span > < span class = cF7 > (< / span > < span class = cF6 > " ST_FILE_UTIL_FLAGS" < / span > < span class = cF7 > )< / span > < span class = cF0 > , < / span > < span class = cF6 > " +r+i+f+F+T" < / span > < span class = cF0 > );
< a name = "l187" > < / a > < / span > < span class = cF5 > FlagsScan< / span > < span class = cF0 > (& fuf_flags, < / span > < span class = cF5 > Define< / span > < span class = cF7 > (< / span > < span class = cF6 > " ST_FILE_UTIL_FLAGS" < / span > < span class = cF7 > )< / span > < span class = cF0 > , fu_flags);
< a name = "l188" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (fuf_flags & ~< / span > < span class = cF7 > (< / span > < span class = cF3 > FUG_FILES_FIND< / span > < span class = cF0 > | < / span > < span class = cF3 > FUF_IGNORE< / span > < span class = cF0 > | < / span > < span class = cF3 > FUF_ALL< / span > < span class = cF0 > |
< a name = "l189" > < / a > < / span > < span class = cF3 > FUF_WHOLE_LABELS< / span > < span class = cF0 > | < / span > < span class = cF3 > FUF_WHOLE_LABELS_BEFORE< / span > < span class = cF0 > | < / span > < span class = cF3 > FUF_WHOLE_LABELS_AFTER< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l190" > < / a > < / span > < span class = cF5 > throw< / span > < span class = cF0 > (< / span > < span class = cF6 > 'FUF'< / span > < span class = cF0 > );
< a name = "l191" > < / a > < / span > < span class = cF5 > LBEqual< / span > < span class = cF0 > (& fuf_flags, < / span > < span class = cF3 > FUf_REPLACE< / span > < span class = cF0 > , replace_text);
< a name = "l192" > < / a > tmpde = tmpde1 = < / span > < span class = cF5 > FilesFind< / span > < span class = cF0 > (files_find_mask, fuf_flags & < / span > < span class = cF3 > FUG_FILES_FIND< / span > < span class = cF0 > );
< a name = "l193" > < / a > fuf_flags & = < / span > < span class = cF3 > FUF_ALL< / span > < span class = cF0 > | < / span > < span class = cF3 > FUF_REPLACE< / span > < span class = cF0 > | < / span > < span class = cF3 > FUF_IGNORE< / span > < span class = cF0 > | < / span > < span class = cF3 > FUF_WHOLE_LABELS< / span > < span class = cF0 > | < / span > < span class = cF3 > FUF_WHOLE_LABELS_BEFORE< / span > < span class = cF0 > | < / span > < span class = cF3 > FUF_WHOLE_LABELS_AFTER< / span > < span class = cF0 > ;
< a name = "l194" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (tmpde & & !< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > & fuf_flags, < / span > < span class = cF3 > FUf_CANCEL< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l195" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l196" > < / a > count += < / span > < span class = cF5 > FindFile< / span > < span class = cF0 > (needle_str, tmpde-> full_name, & fuf_flags, replace_text);
< a name = "l197" > < / a > tmpde = tmpde-> next;
< a name = "l198" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l199" > < / a > < / span > < span class = cF5 > DirTreeDel< / span > < span class = cF0 > (tmpde1);
2021-07-03 05:07:57 +01:00
< a name = "l200" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l201" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > count;
2021-07-03 05:07:57 +01:00
< a name = "l202" > < / a > }
< a name = "l203" > < / a >
< a name = "l204" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > FileOcc< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *needle_str, < / span > < span class = cF1 > U8< / span > < span class = cF0 > *files_find_mask=< / span > < span class = cF6 > " *" < / span > < span class = cF0 > , < / span > < span class = cF1 > U8< / span > < span class = cF0 > *fu_flags=< / span > < span class = cF6 > " +r+i+l" < / span > < span class = cF0 > )
< a name = "l205" > < / a > {< / span > < span class = cF2 > /*Silently return occurrences of a string in files.< / span > < span class = cF0 >
< a name = "l206" > < / a > < / span > < span class = cF2 > " +r" =recurse< / span > < span class = cF0 >
< a name = "l207" > < / a > < / span > < span class = cF2 > " +i" =ignore case< / span > < span class = cF0 >
< a name = "l208" > < / a > < / span > < span class = cF2 > " +l" =whole labels only.< / span > < span class = cF0 >
< a name = "l209" > < / a > < / span > < span class = cF2 > " +lb" =only checks for label chars before.< / span > < span class = cF0 >
< a name = "l210" > < / a > < / span > < span class = cF2 > " +la" =only checks for label chars after.< / span > < span class = cF0 >
< a name = "l211" > < / a > < / span > < span class = cF2 > */< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l212" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > count = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l213" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > old_silent = < / span > < span class = cF5 > Silent< / span > < span class = cF0 > (< / span > < span class = cF3 > TRUE< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l214" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l215" > < / a > count = < / span > < span class = cF5 > Find< / span > < span class = cF0 > (needle_str, files_find_mask, fu_flags);
< a name = "l216" > < / a > < / span > < span class = cF5 > Silent< / span > < span class = cF0 > (old_silent);
2021-07-03 05:07:57 +01:00
< a name = "l217" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l218" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > count;
2021-07-03 05:07:57 +01:00
< a name = "l219" > < / a > }
< a name = "l220" > < / a >
< a name = "l221" > < / a > < / span > < span class = cF1 > class< / span > < span class = cF0 > < / span > < span class = cF9 > CFind< / span > < span class = cF0 >
< a name = "l222" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l223" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > find_text[< / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > ] format < / span > < span class = cF6 > " $DA-P," < / span > < span class = cF0 >
< a name = "l224" > < / a > < / span > < span class = cF6 > " A=\" FIND :%s\" $\n" < / span > < span class = cF0 > ;
< a name = "l225" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > replace_text[< / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > ] format < / span > < span class = cF6 > " $DA-P," < / span > < span class = cF0 >
< a name = "l226" > < / a > < / span > < span class = cF6 > " A=\" REPLACE :%s\" $\n" < / span > < span class = cF0 > ;
< a name = "l227" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > replace format < / span > < span class = cF6 > " $CB,\" REPLACE\" $\n" < / span > < span class = cF0 > ;
< a name = "l228" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > match_case format < / span > < span class = cF6 > " $CB,\" MATCH CASE\" $\n" < / span > < span class = cF0 > ;
< a name = "l229" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > whole_labels format < / span > < span class = cF6 > " $CB,\" WHOLE LABELS\" $\n" < / span > < span class = cF0 > ;
< a name = "l230" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > filemask[< / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > ] format < / span > < span class = cF6 > " $DA-P,A=\" FILE MASK :%s\" $\n" < / span > < span class = cF0 > ;
< a name = "l231" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > recurse format < / span > < span class = cF6 > " $CB,\" RECURSE\" $\n" < / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l232" > < / a > };
< a name = "l233" > < / a >
< a name = "l234" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > FindWiz< / span > < span class = cF0 > ()
< a name = "l235" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l236" > < / a > < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc;
< a name = "l237" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > buf[< / span > < span class = cFE > 32< / span > < span class = cF0 > ], *dir, *st;
< a name = "l238" > < / a > < / span > < span class = cF9 > CFind< / span > < span class = cF0 > *g = < / span > < span class = cF5 > CAlloc< / span > < span class = cF0 > (< / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CFind< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l239" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > res = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l240" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l241" > < / a > g-> recurse = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l242" > < / a > < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (g-> filemask, < / span > < span class = cF3 > FILEMASK_TXT< / span > < span class = cF0 > );
< a name = "l243" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc = < / span > < span class = cF5 > DocPut< / span > < span class = cF0 > )
< a name = "l244" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l245" > < / a > < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (g-> find_text, doc-> find_replace-> find_text);
< a name = "l246" > < / a > < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (g-> replace_text, doc-> find_replace-> replace_text);
< a name = "l247" > < / a > g-> replace = doc-> find_replace-> replace;
< a name = "l248" > < / a > g-> match_case = doc-> find_replace-> match_case;
< a name = "l249" > < / a > g-> whole_labels = doc-> find_replace-> whole_labels;
< a name = "l250" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l251" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > DocForm< / span > < span class = cF7 > (< / span > < span class = cF0 > g,, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cF6 > " $PURPLE$$TX+CX,\" Find\" $\n$FG$" < / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l252" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l253" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (doc)
< a name = "l254" > < / a > {
< a name = "l255" > < / a > < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (doc-> find_replace-> find_text, g-> find_text);
< a name = "l256" > < / a > < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (doc-> find_replace-> replace_text, g-> replace_text);
< a name = "l257" > < / a > doc-> find_replace-> replace = g-> replace;
< a name = "l258" > < / a > doc-> find_replace-> match_case = g-> match_case;
< a name = "l259" > < / a > doc-> find_replace-> whole_labels = g-> whole_labels;
< a name = "l260" > < / a > }
< a name = "l261" > < / a > dir = < / span > < span class = cF5 > PopUpPickDir< / span > < span class = cF0 > ;
< a name = "l262" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (*dir)
< a name = "l263" > < / a > {
< a name = "l264" > < / a > *buf = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l265" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (g-> match_case)
< a name = "l266" > < / a > < / span > < span class = cF5 > CatPrint< / span > < span class = cF0 > (buf, < / span > < span class = cF6 > " -i" < / span > < span class = cF0 > );
< a name = "l267" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!g-> recurse)
< a name = "l268" > < / a > < / span > < span class = cF5 > CatPrint< / span > < span class = cF0 > (buf, < / span > < span class = cF6 > " -r" < / span > < span class = cF0 > );
< a name = "l269" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (g-> whole_labels)
< a name = "l270" > < / a > < / span > < span class = cF5 > CatPrint< / span > < span class = cF0 > (buf, < / span > < span class = cF6 > " +l" < / span > < span class = cF0 > );
< a name = "l271" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (g-> replace)
< a name = "l272" > < / a > st = < / span > < span class = cF5 > MStrPrint< / span > < span class = cF0 > (< / span > < span class = cF6 > " \" $$WW+H,1$$\" ;Cd(\" %s\" );Find(\" %Q\" ,\" %Q\" ,\" %Q\" ,\" %Q\" );UserTaskCont;" < / span > < span class = cF0 > ,
< a name = "l273" > < / a > dir, g-> find_text, g-> filemask, buf, g-> replace_text);
< a name = "l274" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l275" > < / a > st = < / span > < span class = cF5 > MStrPrint< / span > < span class = cF0 > (< / span > < span class = cF6 > " \" $$WW+H,1$$\" ;Cd(\" %s\" );Find(\" %Q\" ,\" %Q\" ,\" %Q\" );UserTaskCont;" < / span > < span class = cF0 > ,
< a name = "l276" > < / a > dir, g-> find_text, g-> filemask, buf);
< a name = "l277" > < / a > res = < / span > < span class = cF5 > PopUp< / span > < span class = cF0 > (st);
< a name = "l278" > < / a > }
< a name = "l279" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (dir);
< a name = "l280" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l281" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (g);
2021-07-03 05:07:57 +01:00
< a name = "l282" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l283" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l284" > < / a > }
< a name = "l285" > < / a >
< a name = "l286" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > FR< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *text_to_replace, < / span > < span class = cF1 > U8< / span > < span class = cF0 > *new_text, < / span > < span class = cF1 > U8< / span > < span class = cF0 > *files_find_mask=< / span > < span class = cF6 > " /*" < / span > < span class = cF0 > , < / span > < span class = cF1 > U8< / span > < span class = cF0 > *fu_flags=< / span > < span class = cF3 > NONE< / span > < span class = cF0 > , < / span > < span class = cF9 > I64< / span > < span class = cF0 > sff_flags=< / span > < span class = cF3 > NONE< / span > < span class = cF0 > )
< a name = "l287" > < / a > {< / span > < span class = cF2 > //Files rename, Rename files matching mask.< / span > < span class = cF0 >
< a name = "l288" > < / a > < / span > < span class = cF2 > //Example: FR(" Disk" , " Disk" );< / span > < span class = cF0 >
< a name = "l289" > < / a > < / span > < span class = cF2 > //FR(" Gr" , " Graphics" , " /System/Gr/*" );< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l290" > < / a > < / span > < span class = cF9 > CDirEntry< / span > < span class = cF0 > *files, *files_head;
< a name = "l291" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i, count = < / span > < span class = cFE > 0< / span > < span class = cF0 > , fuf_flags = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l292" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *tmp_name, *new_path;
< a name = "l293" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > all_flag = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l294" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l295" > < / a > < / span > < span class = cF5 > FlagsScan< / span > < span class = cF0 > (& fuf_flags, < / span > < span class = cF5 > Define< / span > < span class = cF7 > (< / span > < span class = cF6 > " ST_FILE_UTIL_FLAGS" < / span > < span class = cF7 > )< / span > < span class = cF0 > , < / span > < span class = cF6 > " +r+f+F" < / span > < span class = cF0 > );
< a name = "l296" > < / a > < / span > < span class = cF5 > FlagsScan< / span > < span class = cF0 > (& fuf_flags, < / span > < span class = cF5 > Define< / span > < span class = cF7 > (< / span > < span class = cF6 > " ST_FILE_UTIL_FLAGS" < / span > < span class = cF7 > )< / span > < span class = cF0 > , fu_flags);
2021-07-03 05:07:57 +01:00
< a name = "l297" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l298" > < / a > files = files_head = < / span > < span class = cF5 > FilesFind< / span > < span class = cF0 > (files_find_mask, fuf_flags);
2021-07-03 05:07:57 +01:00
< a name = "l299" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l300" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (files)
< a name = "l301" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l302" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > StrFind< / span > < span class = cF7 > (< / span > < span class = cF0 > text_to_replace, files-> name, sff_flags< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l303" > < / a > {
< a name = "l304" > < / a > < / span > < span class = cF5 > PutFileLink< / span > < span class = cF0 > (files-> full_name);
< a name = "l305" > < / a > < / span > < span class = cF6 > ' -> '< / span > < span class = cF0 > ;
< a name = "l306" > < / a > tmp_name = < / span > < span class = cF5 > StrReplace< / span > < span class = cF0 > (files-> name, text_to_replace, new_text, sff_flags);
< a name = "l307" > < / a > new_path = < / span > < span class = cF5 > MStrPrint< / span > < span class = cF0 > (< / span > < span class = cF6 > " %s/%s" < / span > < span class = cF0 > , < / span > < span class = cF5 > DirFile< / span > < span class = cF7 > (< / span > < span class = cF0 > files-> full_name< / span > < span class = cF7 > )< / span > < span class = cF0 > , tmp_name);
< a name = "l308" > < / a > < / span > < span class = cF5 > PutFileLink< / span > < span class = cF0 > (new_path);
2021-07-03 05:07:57 +01:00
< a name = "l309" > < / a >
< a name = "l310" > < / a > fr_all:
2021-07-04 23:11:34 +01:00
< a name = "l311" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (all_flag)
< a name = "l312" > < / a > i = < / span > < span class = cF3 > FND_REPLACE< / span > < span class = cF0 > ;
< a name = "l313" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l314" > < / a > i = < / span > < span class = cF5 > PopUpFindMenu< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l315" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l316" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (i)
< a name = "l317" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l318" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > FND_ALL< / span > < span class = cF0 > :
< a name = "l319" > < / a > all_flag = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l320" > < / a > < / span > < span class = cF1 > goto< / span > < span class = cF0 > fr_all;
2021-07-03 05:07:57 +01:00
< a name = "l321" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l322" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > FND_REPLACE< / span > < span class = cF0 > :
< a name = "l323" > < / a > < / span > < span class = cF6 > " $LTGREEN$*$FG$\n" < / span > < span class = cF0 > ;
< a name = "l324" > < / a > < / span > < span class = cF5 > Move< / span > < span class = cF0 > (files-> full_name, new_path);
< a name = "l325" > < / a > count++;
< a name = "l326" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l327" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > FND_SKIP< / span > < span class = cF0 > :
< a name = "l328" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > FND_SKIP_FILE< / span > < span class = cF0 > :
< a name = "l329" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > FND_ABORT_FILE< / span > < span class = cF0 > :
< a name = "l330" > < / a > < / span > < span class = cF6 > '\n'< / span > < span class = cF0 > ;
< a name = "l331" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l332" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > DOCM_CANCEL< / span > < span class = cF0 > :
< a name = "l333" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (tmp_name);
< a name = "l334" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (new_path);
< a name = "l335" > < / a > < / span > < span class = cF5 > DirTreeDel< / span > < span class = cF0 > (files_head);
< a name = "l336" > < / a > < / span > < span class = cF6 > '\n'< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l337" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l338" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > count;
< a name = "l339" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l340" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (tmp_name);
< a name = "l341" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (new_path);
< a name = "l342" > < / a > < / span > < span class = cF6 > '\n'< / span > < span class = cF0 > ;
< a name = "l343" > < / a > }
< a name = "l344" > < / a > files = files-> next;
< a name = "l345" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l346" > < / a > < / span > < span class = cF5 > DirTreeDel< / span > < span class = cF0 > (files_head);
2021-07-03 05:07:57 +01:00
< a name = "l347" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l348" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > count;
2021-07-03 05:07:57 +01:00
< a name = "l349" > < / a > }
< / span > < / pre > < / body >
< / html >