Closed cospplredman closed 2 months ago
The core logic is a bit cryptic (mostly bit manipulation) so I couldn't tell what happening there Hopefully you can provide some screenshot to show that this is working properly
hello @cospplredman. thanks for your pr. please test this before we merge it. Also, be sure to provide. if you tasted all the edge cases, mention me so I can merge it. ;)
My testing methodology is as follows: run both my implementation and the gnu implementation on every file in the cksum directory.
$ ./cksum *
175369053 16296 cksum
1855786587 7 cksum.1
4088649404 2179 cksum.c
1192622583 51 Makefile
197436690 157 test.sh
$ cksum *
175369053 16296 cksum
1855786587 7 cksum.1
4088649404 2179 cksum.c
1192622583 51 Makefile
197436690 157 test.sh
the results match as far as i can tell.
One notable difference between this implementation and the gnu implementation is that I do not handle directories, I opt to instead just return EXIT_FAILURE. The reason I prefer to fail is that there isn't a standard C way of checking if something is a directory, so any method of doing so would break me from my (very tasteful) c99 compliance, and cksum is only defined on files anyways.
do you handle flags?
also pull the latest changes
cksum is one of the posix utilities of all time.