#include <exec/memory.h>
#include <stdio.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <stat.h>
#include <fcntl.h>

#define FLAG_README 1<<1
#define HAS_README(entry) (entry->flags & FLAG_README)

#define ID_Sort     1
#define ID_View     2
#define ID_Readme   3
#define ID_Name     4
#define ID_Get	    5
//#define ID_Host     6
//#define ID_Quit     7
//#define ID_FilesDC  8
#define ID_ReadNext 9
#define ID_GetAbort 10
#define ID_HostsDC  11
#define ID_Config   12

struct FileLineRec {
    char *dir, *name, *size, *readme, *descr;
    LONG time, intsize, flags, recsize;
};

struct HostLineRec {
    char country[30], host[30], dir[30];
};

struct PrefsRec {
    int defsort, defview;
    char getdir[256], tmpdir[256], defcfg[256], server[256], uncomp[256];
    LONG lasttime, thistime;
};

int read_prefs(void);
int write_prefs(char *);
void show_new(void);
void show_recent(void);
void show_tagged(void);
void show_short(void);
void clone_tagged(APTR);
void copy_tagged(APTR);
void copy_all(APTR);
char *gettok(char **, char, int *);
int get_parse(char *, APTR);
int adt_parse_v1(FILE *, APTR);
void readme(char *, char *);
int get_file(char *, char *, int);
APTR currentlv(void);

extern char *ftp_connect(char *, char *);
extern int ftp_get(char *, LONG, char *);
extern void joinpaths(char *, char *, char *);
