You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Avril
ae9efca41b
|
4 years ago | |
---|---|---|
include | 4 years ago | |
src | 4 years ago | |
.gitignore | 4 years ago | |
LICENSE | 4 years ago | |
Makefile | 4 years ago | |
README.md | 4 years ago |
README.md
fcmp - compare file identity
A small shell util that compares files for identity with mmap()
and memcmp()
.
Usage
fcmp
produces no output, but success is indicated by its return code.
$ fcmp file1 file2 && echo "Equal!"
You can pass any number of files, but at least 2 must be provided.
Code | Meaning |
---|---|
0 | The files are equal |
1 | The files are unequal |
2 | The files have unequal lengths, and therefor must be unequal |
-1 | There was an error |
You can use this in shell scripts easily:
# Example
if fcmp "$1" "$2"; then
echo "Files are equal!"
else
echo "Files are not equal!"
fi
Building
To build normally, run make
.
Release target
Build with default optimisations using make release
, it will output a stripped binary at fcmp-release
.
Notes
- The Makefile uses variables
RELEASE_CFLAGS
andRELEASE_LDFLAGS
to apply optimisations (andDEBUG_CFLAGS
+DEBUG_LDFLAGS
for extra compiler flags with the debug target). If needed you can set these yourself to prevent the defaults. - The default
RELEASE_CFLAGS
specify-march=native
which may be undesireable for you. Set the variable or modify the Makefile if you need to remove this.
Debug target
Build with debugging information and no optimisations using make debug
, it will output a binary at fcmp-debug
.
Note
Before switching between release
and debug
targets, make sure to run make clean
.
License
GPL'd with <3