In 2002, libtrash was created by Manuel Arriaga, In the days before
graphical file managers with their own trash collection, libtrash was a
great little library that intercepted unlink(), open(), and rename()
functions and moved deleted files to a user trash can.
It accomplished this by being preloaded: LD_PRELOAD=/libpath/libtrash.so.
But it also had a separate environment variable which could suspend
trash collection, TRASH_OFF=NO|YES.
TRASH_OFF=YES rm badfile
would turn the trash off and really delete badfile.
Since the user trash can was often in the user's home directory, I added
functionality to specify a file size limit in what could be deleted.
This prevented very large files from filling up the user trash can.
Users can also specify file types to ignore, like C Object files, or
compressed files with certain extensions. libtrash can also be
configured to ignore whole directories, like /tmp or /var, and protect
system files.
In 2021, I migrated the awkward build system to autotools and it's been
there since.
The ROX desktop had a wrapper for libtrash, but I have found, that when
preloaded, ROX passes all removed files to the user trash can.
The last bit of code added improved the man pages, and also cleared out
"ugly" macros and #define statements (Manuel's words, not mine!).
I can't quite remember when I started using libtrash, but I'll guess it
was in the mid 2000 decade. Manuel has "retired" from maintaining the
program, and it is my responsibility now.
It's a great little library and I look forward to having support to test
and if appropriate, cross compiling for other platforms.
/PH
--
Peter Hyman