summaryrefslogtreecommitdiff
path: root/userspace/checker.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-11-23 19:28:40 +0100
committerMichal Idziorek <m.i@gmx.at>2014-11-23 19:28:40 +0100
commit9a13aedd4ef04711fc5139c86025272e9648cc4c (patch)
tree49cf0f4e6923df17f023abd5dbb50bd8fa53e8e5 /userspace/checker.c
parent6b8c02a9cf4ac36e42d07c668a2be27d2bf1a733 (diff)
double indirect block support to ELF and check sum calc
Diffstat (limited to 'userspace/checker.c')
-rw-r--r--userspace/checker.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/userspace/checker.c b/userspace/checker.c
new file mode 100644
index 0000000..e5352f6
--- /dev/null
+++ b/userspace/checker.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+int main()
+
+{
+FILE *fp; /* The file handle for input data */
+fp=stdin;
+int ch; /* Each character read. */
+int checksum = 0; /* The checksum mod 2^16. */
+int count=0;
+
+while ((ch = getc(fp)) != EOF) {
+ checksum = (checksum >> 1) + ((checksum & 1) << 15);
+ checksum +=(int) ch;
+ checksum &= 0xffff; /* Keep it within bounds. */
+ count++;
+}
+printf("checksum : 0x%08X for %i bytes\n",checksum,count);
+}