home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga GigaPD 3
/
Amiga_GigaPD_v3_3of3.iso
/
fred_fish
/
fish_601-700_lha
/
fish_624.lha
/
CSH
/
csh519s.lha
/
shell.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-07
|
9KB
|
353 lines
/*
* SHELL.H
*
* (c)1986 Matthew Dillon 9 October 1986
*
*
* SHELL include file.. contains shell parameters and extern's
*
* Version 2.07M by Steve Drew 10-Sep-87
* Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90
* Version 5.00L by Urban Mueller 16-Mar-91
*
*/
#define RAW_CONSOLE 1 /* Set to 0 to compile out command line editing */
#define strlen strlen
#ifdef _DCC
# define C_Args
# define FUNCARG(x,y,z) ()
#else
# define FUNCARG(x,y,z) (x,y,z)
# define KICK20
#endif
#include <exec/types.h>
#include <exec/exec.h>
#include <exec/memory.h>
#include <intuition/intuitionbase.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <time.h>
#include <ctype.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
LONG AssignLock( UBYTE *name, BPTR lock );
BOOL AssignLate( UBYTE *name, UBYTE *path );
BOOL AssignPath( UBYTE *name, UBYTE *path );
BOOL AssignAdd ( UBYTE *name, BPTR lock );
LONG AllocPattern (STRPTR, ULONG);
LONG MatchThePattern (LONG, STRPTR);
void FreePattern (LONG);
typedef struct FileInfoBlock FIB;
#ifdef AZTEC_C
# include <functions.h>
# define DEVTAB(x) (BPTR)(_devtab[x->_unit].fd)
# define CHARSWAIT(x) (x->_bp < x->_bend)
# define RESETIO(x) (x->_bp = x->_bend)
# define COMPILER "Aztec C 5.0d"
# pragma amicall(DOSBase, 0x264, AssignLock(d1,d2))
# pragma amicall(DOSBase, 0x26a, AssignLate(d1,d2))
# pragma amicall(DOSBase, 0x270, AssignPath(d1,d2))
# pragma amicall(DOSBase, 0x276, AssignAdd(d1,d2))
# pragma amicall(PatternBase, 0x48, AllocPattern(a0,d0))
# pragma amicall(PatternBase, 0x60, MatchThePattern(d0,a0))
# pragma amicall(PatternBase, 0x66, FreePattern(d0))
#endif
#ifdef LATTICE
# include <proto/all.h>
# include <ios1.h>
# define DEVTAB(x) _ufbs[(x)->_file].ufbfh
# define CHARSWAIT(x) (x->_rcnt != x->_wcnt)
# define RESETIO(x) (x->_rcnt = x->_wcnt)
extern struct UFB _ufbs[];
# ifndef memmove
# define memmove(t,f,l) movmem((f),(t),(l))
# endif
# define COMPILER "Lattice C 5.10"
# define index strchr
# define rindex strrchr
# define swapmem(x,y,z) swmem(x,y,z)
# pragma libcall DOSBase AssignLock 264 2102
# pragma libcall DOSBase AssignLate 26a 2102
# pragma libcall DOSBase AssignPath 270 2102
# pragma libcall DOSBase AssignAdd 276 2102
# pragma libcall PatternBase AllocPattern 48 0802
# pragma libcall PatternBase MatchThePattern 60 8002
# pragma libcall PatternBase FreePattern 66 001
#endif
#ifdef _DCC
# define COMPILER "DICE 2.06"
# define DEVTAB(x) (_IoFD[x->sd_Fd].fd_Fh)
# define CHARSWAIT(x) (x->sd_RPtr != x->sd_RBuf)
# define RESETIO(x) (x->sd_RPtr = x->sd_RBuf)
# define index strchr
# define rindex strrchr
void * AllocMem(long byteSize, long requirements);
struct MsgPort *FindPort( UBYTE *name );
#endif
#include <libraries/arpbase.h>
#undef toupper
#define toupper(c) ((c)>='a'&&(c)<='z'?((c)-('a'-'A')):(c))
#ifndef MAX
#define MAX(x,y) ((x)>(y) ? (x) : (y))
#endif
#define OPT(x) (options & (x))
#define MAXSRC 5 /* Max. # of source file levels */
#define MAXIF 20 /* Max. # of if levels */
#define MAXALIAS 20 /* Max. # of alias levels */
#define MAXMYFILES 9 /* Max. # of internal files */
#define MAXHASH 32 /* Max. #áof hash chains */
#define MAXFILENAME 30
#define LEVEL_SET 0 /* which variable list to use */
#define LEVEL_ALIAS 1
#define LEVEL_LABEL 2
#define LEVEL_LOCAL 256
#define SBYTE signed char
#define MAXITEMS 16
#define MAXMENUS 6
#define VERBOSE_SOURCE 1
#define VERBOSE_ALIAS 2
#define VERBOSE_HILITE 4
#define SCAN_FILE 1
#define SCAN_DIR 2
#define SCAN_RECURSE 4
#define SCAN_DIRENTRY 8
#define SCAN_DIREND 16
#ifndef NULL
#define NULL 0L
#endif
#define CHECKBREAK() dobreak()
#define ISSPACE(c) ((c)==' ' || (c)==9 || (UBYTE)(c)==0xA0)
#ifndef AZTEC_C
struct _dev {
long fd;
short mode;
};
#endif
typedef struct hnode {
struct hnode *next, *prev; /* doubly linked list */
char *line; /* line in history */
} HIST;
typedef struct PErr {
int errnum; /* Format of global error lookup */
char *errstr;
} PERROR;
typedef struct dirptr { /* Format of directory fetch pointer */
BPTR lock; /* lock on directory */
FIB *fib; /* mod'd fib for entry */
} DPTR;
extern HIST *H_head, *H_tail;
extern PERROR Perror[];
extern char **av;
extern char *Current;
extern int H_len, H_tail_base, H_stack, H_num;
extern int E_stack;
extern int Src_stack, If_stack, forward_goto;
extern int ac;
extern int max_ac;
extern int debug, Rval, Verbose, disable, Quit;
extern int Lastresult, atoierr;
extern int Exec_abortline;
extern int S_histlen;
extern unsigned int options;
extern FILE *Src_base[MAXSRC];
extern long Src_pos[MAXSRC];
extern short Src_if[MAXSRC], Src_abort[MAXSRC];
extern char If_base[MAXIF];
extern struct Process *Myprocess;
extern struct CommandLineInterface *Mycli;
extern struct ArpBase *ArpBase;
extern char v_titlebar[], v_prompt[], v_hist[], v_histnum[], v_debug[],
v_verbose[], v_stat[], v_lasterr[], v_cwd[], v_except[], v_passed[],
v_path[], v_gotofwd[], v_linenum[], v_every[], v_lcd[], v_rxpath[],
v_hilite[], v_scroll[], v_minrows[], v_result[], v_qcd[], v_noreq[],
v_value[], v_nobreak[], v_bground[], v_pipe[], v_datefmt[], v_ioerr[],
v_abbrev[], v_rback[], v_insert[], v_failat[];
extern char o_hilite[], o_lolite[], o_rback[], *o_csh_qcd, o_internal;
extern char o_aux, o_minrows, o_scroll, o_nowindow, o_noraw, o_vt100;
extern char o_nofastscr, o_kick20, o_nobreak, o_bground, o_resident;
extern char o_pipe[], o_datefmt, o_abbrev, o_insert, *o_every;
extern long o_noreq, o_failat;
extern char Buf[], isalph[], confirmed, *classfile;
extern char *MyMem;
#define isalphanum(x) isalph[x]
typedef struct file_info {
LONG flags;
LONG size;
LONG blocks;
char class[12];
struct DateStamp date;
} FILEINFO;
typedef struct pattern {
int casedep;
int queryflag;
LONG patptr;
char pattern[1];
} PATTERN;
#define INFO_COMMENT (1<<30)
#define INFO_INFO (1<<29)
typedef struct Class {
struct Class *next;
char name[1];
} CLASS;
extern CLASS *CRoot, *LastCRoot;
extern struct Window *Win;
extern long IoError;
typedef struct VNode {
struct VNode *next;
long len;
char *text;
char name[1];
} NODE;
typedef struct VRoot {
NODE *first[MAXHASH];
struct VRoot *parent;
} ROOT;
#if 1
LONG RunCommand( BPTR seg, long stack, UBYTE *paramptr, long paramlen );
struct Segment *FindSegment( UBYTE *name, struct Segment *seg, long system );
BOOL AssignAdd( UBYTE *name, BPTR lock );
LONG System( UBYTE *command, struct TagItem *tags );
#ifdef AZTEC_C
# pragma amicall(DOSBase, 0x1f8, RunCommand(d1,d2,d3,d4))
# pragma amicall(DOSBase, 0x30c, FindSegment(d1,d2,d3))
# pragma amicall(DOSBase, 0x276, AssignAdd(d1,d2))
# pragma amicall(DOSBase, 0x25e, System(d1,d2))
#endif
#ifdef LATTICE
# pragma libcall DOSBase RunCommand 1f8 432104
# pragma libcall DOSBase FindSegment 30c 32103
# pragma libcall DOSBase AssignAdd 276 2102
# pragma libcall DOSBase System 25e 2102
#endif
struct RootNode2x {
BPTR rn_TaskArray;
BPTR rn_ConsoleSegment;
struct DateStamp rn_Time;
LONG rn_RestartSeg;
BPTR rn_Info;
BPTR rn_FileHandlerSegment;
struct MinList rn_CliList;
struct MsgPort *rn_BootProc;
BPTR rn_ShellSegment;
LONG rn_Flags;
};
struct DosList2x {
BPTR dol_Next;
LONG dol_Type;
struct MsgPort *dol_Task;
BPTR dol_Lock;
union {
struct {
BSTR dol_Handler;
LONG dol_StackSize;
LONG dol_Priority;
ULONG dol_Startup;
BPTR dol_SegList;
BPTR dol_GlobVec;
} dol_handler;
struct {
struct DateStamp dol_VolumeDate;
BPTR dol_LockList;
LONG dol_DiskType;
} dol_volume;
struct {
UBYTE *dol_AssignName;
struct AssignList *dol_List;
} dol_assign;
} dol_misc;
BSTR dol_Name;
};
struct AssignList2x {
struct AssignList *al_Next;
BPTR al_Lock;
};
#define DLST_DEVICE 0
#define DLST_DIRECTORY 1
#define DLST_VOLUME 2
#define DLST_LATE 3
#define DLST_NONBINDING 4
#define DLST_PRIVATE -1
#define ST_USERDIR 2
typedef ULONG Tag;
struct TagItem {
Tag ti_Tag;
ULONG ti_Data;
};
#define TAG_DONE (0L)
#define TAG_USER (1L<<31)
#define SYS_Dummy (TAG_USER + 32)
#define SYS_Input (SYS_Dummy + 1) /* specifies the input filehandle */
#define SYS_Output (SYS_Dummy + 2) /* specifies the output filehandle */
#define SYS_Asynch (SYS_Dummy + 3) /* run asynch, close input/output on exit(!) */
#define SYS_UserShell (SYS_Dummy + 4) /* send to user shell instead of boot shell */
#define SYS_CustomShell (SYS_Dummy + 5) /* send to a specific shell (data is name) */
#endif
#include "proto.h"