/* AXsh.h */
#include <exec/types.h>

long MyRunCommand(char *,char *,BPTR,BPTR,int residents);

#include "/lib/iomodes.h"
#include "/lib/users.h"
#include "/lib/misc.h"

#include "AXshLanguage.h"

#define COPYRIGHT 		"Copyright ©1991-1994 Digital Design\n"
#define UPDATED			DATE
#define MAXCONFIGLINES 	500	/* You may have to change these ... */
#define CONFIGLINELEN	80

#define MAXPERMDIRS		500	/* max. number of permitted dirs in config */
#define MAXHOMEDIRS		50	/* max. number of home dirs */

#define MAXCOMLEN		40	/* max. command lenght */
#define MAXDIRLEN		40	/* max. command path lenght */
#define HISTORY			60	/* number of history events */
#define HISTMOVE		2	/* how close a history event isn't copied (bigger than 0) */

#define ARGLEN	160			/* maximum argument (and input line) lenght */
#define ARGMAX	128			/* max number of arguments */
#define ARGBUF	1024		/* max total size of arguments */

#define COPYBUF	4096		/* buffer size for ftp and upload */

#define ALIAS_ADD		0
#define ALIAS_REMOVE	1
#define ALIAS_REPLACE	2
#define ALIAS_FREE		3

struct AliasNode
{
	struct Node node;	/* node.ln_Name points to the alias name */
	char *definition;	/* points to the definition */
	long	nodesize;	/* size of the allocation */
};


/* command modifier flags */
#define C_IN_HOME		1		/* only allowed in home dir */
#define C_IGNORE		2		/* arguments are ignored */
#define C_NOT_A_FILE	4		/* arguments are not filenames */
#define C_QUOTA_CHANGE	8		/* used disk space may change */
#define C_NO_PATH		16		/* only filenames in homedir are allowed */
#define C_RAW			32		/* command executed in raw-mode */

/* sysghost commands */
#define COM_ADD		'a'		/* add IO user tty */
#define COM_REMOVE	'r'		/* remove IO */
#define COM_WRITE	'w'		/* write IO user text */
#define COM_WHO		'l'		/* who IO buffer maxlen */
#define COM_QUIT	'q'		/* quit */
#define COM_SET		's'		/* set IO env value */
#define COM_SETSYS	'y'		/* setsys IO sys value */
#define COM_UNSET	'x'		/* unset IO env */
#define COM_GET		'g'		/* get IO env/sys value */
#define COM_GETN	'h'		/* get IO n value */

/* New for 1.31 */
#define COM_READ	'd'		/* read IO buffer maxlen */
#define COM_KICK	'k'		/* kick IO user [tty] */
#define COM_TIME	't'		/* time IO limit */

/* These are not included in 1.3 headers - actually these are not valid in 1.3 */
#ifndef AFF_68030
#define AFF_68030       (1<<2)
#endif
#ifndef AFF_68040
#define AFF_68040       (1<<3)
#endif
#ifndef AFF_68881
#define AFF_68881       (1L<<4)
#endif
#ifndef AFF_68882
#define AFF_68882       (1L<<5)
#endif
#ifndef AFF_FPU40
#define AFF_FPU40       (1L<<6)
#endif


void tinyreadconfig(void);
void cleanexit(int);
void openthings(void);
int  getstring(char *prompt,UBYTE *CommandString,int lenght, BOOL echo);
int  check_mail(char *mailhome,char *loginname,char *home);
/* must first be called before .lastlogin is touched, touch .lastlogin after logout */

void readconfig(void);
int  isinhomedir(char *dir);

int  traverse(char *);
int  verbosetraverse(char *);
int  getcommand(void);
int  getuser(void);
long checkquota(char *dir);
void get_time(char *);
char cat(char *filename);
int  alias(char *,char *,int action,int len);
void updatelog(char *);
int  realpath(char *real,char *fake);	/* convert symbolic path to physical path */
UBYTE who(UBYTE,UBYTE,char *,char *);
void modemhangup(void);
void fcomp(char *);		/* file name completion */
void fcomplist(char *);	/* file name completion list */
void ccomp(char *);		/* command name completion */
void ccomplist(char *);	/* command name completion list */
void prompt(char *def);	/* print the prompt */
void sysinfo(void);		/* print information about the system */
void __saveds axshguruhandler(void);	/* entering this function needs some real trouble ... */
char *printout(ULONG);

/* internal commands */

struct InternalNode
{
	char *name;
	int (*code)(int,char **,char *,BPTR);
};

