home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 488.lha / csh_v5.0 / src / csh500src.lzh / shell.h < prev    next >
C/C++ Source or Header  |  1991-02-24  |  6KB  |  212 lines

  1.  
  2. /*
  3.  * SHELL.H
  4.  *
  5.  * (c)1986 Matthew Dillon     9 October 1986
  6.  *
  7.  *
  8.  * SHELL include file.. contains shell parameters and extern's
  9.  *
  10.  * Version 2.07M by Steve Drew 10-Sep-87
  11.  *
  12.  * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90
  13.  *
  14.  */
  15.  
  16. #define RAW_CONSOLE 1   /* Set to 0 to compile out Cmd Line Editing */
  17. #define KICK20
  18.  
  19. #define strlen strlen
  20.  
  21. #include <exec/types.h>
  22. #include <exec/exec.h>
  23. #include <libraries/arpbase.h>
  24. #include <intuition/intuitionbase.h>
  25. #include <libraries/dosextens.h>
  26. #include <time.h>
  27. #include <ctype.h>
  28. #include <fcntl.h>
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31. #include <string.h>
  32. #include "proto.h"
  33.  
  34. LONG AssignLock( UBYTE *name, BPTR lock );
  35. BOOL AssignLate( UBYTE *name, UBYTE *path );
  36. BOOL AssignPath( UBYTE *name, UBYTE *path );
  37. BOOL AssignAdd( UBYTE *name, BPTR lock );
  38.  
  39. typedef struct FileInfoBlock FIB;
  40. #ifdef AZTEC_C
  41.  
  42. # include <functions.h>
  43. # define DEVTAB(x) _devtab[x->_unit].fd
  44. # define CHARSWAIT(x) (x->_bp < x->_bend)
  45. # define COMPILER "Aztec C 5.0d"
  46. # pragma amicall(DOSBase, 0x264, AssignLock(d1,d2))
  47. # pragma amicall(DOSBase, 0x26a, AssignLate(d1,d2))
  48. # pragma amicall(DOSBase, 0x270, AssignPath(d1,d2))
  49. # pragma amicall(DOSBase, 0x276, AssignAdd(d1,d2))
  50.  
  51. #else
  52.  
  53. # include <proto/all.h>
  54. # include <ios1.h>
  55. # define DEVTAB(x) _ufbs[(x)->_file].ufbfh
  56. # define CHARSWAIT(x) (x->_rcnt != x->_wcnt)
  57.  
  58.   extern struct UFB _ufbs[];
  59. # define COMPILER "Lattice C 5.10"
  60. # define index strchr
  61. # define memmove(t,f,l) movmem((f),(t),(l))
  62. # define swapmem(x,y,z) swmem(x,y,z)
  63. # pragma libcall DOSBase AssignLock 264 2102
  64. # pragma libcall DOSBase AssignLate 26a 2102
  65. # pragma libcall DOSBase AssignPath 270 2102
  66. # pragma libcall DOSBase AssignAdd 276 2102
  67.  
  68. #endif
  69.  
  70. #ifndef MAX
  71. #define MAX(x,y) ((x)>(y) ? (x) : (y))
  72. #endif
  73.  
  74. #ifdef KICK20
  75. typedef ULONG    Tag;
  76. struct TagItem    {
  77.     Tag        ti_Tag;
  78.     ULONG    ti_Data;
  79. };
  80. #define TAG_DONE   (0L)    /* terminates array of TagItems. ti_Data unused    */
  81. #define TAG_END    TAG_DONE
  82. #define    TAG_IGNORE (1L)    /* ignore this item, not end of array        */
  83. #define    TAG_MORE   (2L)    /* ti_Data is pointer to another array of TagItems
  84.                          * note that this tag terminates the current array */
  85. #define    TAG_SKIP   (3L)    /* skip this and the next ti_Data items        */
  86. #define TAG_USER (1L<<31) /* differentiates user tags from system tags*/
  87.  
  88. /* definitions for the System() call */
  89.  
  90. enum {    SYS_Dummy = TAG_USER + 32,
  91.     SYS_Input,            /* specifies the input filehandle  */
  92.     SYS_Output,            /* specifies the output filehandle */
  93.     SYS_Asynch,            /* run asynch, close input/output on exit(!) */
  94.     SYS_UserShell,        /* send to user shell instead of boot shell */
  95.     SYS_CustomShell,    /* send to a specific shell (data is name) */
  96. };
  97. #endif
  98.  
  99. #define MAXAV        256        /* Max. # of arguments            */
  100. #define MAXSRC        5        /* Max. # of source file levels    */
  101. #define MAXIF        10        /* Max. # of if levels            */
  102. #define MAXALIAS    20        /* Max. # of alias levels        */
  103. #define MAXMYFILES    9        /* Max. # of internal files        */
  104.  
  105. #define LEVEL_SET        0        /* which variable list to use   */
  106. #define LEVEL_ALIAS        1
  107. #define LEVEL_LABEL        2
  108. #define LEVEL_SOURCE    2
  109.  
  110. #define SBYTE signed char
  111. #define MAXITEMS 16
  112. #define MAXMENUS 6
  113.  
  114. #ifndef NULL
  115. #define NULL 0L
  116. #endif
  117.  
  118. #define CHECKBREAK() dobreak()
  119.  
  120. #ifndef AZTEC_C
  121. struct _dev {
  122.     long  fd;
  123.     short mode;
  124.     };
  125. #endif
  126.  
  127. struct HIST {
  128.     struct HIST *next, *prev;    /* doubly linked list */
  129.     char *line;                    /* line in history    */
  130. };
  131.  
  132. struct PERROR {
  133.     int errnum;                    /* Format of global error lookup */
  134.     char *errstr;
  135. };
  136.  
  137. struct DPTR {                    /* Format of directory fetch pointer */
  138.     BPTR lock;                    /* lock on directory   */
  139.     FIB *fib;                    /* mod'd fib for entry */
  140.     };
  141.  
  142. extern struct HIST *H_head, *H_tail;
  143. extern struct PERROR Perror[];
  144. extern struct DPTR *dopen();
  145. extern char **av;
  146. extern char *Current;
  147. extern int  H_len, H_tail_base, H_stack;
  148. extern int  E_stack;
  149. extern int  Src_stack, If_stack, forward_goto;
  150. extern int  ac;
  151. extern int  max_ac;
  152. extern int  debug, Rval, Verbose, disable, Quit;
  153. extern int  Lastresult, atoierr;
  154. extern int  Exec_abortline;
  155. extern int   S_histlen;
  156. extern unsigned int options;
  157. extern long  Cin, Cout, Cout_append;
  158. extern char *Cin_name, *Cout_name;
  159. extern char  Cin_type,  Cout_type;  /* these variables are in transition */
  160. extern char *Pipe1, *Pipe2;
  161.  
  162. extern FILE *Src_base[MAXSRC];
  163. extern long Src_pos[MAXSRC];
  164. extern int  Src_if[MAXSRC];
  165. extern char If_base[MAXIF];
  166. extern struct Process *Myprocess;
  167. extern struct CommandLineInterface *Mycli;
  168.  
  169. extern struct ArpBase *ArpBase;
  170.  
  171. extern long atol(), Atol(), myatol();
  172.  
  173. extern char v_titlebar[], v_prompt[], v_hist[], v_histnum[], v_debug[],
  174.     v_verbose[], v_stat[], v_lasterr[], v_cwd[], v_except[], v_passed[],
  175.     v_path[], v_gotofwd[], v_linenum[], v_every[], v_lcd[], v_rxpath[],
  176.     v_hilite[], v_scroll[], v_minrows[], v_result[], v_qcd[], v_noreq[],
  177.     v_value[], v_nobreak[], v_bground[];
  178.  
  179. extern char o_hilite[], o_lolite[], *o_csh_qcd, o_internal;
  180. extern char o_aux, o_minrows, o_scroll, o_nowindow, o_noraw, o_vt100;
  181. extern char o_nofastscr, o_kick20, o_nobreak, o_bground, o_resident;
  182. extern long o_noreq;
  183. extern char Buf[], isalph[], confirmed, *classfile;
  184.  
  185. /* #define isalphanum(x) isalph[x] */
  186.  
  187. typedef struct file_info {
  188.     LONG flags;
  189.     LONG size;
  190.     LONG blocks;
  191.     char class[12];
  192.     struct DateStamp date;
  193. } FILEINFO;
  194.  
  195. typedef struct Class {
  196.     struct Class *next;
  197.     char name[1];
  198. } CLASS;
  199.  
  200. extern CLASS *CRoot, *LastCRoot;
  201. extern struct Window *Win;
  202.  
  203. #if 1
  204. LONG RunCommand( BPTR seg, long stack, UBYTE *paramptr, long paramlen );
  205. struct Segment *FindSegment( UBYTE *name, struct Segment *seg, long system );
  206. LONG System( UBYTE *command, struct TagItem *tags );
  207.  
  208. # pragma libcall DOSBase RunCommand 1f8 432104
  209. # pragma libcall DOSBase FindSegment 30c 32103
  210. # pragma libcall DOSBase System 25e 2102
  211. #endif
  212.