- C 77.2%
- Makefile 12.6%
- Roff 10.2%
| .editorconfig | Add editorconfig | |
| .gitignore | Support MZ and PE binaries | |
| common.c | Add -a and -v options | |
| common.h | Add -a and -v options | |
| genhosth.c | Simplify bininfo structure | |
| ice.1 | Add -a and -v options | |
| ice.c | Add -a and -v options | |
| LICENSE.md | Add license | |
| Makefile | Remove host.h on clean | |
| README.md | Add -a and -v options | |
| testbin.c | Support cross-compilation | |
ICE
Make Unix great again by locating and deleting foreign files
ice [-avf] path
Searches recursively in the given directory to list paths of programs and object files that have an architecture or target OS other than the current. Symlinks are not followed.
Options:
- -a: list all identified executables, not just foreign ones.
- -v: output the executable type next to the filenames.
- -f: delete all matched files (best not to use with -a!).
Checks are performed by comparing ELF files' EI_OSABI and E_MACHINE fields
against those of a test binary generated at build-time.
Exits 0 on success, 1 on general errors, 2 if any non-critical error occurs (other than invalid ELF files), or 64 on usage error.
Caveats
Currently only works on Unix-likes, and only with ELF files.
Barely vetted, so ice may be overeager in reporting (and deleting) files that are essential to the functioning of the system.
Building
Requires a C compiler and make:
make
sudo make install
Cross-compiling should work too:
make HOSTCC=gcc CC=aarch64-linux-gnu-gcc
make HOSTCC=gcc CC=i686-w64-mingw32-gcc SUFX=32.exe
There are also some cross compile targets built in:
make cross
# or:
make cross-w32
make cross-w64
Future work
- -x option to not cross filesystem boundaries.
- Windows and DOS support.
- More categories, such as non-native binary formats, line endings or text encoding.
- Faster searching with e.g. kqueue, io_uring, BPF.
Author
By Sijmen J. Mulder (ik@sjmulder.nl). See LICENSE.md