move to debhelper compat 13, hopefully fixes cross-building
[debian/cpmtools] / cpmfs.h
diff --git a/cpmfs.h b/cpmfs.h
index acf050f9f2a8f3af43134c35cd750a9a402f7800..3d73559528363a0a84dee976a9b570e9d11e1c3b 100644 (file)
--- a/cpmfs.h
+++ b/cpmfs.h
@@ -1,48 +1,8 @@
 #ifndef CPMFS_H
 #define CPMFS_H
 
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#ifdef _WIN32
-    #include <windows.h>
-    #include <winioctl.h>
-    /* To make it compile on NT: extracts from Linux 2.0 *
-     * <statbuf.h> and <sys/stat.h>                      */
-    #define __S_IFMT        0170000 /* These bits determine file type.  */
-    #define __S_IFDIR       0040000 /* Directory.  */
-    #define __S_IFREG       0100000 /* Regular file.  */
-    #define __S_IWUSR       0000200 /* Writable for user.  */
-    #define __S_IWGRP       0000200 /* Writable for group.  */
-    #define __S_IWOTH       0000200 /* Writable for others.  */
-
-    #define __S_ISTYPE(mode, mask)  (((mode) & __S_IFMT) == (mask))
-    #define __S_ISTYPE(mode, mask)  (((mode) & __S_IFMT) == (mask))
-    /* These bits are defined in Borland C++ 5 but not in MS Visual C++ */
-    #ifndef S_ISDIR
-    # define S_ISDIR(mode)   __S_ISTYPE((mode), __S_IFDIR)
-    #endif
-    #ifndef S_ISREG
-    # define S_ISREG(mode)   __S_ISTYPE((mode), __S_IFREG)
-    #endif
-    #ifndef S_IWUSR
-    #define S_IWUSR __S_IWUSR
-    #endif
-    #ifndef S_IWGRP
-    #define S_IWGRP __S_IWGRP
-    #endif
-    #ifndef S_IWOTH
-    #define S_IWOTH __S_IWOTH
-    #endif
-
-    #include <io.h>            /* For open(), lseek() etc. */
-    #ifndef HAVE_MODE_T
-    typedef int mode_t;
-    #endif
-#endif
-
 #ifdef __cplusplus
-        extern "C" {
+extern "C" {
 #endif
 
 #include "device.h"
@@ -99,28 +59,63 @@ struct cpmStat
   time_t ctime;
 };
 
-#define CPMFS_DR22  0
-#define CPMFS_P2DOS 1
-#define CPMFS_DR3   2
+/* Note: CPMFS_HI_USER should be split for systems with user numbers
+ * up to 31 and CP/M 3, which uses them, but for password entries and
+ * not for files.
+ */
+#define CPMFS_HI_USER    (0x1<<0) /* has user numbers up to 31    */
+#define CPMFS_CPM3_DATES (0x1<<1) /* has CP/M+ style time stamps  */
+#define CPMFS_CPM3_OTHER (0x1<<2) /* has passwords and disc label */
+#define CPMFS_DS_DATES   (0x1<<3) /* has datestamper timestamps   */
+#define CPMFS_EXACT_SIZE (0x1<<4) /* has reverse exact file size  */
+
+#define CPMFS_DR22  (CPMFS_HI_USER)
+#define CPMFS_P2DOS (CPMFS_CPM3_DATES|CPMFS_HI_USER)
+#define CPMFS_DR3   (CPMFS_CPM3_DATES|CPMFS_CPM3_OTHER|CPMFS_HI_USER)
+#define CPMFS_ISX   (CPMFS_EXACT_SIZE)
+#define CPMFS_ZSYS  (CPMFS_HI_USER)
+
+struct dsEntry
+{
+  char year;
+  char month;
+  char day;
+  char hour;
+  char minute;
+};
+          
+struct dsDate
+{
+  struct dsEntry create;
+  struct dsEntry access;
+  struct dsEntry modify;
+  char checksum;
+};
 
 struct cpmSuperBlock
 {
   struct Device dev;
+  int uppercase;
 
   int secLength;
   int tracks;
   int sectrk;
   int blksiz;
   int maxdir;
+  int dirblks;
   int skew;
+  int bootsec;
   int boottrk;
+  off_t offset;
   int type;
   int size;
   int extents; /* logical extents per physical extent */
+  int *skewtab;
+  char libdskGeometry[256];
+
   struct PhysDirectoryEntry *dir;
   int alvSize;
   int *alv;
-  int *skewtab;
   int cnotatime;
   char *label;
   size_t labelLength;
@@ -128,6 +123,8 @@ struct cpmSuperBlock
   size_t passwdLength;
   struct cpmInode *root;
   int dirtyDirectory;
+  struct dsDate *ds;
+  int dirtyDs;
 };
 
 struct cpmStatFS
@@ -142,13 +139,14 @@ struct cpmStatFS
   long f_namelen;
 };
 
-extern const char cmd[];
-extern const char *boo;
+extern char const cmd[];
+extern char const *boo;
 
-int match(const char *a, const char *pattern);
+int match(char const *a, char const *pattern);
 void cpmglob(int opti, int argc, char * const argv[], struct cpmInode *root, int *gargc, char ***gargv);
+void cpmglobfree(char **dirent, int entries);
 
-int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format);
+int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format, int uppercase);
 int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *i);
 void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf);
 int cpmUnlink(const struct cpmInode *dir, const char *fname);
@@ -160,15 +158,17 @@ int cpmAttrGet(struct cpmInode *ino, cpm_attr_t *attrib);
 int cpmAttrSet(struct cpmInode *ino, cpm_attr_t attrib);
 int cpmChmod(struct cpmInode *ino, mode_t mode);
 int cpmOpen(struct cpmInode *ino, struct cpmFile *file, mode_t mode);
-int cpmRead(struct cpmFile *file, char *buf, int count);
-int cpmWrite(struct cpmFile *file, const char *buf, int count);
+ssize_t cpmRead(struct cpmFile *file, char *buf, size_t count);
+ssize_t cpmWrite(struct cpmFile *file, const char *buf, size_t count);
 int cpmClose(struct cpmFile *file);
 int cpmCreat(struct cpmInode *dir, const char *fname, struct cpmInode *ino, mode_t mode);
+void cpmUtime(struct cpmInode *ino, struct utimbuf *times);
 int cpmSync(struct cpmSuperBlock *sb);
-void cpmUmount(struct cpmSuperBlock *sb);
+int cpmUmount(struct cpmSuperBlock *sb);
+int cpmCheckDs(struct cpmSuperBlock *sb);
 
 #ifdef __cplusplus
-       }
+}
 #endif
 
 #endif