<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Util2.HC</title>
		<link rel="stylesheet" href="/style/templeos.css">
		<script src="/script/templeos.js" defer></script>
	</head>
	<body class="BG-15 FG-0 ">
		I64 MyUtilDoc(CDoc *doc,I64 fuf_flags)<br>
{<br>
  Bool unlock=DocLock(doc);<br>
  I64 res=0;<br>
  CDocEntry *doc_e;<br>
  DocRecalc(doc);<br>
  doc_e=doc-&gt;head.next;<br>
  while (doc_e!=doc) {<br>
    res++;<br>
    doc_e=doc_e-&gt;next;<br>
  }<br>
  DocRecalc(doc);<br>
  if (unlock)<br>
    DocUnlock(doc);<br>
  return res;<br>
}<br>
<br>
I64 MyUtilFile(U8 *filename,I64 fuf_flags)<br>
{<br>
  I64 res;<br>
  CDoc *doc=DocRead(filename);<br>
  if (res=MyUtilDoc(doc,fuf_flags)) {<br>
    "%8d:%s\n",res,doc-&gt;filename.name;<br>
    DocWrite(doc);<br>
  }<br>
  DocDel(doc);<br>
  return res;<br>
}<br>
I64 MyUtilLst(CDirEntry *tmpde,I64 fuf_flags)<br>
{<br>
  I64 res=0;<br>
  CDirEntry *tmpde1;<br>
  while (tmpde) {<br>
    tmpde1=tmpde-&gt;next;<br>
    if (tmpde-&gt;attr &amp; RS_ATTR_DIR) {<br>
      if (tmpde-&gt;sub) {<br>
	"Processing Directory: %s\n",tmpde-&gt;full_name;<br>
	res+=MyUtilLst(tmpde-&gt;sub,fuf_flags);<br>
      }<br>
    } else<br>
      res+=MyUtilFile(tmpde-&gt;full_name,fuf_flags);<br>
    DirEntryDel(tmpde);<br>
    tmpde=tmpde1;<br>
  }<br>
  return res;<br>
}<br>
I64 MyUtil(U8 *files_find_mask="*",U8 *fu_flags=NULL)<br>
{<br>
  I64 fuf_flags=0;<br>
  ScanFlags(&amp;fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+&#36;");<br>
  ScanFlags(&amp;fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);<br>
  return MyUtilLst(FilesFind(files_find_mask,fuf_flags&amp;FUG_FILES_FIND),<br>
	fuf_flags&amp;~FUG_FILES_FIND);<br>
}<br>

	</body>
</html>