]> andersk Git - moira.git/blame - update/checksum.c
punted sms_untar
[moira.git] / update / checksum.c
CommitLineData
de56407f 1/*
2 * $Source$
3 * $Header$
4 */
546bc43b 5/* (c) Copyright 1988 by the Massachusetts Institute of Technology. */
6/* For copying and distribution information, please see the file */
7/* <mit-copyright.h>. */
de56407f 8
9#ifndef lint
10static char *rcsid_checksum_c = "$Header$";
11#endif lint
12
546bc43b 13#include <mit-copyright.h>
de56407f 14#include <stdio.h>
15#include <sys/file.h>
16
17/*
18 * checksum_fd(fd)
19 * returns 24-bit checksum of bytes in file
20 */
21
22int
b18a5f6d 23checksum_file(path)
24char *path;
de56407f 25{
de56407f 26 register int sum;
27 register int ch;
28 register FILE *f;
29
de56407f 30 sum = 0;
b18a5f6d 31 f = fopen(path, "r");
de56407f 32 while ((ch = getc(f)) != EOF) {
33 sum = (sum + ch) & ((1<<24)-1);
34 }
35 fclose(f);
36 return(sum);
37}
This page took 0.061908 seconds and 5 git commands to generate.