/* tsum.c */ /* * Written by Gavan Fantom gavan A T netbsd D O T * * Takes a kernel on standard in and produces the required checksum * on standard out. This should be appeneded to the kernel which is * provided to the T1500 via dhcp * * This notice was added by James Mulcahy, May 02005. ***/ #include void putword(unsigned int w) { putchar(w & 0xff); putchar((w >> 8) & 0xff); putchar((w >> 16) & 0xff); putchar((w >> 24) & 0xff); } int main(void) { unsigned int s = 0; unsigned int p = 0; unsigned int n = 0; int c; while ((c = getchar()) != EOF) { s += c; p ^= c<= 32) n = 0; } fprintf(stderr,"s = %x, p = %x\n", s, p); putword(p); putword(s); return 0; }