/*------------------------------------*
 | File: DT.h - Include file for DT.c |
 *------------------------------------*/

/**
 | Parameters (#define):
 | - length of various buffers (all-purpose, and track/file check)
 | - maximum length of file paths
 | - arguments for Motor()
 | - break flag bits
 | - "break window" parameters
 | - AppWindow ID
**/

#define SLATE_DIM     128
#define FILBUF_DIM    (512 * 11)

#define PATHNAME_MAX  256

#define ON            1
#define OFF           0

#define BRK_DETECTED  0x1
#define WARN_PRINTED  0x10
#define INTERNAL_ERR  (BRK_DETECTED | WARN_PRINTED)

#define BKW_IDCMP     BUTTONIDCMP

#define AW_ID   17

/**
 | A structure to store directory entries, when checking
 | the integrity of a whole directory tree.
**/

typedef struct sdirEntry {
  struct sdirEntry *next;
  char name[1];
} dirEntry;

/**
 | Local global variables
**/

static char slate[SLATE_DIM];         /* All-purpose buffer           */
static ULONG diskChangeCount;         /* Disk change count            */
static int nErFil;                    /* Total number of errors       */
static int nDirs;                     /* Nr. of checked directories   */
static int nFiles;                    /* Nr. of checked files         */
static BOOL listFileNames = TRUE;     /* "List file names" flag       */
static unsigned abortDT = 0;          /* True when CTRL-C hit         */
static struct DriveGeometry drGeom;   /* Floppy drive characteristics */
static ULONG cylSize;                 /* Bytes per cylinder           */

/**
 | Local procedures
**/

static void     ActionMenu(const int code);
static unsigned CheckBreak(void);
static void     CheckDir(char *path, const BOOL root);
static void     CheckFile(char *name);
static void     DirStuff(char *name, int i);
static void     DiskCheck(const int drive);
static void     EndTest(void);
static void     FileStuff(BPTR dirLock, char *dirName, char *filName,
                          int i);
static void     GetBuffer(const ULONG size);
static void     Motor(const ULONG action);
static void     OutLine(const BOOL last, char *fmt, ...);
static void     ReadCyl(const int cyl, const int hd);
static void     SeekFullRange(const SHORT howmany);
static void     StartTest(int i);
