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 #39

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/cksum/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
OUT := cksum

SRC := cksum.c

include ../shared.mk
Binary file added src/cksum/cksum
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 and then ensure the binary is not pushed by adding it to the .gitignore list

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Binary file not shown.
1 change: 1 addition & 0 deletions src/cksum/cksum.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\" TODO
26 changes: 26 additions & 0 deletions src/cksum/cksum.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include<stdint.h>
#include<stdio.h>

#define NAME "cksum (canoutils)"
#define VERSION "0.0.1"
#define AUTHOR "cospplredman"

#include"../version_info.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#include"../version_info.h"
#include "/version_info.h"


#define X(a,...) for(a)for(r=(r<<8)^(e&0xff)^__VA_ARGS__,e=0,i=31;i>23;i--)if(r&(1<<i))r^=(1<<i)|(q>>(32-i)),e^=q<<(i-24);

uint32_t q=0x04c11db7,r,e;d,i=1,t,j,k,f=2;main(c,v)char**v;{
if(c<2)exit(1);
for(;++k<c;){
if(f&&(!strcmp(v[k], "--")|!strcmp(v[k], "-v"))){
if(v[k][1]=='-')f=0;
if(f==2){f=1;print_version();}
continue;
}
FILE*f=fopen(v[k],"r");
if(f==NULL)exit(1);
X(;(d=getc(f))>=0;t++,d)X(j=t;j;,(j&0xff),j>>=8)X(j=3;j--;,0)
if(printf("%u %d %s\n",~((r<<8)|(e&0xff)),t,v[k])<0)exit(1);
r=e=t=0;
}
}
Comment on lines +10 to +26
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 refactor your code to make it readable? The goal isn't to code golf the coreutils

Loading