/*****************************************************************************/
/*
                                  upd.h
*/
/*****************************************************************************/

#ifndef UPD_H_LOADED
#define UPD_H_LOADED 1

#include "wasd.h"

/**************/
/* structures */
/**************/

typedef struct UpdTreeStruct UPD_TREE;

struct UpdTreeStruct
{
   UPD_TREE  *PrevTreeNodePtr,
             *NextTreeNodePtr;

   int  /* */
        FileNameLength;

   char  /* */
         FileName [ODS_MAX_FILE_NAME_LENGTH+1];

   /* "on-disk structure" supporting both ODS-2 and ODS-5 */
   ODS_STRUCT  SearchOds;
};

typedef struct UpdTaskStruct UPD_TASK;

struct UpdTaskStruct
{
   BOOL  /* editing a server configuration file */
         ConfigurationEdit,
         /* upper-case, directories indicated [], etc. */
         FormatTreeLikeVms,
         /* edit file record format is FIX/UDF (don't add newlines) */
         RecordFormatFixed,
         /* */
         RuleCheckAvailable,
         /* generated tree is for "Update" facility */
         UpdateTree;

   int  /* numeric columns */
        Cols,
        /* for counting files in tree listings, etc. */
        FileCount,
        /* */
        NavigateSize,
        /* path info dir part */
        PathInfoDirLength,
        /* numeric rows */
        Rows,
        /* count of how many characters before beginning "|---", etc. */
        TreeIndent,
        /* directory nesting level */
        TreeLevel;

   unsigned long  /* when creating files and directories */
                  ProtectionMask;

   char  /* MUST be 512 bytes (one block) for file copy purposes */
         CopyBuffer [512],
         /* columns by rows, for edit file <TEXTAREA> window */
         CxR [16],
         /* used for reading record from files being edited */
         EditBuffer [2048],
         /* tree processing, contains any name, type, version */
         FileNamePart [ODS_MAX_FILE_NAME_LENGTH+1],
         /* holds <select> list */
         FileProtectionList [256],
         /* HTML-escaped title :^) */
         HtmlEscapedTitle [256],
         /* used to store language-specific strings while in use */
         MsgString [512],
         /* holds path directory part */
         PathInfoDir [ODS_MAX_FILE_NAME_LENGTH+1],
         /* holds <select> list */
         ProtectionList [256];

   char  /* pointer to MIME content-type */
         *ContentTypePtr,
         /* current position during use of language-specific string */
         *MsgStringPtr;

   /* "on-disk structure" supporting both ODS-2 and ODS-5 */
   ODS_STRUCT  FileOds,
               SearchOds;

   UPD_TREE  *TreeHeadPtr,
             *TreeNodePtr;

   /* pointer to function, used for specifying the next task */
   REQUEST_AST NextTaskFunction;
};

/***********************/
/* function prototypes */
/***********************/

BOOL UpdAccess (REQUEST_STRUCT*, char*, int);
void UpdBegin (REQUEST_STRUCT*, REQUEST_AST);
void UpdConfirmCreate (REQUEST_STRUCT*, char*);
void UpdConfirmMkdir (REQUEST_STRUCT*, char*);
void UpdConfirmDelete (REQUEST_STRUCT*, char*, char*);
void UpdConfirmProtect (REQUEST_STRUCT*, char*, char*);
void UpdConfirmRename (REQUEST_STRUCT*, char*, char*);
void UpdCopyFileBegin (REQUEST_STRUCT*, char*);
void UpdCopyFileEnd (REQUEST_STRUCT*);
void UpdCopyFileNextBlock (REQUEST_STRUCT*);
void UpdCopyFileNextBlockAst (struct RAB*); 
void UpdEditFileBegin (REQUEST_STRUCT*, REQUEST_AST, char*);
void UpdEditFileEnd (REQUEST_STRUCT*);
void UpdEditFileNextRecord (REQUEST_STRUCT*);
void UpdEditFileNextRecordAst (struct RAB*); 
void UpdFileRename (REQUEST_STRUCT*, char*, char*);
void UpdEnd (REQUEST_STRUCT*);
void UpdNavigateBegin (REQUEST_STRUCT*);
void UpdNavigateBeginFiles (REQUEST_STRUCT*);
void UpdNavigateDirs (REQUEST_STRUCT*); 
void UpdNavigateEnd (REQUEST_STRUCT*);
int UpdNavigateFiles (REQUEST_STRUCT*); 
int UpdNavigateSearchDirs (REQUEST_STRUCT*); 
void UpdNavigateSearchFiles (REQUEST_STRUCT*); 
void UpdProtection (REQUEST_STRUCT*);
void UpdRundown (REQUEST_STRUCT*);
void UpdTreeBegin (REQUEST_STRUCT*);
void UpdTreeListDirs (REQUEST_STRUCT*);
void UpdTreeDirs (REQUEST_STRUCT*); 
void UpdTreeEnd (REQUEST_STRUCT*);

#endif /* UPD_H_LOADED */

/*****************************************************************************/

