Changed names of commit files.
[idzebra-moved-to-github.git] / bfile / cfile.c
index 284de86..57be833 100644 (file)
@@ -4,7 +4,14 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: cfile.c,v $
- * Revision 1.5  1995-12-08 16:21:14  adam
+ * Revision 1.7  1995-12-15 10:35:07  adam
+ * Changed names of commit files.
+ *
+ * Revision 1.6  1995/12/11  09:03:53  adam
+ * New function: cf_unlink.
+ * New member of commit file head: state (0) deleted, (1) hash file.
+ *
+ * Revision 1.5  1995/12/08  16:21:14  adam
  * Work on commit/update.
  *
  * Revision 1.4  1995/12/01  16:24:28  adam
@@ -73,22 +80,24 @@ CFile cf_open (MFile mf, MFile_area area, const char *fname,
     int hash_bytes;
    
     cf->rmf = mf; 
-    sprintf (path, "%s.b", fname);
+    sprintf (path, "%s-b", fname);
     if (!(cf->block_mf = mf_open (area, path, block_size, wflag)))
     {
         logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path);
         exit (1);
     }
-    sprintf (path, "%s.h", fname);
+    sprintf (path, "%s-i", fname);
     if (!(cf->hash_mf = mf_open (area, path, HASH_BSIZE, wflag)))
     {
         logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path);
         exit (1);
     }
-    if (!firstp || !mf_read (cf->hash_mf, 0, 0, sizeof(cf->head), &cf->head))
+    assert (firstp);
+    if (!mf_read (cf->hash_mf, 0, 0, sizeof(cf->head), &cf->head) ||
+        !cf->head.state)
     {
-        if (firstp)
-            *firstp = 1;
+        *firstp = 1;
+        cf->head.state = 1;
         cf->head.block_size = block_size;
         cf->head.hash_size = 401;
         hash_bytes = cf->head.hash_size * sizeof(int);