<feed xmlns='http://www.w3.org/2005/Atom'>
<title>xavi/slcl/cftw.c, branch master</title>
<subtitle>Small and lightweight cloud storage written in C99 and POSIX.1-2008.
</subtitle>
<id>https://gitea.privatedns.org/xavi/slcl/atom?h=master</id>
<link rel='self' href='https://gitea.privatedns.org/xavi/slcl/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/'/>
<updated>2025-10-06T14:28:59+00:00</updated>
<entry>
<title>cftw.c: Call user function at the end for directories</title>
<updated>2025-10-06T14:28:59+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi92@disroot.org</email>
</author>
<published>2025-10-06T14:19:16+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=3e939dde0ad07d1ecbb9bed2123fff6d2d92dcab'/>
<id>urn:sha1:3e939dde0ad07d1ecbb9bed2123fff6d2d92dcab</id>
<content type='text'>
The older, synchronous implementation for cftw recursed as long as there
were children directories and, finally, it called the user function.
This commit therefore fixes the newer, asynchronous implementation to
honor that behaviour. Otherwise, rmdir_r would fail because rmdir(2)
would be called for non-empty directories.
</content>
</entry>
<entry>
<title>cftw.c: Fix memory leak</title>
<updated>2025-09-24T14:35:57+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi92@disroot.org</email>
</author>
<published>2025-09-24T14:35:45+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=2a7709d8a26d2dd193bef938a9abe266739ef03e'/>
<id>urn:sha1:2a7709d8a26d2dd193bef938a9abe266739ef03e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Make search non-blocking</title>
<updated>2025-09-24T10:39:09+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi92@disroot.org</email>
</author>
<published>2025-09-24T09:01:31+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=173528aef50a4b452acdd8ec9aff13f25c3e092c'/>
<id>urn:sha1:173528aef50a4b452acdd8ec9aff13f25c3e092c</id>
<content type='text'>
Thanks to a new feature in libweb, it is now possible to generate HTTP
responses asynchronously i.e., without blocking other clients if the
response takes a long time to generate.

This now allow users to search for files or directories without blocking
other users, regardless how much time the search operation takes.

This required cftw to deviate from the POSIX-like, blocking interface it
had so far, and has been replaced now with a non-blocking interface, so
that directories are inspected one entry at a time.
</content>
</entry>
<entry>
<title>cftw: Allow user callback to stop recursive search</title>
<updated>2023-07-11T11:27:49+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-07-11T11:08:06+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=59e17afe291f9df52d2334b92e88a889c2fe8f6a'/>
<id>urn:sha1:59e17afe291f9df52d2334b92e88a889c2fe8f6a</id>
<content type='text'>
So far, cftw would search through all directories and files recursively,
until all objects are processed. However, it is interesting for the user
callback to be able to stop this process under specific circumstances.

Now, cftw will pass a pointer to a bool, initialised to false by
default, that can be optionally assigned to true by the user
callback.

Future commits will make use of this feature. For example, this will be
used to limit the number of search results when a user enters a search
term that is too generic and would otherwise generate a large amount of
search results.
</content>
</entry>
<entry>
<title>cftw: Allow directories to call the user callback</title>
<updated>2023-07-08T00:30:31+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-07-08T00:30:31+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=74ca76a58fca114140d0d0cc13a1216d6dffbee0'/>
<id>urn:sha1:74ca76a58fca114140d0d0cc13a1216d6dffbee0</id>
<content type='text'>
This provides a few benefits:

- This will allow searching for directories by name.
- Future commits will allow to remove files and directories, so this
  change was also required for cftw.
</content>
</entry>
<entry>
<title>cftw.c: Check errors from readdir(3)</title>
<updated>2023-07-05T23:56:43+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-07-05T23:56:43+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=74b7f7a902d9916dddb07d6adb26c63e765a6349'/>
<id>urn:sha1:74b7f7a902d9916dddb07d6adb26c63e765a6349</id>
<content type='text'>
According to POSIX.1-2017, applications are advised to assign errno(3)
to 0 before a call to readdir(3), and compare errno(3) after the call to
check for errors.
</content>
</entry>
<entry>
<title>ctfw.c: Avoid trailing forward slash</title>
<updated>2023-06-06T01:48:51+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-06-06T01:36:45+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=6e9ce3a25b438a94ad870ba85dd8c9bf8a28e043'/>
<id>urn:sha1:6e9ce3a25b438a94ad870ba85dd8c9bf8a28e043</id>
<content type='text'>
Otherwise, this would generate strings such as "directory//resource" if
dirpath contained a trailing slash, which could be problematic for users
relying on ctfw.
</content>
</entry>
<entry>
<title>cftw.c: Add missing portability definition</title>
<updated>2023-05-28T10:07:38+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-05-28T09:42:28+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=95a0adfe7804e774b9e60bc528e32ff002127cb9'/>
<id>urn:sha1:95a0adfe7804e774b9e60bc528e32ff002127cb9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>cftw.c: Add missing call to closedir(2)</title>
<updated>2023-03-07T11:36:27+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-07T11:36:27+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=f33e1c90535c9abae0d7c3e29cdb29ba94fb96cd'/>
<id>urn:sha1:f33e1c90535c9abae0d7c3e29cdb29ba94fb96cd</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add cftw</title>
<updated>2023-03-06T04:06:30+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-03-06T04:04:26+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=804b8841f3fe59f7058c91fa25c1694f4433642a'/>
<id>urn:sha1:804b8841f3fe59f7058c91fa25c1694f4433642a</id>
<content type='text'>
POSIX functions ftw(3) and nftw(3) do not allow passing an opaque
pointer to the callback they call, so it forces the use of statically
allocated data.

ctfw (from "custom ftw") is a custom implementation that solves this,
while also removing unneeded stuff.

This function will be used by future commits.
</content>
</entry>
</feed>
