/* MRBackup - include file for global data and definitions. * Filename: MRBackup.h * Date: 08/22/87 * * History: (most recent change first) * * 09/03/87 -MRR- V1.3: Changed window version and date. */ /* Main.c defines MAIN. It should not defined elsewhere. */ #ifdef MAIN #define EXTERN #else #define EXTERN extern #endif #include #include #include #include #include #include #include #include #include #include #include "gadget.h" #include "menu.h" /* Constants */ #define false 0 /* for short parameter requirements */ #define true 1 /* for short parameter requirements */ #define BUFMAX (32L * 1024L) /* max size for copy/compress buffer */ #define LINES_PER_PAGE 60 #define VOLUME_MAX 32 /* max characters in volume name */ #define PATH_MAX 256 /* max characters in pathname (very arbitrary) */ /* Define error recovery constants. Note that these are all powers * of 2 to allow creating 'sets' of allowable options during the * recovery prompt. */ #define NERRCODE 5 /* number of error recovery codes */ #define ERR_NONE 0 /* what we want ALL the time :-) */ #define ERR_ABORT 1 /* give up the ship */ #define ERR_RETRY_FILE 2 /* let's try that file one more time */ #define ERR_RESTART_VOLUME 4 /* for media errors on output floppy */ #define ERR_IGNORE 8 /* ignore this error and trudge on */ /* Macros */ /* determine if a menu item is "checked" */ #define GadgetString(g) ((struct StringInfo *) g->SpecialInfo)->Buffer #define IsChecked(item) (item->Flags & CHECKED == CHECKED) typedef struct t_pattern { struct t_pattern * next_pattern; char *pattern; } T_PATTERN; /* The following structure is used to link file and directory node * information into a doubly-linked list. This provides a way to * defer processing of sub-directory nodes until all files in a * current directory are processed. As nodes are "consumed", they * are returned to free memory. */ typedef struct t_file { struct t_file *previous,*next; char *filename; USHORT blocks; BOOL is_dir; /* TRUE => it's a directory */ } T_FILE; /* The following structure links lists of T_FILE nodes. */ typedef struct t_file_list { T_FILE *first_file; T_FILE *last_file; } T_FILE_LIST; /* External and forward function declarations */ extern char *calloc(), *index(), *rindex(); extern long DiskBlocks(); extern int errno; T_FILE *FindFile(); /* External data */ extern struct Gadget StopGad; extern struct Menu Titles[]; extern struct MenuItem Items[]; extern struct Window *pathwindow; /* Global data */ #ifdef DEBUG EXTERN struct FileHandle *debugconsole; EXTERN char debugmsg[512]; #endif EXTERN short back; /* backup disk serial number */ EXTERN UBYTE *buffer; /* file copy/cmprs buffer (AllocMem) */ EXTERN ULONG bufsize; /* size of buffer allocated */ EXTERN struct FileHandle *console; /* for informative messages */ EXTERN char conmsg[512]; EXTERN T_FILE *current_dir = NULL; /* current directory node */ EXTERN char destpath[PATH_MAX+1]; EXTERN char destvol[VOLUME_MAX+1]; EXTERN BOOL exclude_has_changed; /* true when new path specified */ EXTERN T_PATTERN *excludelist, *lastexclude; EXTERN char excludepath[81]; /* list of file patterns to exclude */ EXTERN struct IntuitionBase *IntuitionBase; EXTERN USHORT level; /* file nesting level */ EXTERN USHORT linecount; /* number of lines in listing */ EXTERN FILE *listing; EXTERN T_FILE_LIST main_list; EXTERN struct Window *mywindow; EXTERN struct DateStamp *now, *since; /* for date comparisons */ EXTERN short size; /* floppy blocks remaining */ EXTERN char srcpath[PATH_MAX]; EXTERN char srcvol[VOLUME_MAX+1]; /* source volume name */ EXTERN char temp[256]; /* The following flags suppress repetition of spoken * messages. After all, let's not over-do it. */ EXTERN UBYTE at_your_service; /* Preset data */ #ifdef MAIN char backpath[81] = "DF0:"; /* where backups go and restores come from. */ char destdrive[5] = "DF0:"; USHORT do_compress = 1; /* compression flag */ USHORT do_listing = 1; /* listing flag */ USHORT do_speech = 1; /* speech flag */ char *erropts[NERRCODE] = { /* error recovery options */ "No error", "Abort processing", "Retry this file", "Restart the output volume", "Ignore this error" }; char homepath[81] = "DH0:"; /* where files are backed up from and restored to. */ char listpath[81] = "PRT:"; /* where we send all of that vital information about backups */ struct NewWindow nw = { /* New window structure */ 0,0,640,200,0,1, /* IDCMP Flags */ MENUPICK | MOUSEBUTTONS | DISKINSERTED | CLOSEWINDOW | GADGETDOWN | GADGETUP | REQSET, /* Flags */ WINDOWCLOSE | WINDOWDEPTH | ACTIVATE , NULL, /* First gadget */ NULL, /* Checkmark */ (UBYTE *)"MRBackup Version 1.3 09/03/87",/* Window title */ NULL, /* No custom streen */ NULL, /* Not a super bitmap window */ 0,0,640,200, /* Not used, but set up anyway */ WBENCHSCREEN }; #else /* Declare preset external data without the presets. */ extern char backpath[81]; extern char destdrive[5]; extern USHORT do_compress; /* compression flag */ extern USHORT do_listing; /* listing flag */ extern USHORT do_speech; /* speech flag */ extern char destdrive[]; extern char *erropts[]; extern char homepath[81]; extern char listpath[81]; extern struct NewWindow nw; #endif