]> andersk Git - moira.git/blobdiff - update/checksum.c
Add containers table and mcntmp table.
[moira.git] / update / checksum.c
index c2336aafcbfbb258ada9b9e7aec34846de7cc255..4389054688dd9f297012fe2e0f93b88c229b4a42 100644 (file)
@@ -1,36 +1,33 @@
-/*
- *     $Source$
- *     $Header$
+/* $Id$
+ *
+ * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
  */
 
-#ifndef lint
-static char *rcsid_checksum_c = "$Header$";
-#endif lint
+#include <mit-copyright.h>
+#include <moira.h>
+#include "update_server.h"
 
 #include <stdio.h>
-#include <sys/file.h>
+
+RCSID("$Header$");
 
 /*
  * checksum_fd(fd)
  * returns 24-bit checksum of bytes in file
  */
 
-int
-checksum_fd(fd1)
-    int fd1;
+long checksum_file(char *path)
 {
-    int fd;
-    register int sum;
-    register int ch;
-    register FILE *f;
+  long sum;
+  int ch;
+  FILE *f;
 
-    fd = dup(fd1);
-    sum = 0;
-    (void) lseek(fd, 0, L_SET);
-    f = fdopen(fd, "r");
-    while ((ch = getc(f)) != EOF) {
-       sum = (sum + ch) & ((1<<24)-1);
-    }
-    fclose(f);
-    return(sum);
+  sum = 0;
+  f = fopen(path, "r");
+  while ((ch = getc(f)) != EOF)
+    sum = (sum + ch) & ((1 << 24) - 1);
+  fclose(f);
+  return sum;
 }
This page took 0.031475 seconds and 4 git commands to generate.