]> andersk Git - moira.git/blame_incremental - update/checksum.c
added author field
[moira.git] / update / checksum.c
... / ...
CommitLineData
1/*
2 * $Source$
3 * $Header$
4 */
5/* (c) Copyright 1988 by the Massachusetts Institute of Technology. */
6/* For copying and distribution information, please see the file */
7/* <mit-copyright.h>. */
8
9#ifndef lint
10static char *rcsid_checksum_c = "$Header$";
11#endif lint
12
13#include <mit-copyright.h>
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
23checksum_file(path)
24char *path;
25{
26 register int sum;
27 register int ch;
28 register FILE *f;
29
30 sum = 0;
31 f = fopen(path, "r");
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.553441 seconds and 5 git commands to generate.