]> andersk Git - moira.git/blob - update/checksum.c
Command line printer manipulation client, and build goo.
[moira.git] / update / checksum.c
1 /* $Id$
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$");
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 }
This page took 0.049358 seconds and 5 git commands to generate.