Revision 23740,
728 bytes
checked in by broder, 16 years ago
(diff) |
In moira:
* New CVS snapshot (Trac: #195)
* Drop patches that have been incorporated upstream.
* Update to build without krb4 on systems that no longer have it.
This doesn't build yet on squeeze, which lacks a krb4 library, but I'm
committing now before I start hacking away at a patch to fix that.
|
Line | |
---|
1 | /* $Id: checksum.c,v 1.9 1998-02-15 17:49:26 danw Exp $ |
---|
2 | * |
---|
3 | * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology. |
---|
4 | * For copying and distribution information, please see the file |
---|
5 | * <mit-copyright.h>. |
---|
6 | */ |
---|
7 | |
---|
8 | #include <mit-copyright.h> |
---|
9 | #include <moira.h> |
---|
10 | #include "update_server.h" |
---|
11 | |
---|
12 | #include <stdio.h> |
---|
13 | |
---|
14 | RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/checksum.c,v 1.9 1998-02-15 17:49:26 danw Exp $"); |
---|
15 | |
---|
16 | /* |
---|
17 | * checksum_fd(fd) |
---|
18 | * returns 24-bit checksum of bytes in file |
---|
19 | */ |
---|
20 | |
---|
21 | long checksum_file(char *path) |
---|
22 | { |
---|
23 | long sum; |
---|
24 | int ch; |
---|
25 | FILE *f; |
---|
26 | |
---|
27 | sum = 0; |
---|
28 | f = fopen(path, "r"); |
---|
29 | while ((ch = getc(f)) != EOF) |
---|
30 | sum = (sum + ch) & ((1 << 24) - 1); |
---|
31 | fclose(f); |
---|
32 | return sum; |
---|
33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.