Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented cksum #40

Merged
merged 20 commits into from
Apr 24, 2024
Merged

Implemented cksum #40

merged 20 commits into from
Apr 24, 2024

Conversation

cospplredman
Copy link
Contributor

cksum is one of the posix utilities of all time.

src/cksum/cksum Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the binary file and add it to gitignore list.
Make sure to add your the folder name in BINS variable of the global Makefile

@@ -0,0 +1,101 @@
#include<stdint.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you run clang-format? This enforce coding style consistency across all sources

src/cksum/cksum.c Outdated Show resolved Hide resolved
@Sigmanificient
Copy link
Collaborator

Sigmanificient commented Apr 21, 2024

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

cospplredman and others added 2 commits April 21, 2024 18:21
@proh14
Copy link
Owner

proh14 commented Apr 22, 2024

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. ;)

@cospplredman
Copy link
Contributor Author

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.

@proh14
Copy link
Owner

proh14 commented Apr 22, 2024

do you handle flags?

src/cksum/cksum.c Outdated Show resolved Hide resolved
src/cksum/cksum.c Outdated Show resolved Hide resolved
src/cksum/cksum.c Outdated Show resolved Hide resolved
src/cksum/cksum.c Show resolved Hide resolved
@proh14
Copy link
Owner

proh14 commented Apr 22, 2024

also pull the latest changes

Copy link
Owner

@proh14 proh14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx ;)

@proh14 proh14 merged commit 7560635 into proh14:main Apr 24, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants