1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
/* C K U C M D . H -- Header file for Unix cmd package */
/*
Author: Frank da Cruz <fdc@columbia.edu>
Columbia University Kermit Project, New York City.
Copyright (C) 1985, 1998, Trustees of Columbia University in the City of New
York. The C-Kermit software may not be, in whole or in part, licensed or
sold for profit as a software product itself, nor may it be included in or
distributed with commercial products or otherwise distributed by commercial
concerns to their clients or customers without written permission of the
Office of Kermit Development and Distribution, Columbia University. This
copyright notice must not be removed, altered, or obscured.
*/
#ifndef CKUCMD_H
#define CKUCMD_H
/* Command recall */
#ifdef pdp11 /* Not enough room for this */
#ifndef NORECALL
#define NORECALL
#endif /* NORECALL */
#endif /* pdp11 */
#ifdef DYNAMIC /* Dynamic command buffers */
/*
Use malloc() to allocate the many command-related buffers in ckucmd.c.
*/
#ifndef DCMDBUF
#ifndef NORECALL
#define NORECALL
#endif /* NORECALL */
#endif /* DCMDBUF */
#ifndef NORECALL
#define CK_RECALL
#else
#ifdef CK_RECALL
#undef CK_RECALL
#endif /* CK_RECALL */
#endif /* NORECALL */
#else
#ifndef NORECALL
#define NORECALL
#endif /* NORECALL */
#endif /* DYNAMIC */
#ifdef NORECALL
#ifdef CK_RECALL
#undef CK_RECALL
#endif /* CK_RECALL */
#endif /* NORECALL */
/* Special getchars */
#ifdef VMS
#ifdef getchar /* This is for VMS GCC */
#undef getchar
#endif /* getchar */
#define getchar() vms_getchar()
int vms_getchar(void);
#endif /* VMS */
#ifdef aegis
#undef getchar
#define getchar() coninc(0)
#endif /* aegis */
#ifdef AMIGA
#undef getchar
#define getchar() coninc(0)
#endif /* AMIGA */
#ifdef Plan9
#undef getchar
#define getchar() coninc(0)
#undef putchar
#define putchar(c) conoc(c)
#define printf conprint
#endif /* Plan9 */
/* Sizes of things */
#ifndef CMDDEP
#ifdef BIGBUFOK
#define CMDDEP 64 /* Maximum command recursion depth */
#else
#define CMDDEP 20
#endif /* BIGBUFOK */
#endif /* CMDDEP */
#define HLPLW 78 /* Width of ?-help line */
#define HLPCW 19 /* Width of ?-help column */
#define HLPBL 100 /* Help string buffer length */
#ifdef BIGBUFOK
#define ATMBL 4072 /* Command atom buffer length*/
#else
#ifdef NOSPL
#define ATMBL 256
#else
#define ATMBL 1024
#endif /* NOSPL */
#endif /* BIGBUFOK */
#ifndef CMDBL
#ifdef NOSPL
/* No script programming language, save some space */
#define CMDBL 512 /* Command buffer length */
#else
#ifdef BIGBUFOK
#define CMDBL 10238
#else
#define CMDBL 1024
#endif /* OS2 */
#endif /* NOSPL */
#endif /* CMDBL */
/* Special characters */
#define RDIS 0022 /* Redisplay (^R) */
#define LDEL 0025 /* Delete line (^U) */
#define WDEL 0027 /* Delete word (^W) */
#ifdef CK_RECALL
#define C_UP 0020 /* Go Up in recall buffer (^P) */
#define C_UP2 0002 /* Alternate Go Up (^B) for VMS */
#define C_DN 0016 /* Go Down in recall buffer (^N) */
#endif /* CK_RECALL */
/* Keyword flags (bits, powers of 2) */
#define CM_INV 1 /* Invisible keyword */
#define CM_ABR 2 /* Abbreviation */
#define CM_HLP 4 /* Help-only keyword */
#define CM_ARG 8 /* Switch that takes an argument */
#define CM_NOR 16 /* No recall for this command */
/* Token flags (numbers) */
#define CMT_COM 0 /* Comment (; or #) */
#define CMT_SHE 1 /* Shell escape (!) */
#define CMT_LBL 2 /* Label (:) */
#define CMT_FIL 3 /* Indirect filespec (@) */
/* Path separator for path searches */
#ifdef OS2
#define PATHSEP ';'
#else
#ifdef UNIX
#define PATHSEP ':'
#else
#define PATHSEP ','
#endif /* UNIX */
#endif /* OS2 */
/* Keyword Table Template */
struct keytab { /* Keyword table */
char *kwd; /* Pointer to keyword string */
int kwval; /* Associated value */
int flgs; /* Flags (as defined above) */
};
/* String preprocessing function */
#ifdef CK_ANSIC /* ANSI C */
#ifdef M_SYSV /* SCO Microsoft C wants no args */
typedef int (*xx_strp)();
#else
typedef int (*xx_strp)(char *, char **, int *);
#endif /* M_SYSV */
#else /* Not ANSI C */
typedef int (*xx_strp)();
#endif /* CK_ANSIC */
/* FLDDB struct */
typedef struct FDB {
int fcode; /* Function code */
char * hlpmsg; /* Help message */
char * dflt; /* Default */
char * sdata; /* Additional string data */
int ndata1; /* Additional numeric data 1 */
int ndata2; /* Additional numeric data 2 */
xx_strp spf; /* String processing function */
struct keytab * kwdtbl; /* Keyword table */
struct FDB * nxtfdb; /* Pointer to next alternative */
} fdb;
typedef struct OFDB {
struct FDB * fdbaddr; /* Address of succeeding FDB struct */
int fcode; /* Function code */
char * sresult; /* String result */
int nresult; /* Numeric result */
int kflags; /* Keyword flags if any */
} ofdb;
#ifndef CKUCMD_C
extern struct OFDB cmresult;
#endif /* CKUCMD_C */
/* Codes for primary parsing function */
#define _CMNUM 0 /* Number */
#define _CMOFI 1 /* Output file */
#define _CMIFI 2 /* Input file */
#define _CMFLD 3 /* Arbitrary field */
#define _CMTXT 4 /* Text string */
#define _CMKEY 5 /* Keyword */
#define _CMCFM 6 /* Confirmation */
#define _CMDAT 7 /* Date/time */
/* Function prototypes */
_PROTOTYP( int xxesc, (char **) );
_PROTOTYP( int cmrini, (int) );
_PROTOTYP( VOID cmsetp, (char *) );
_PROTOTYP( VOID cmsavp, (char [], int) );
_PROTOTYP( VOID prompt, (xx_strp) );
_PROTOTYP( VOID pushcmd, (void) );
_PROTOTYP( VOID cmres, (void) );
_PROTOTYP( VOID cmini, (int) );
_PROTOTYP( int cmgbrk, (void) );
_PROTOTYP( int cmpush, (void) );
_PROTOTYP( int cmpop, (void) );
_PROTOTYP( VOID untab, (char *) );
_PROTOTYP( int cmnum, (char *, char *, int, int *, xx_strp ) );
_PROTOTYP( int cmofi, (char *, char *, char **, xx_strp ) );
_PROTOTYP( int cmifi, (char *, char *, char **, int *, xx_strp ) );
_PROTOTYP( int cmiofi, (char *, char *, char **, int *, xx_strp ) );
_PROTOTYP( int cmifip,(char *, char *, char **, int *, int, char *, xx_strp ));
_PROTOTYP( int cmifi2,(char *,char *,char **,int *,int,char *,xx_strp,int ));
_PROTOTYP( int cmdir, (char *, char *, char **, xx_strp ) );
_PROTOTYP( int cmdirp, (char *, char *, char **, char *, xx_strp ) );
_PROTOTYP( int cmfld, (char *, char *, char **, xx_strp ) );
_PROTOTYP( int cmtxt, (char *, char *, char **, xx_strp ) );
_PROTOTYP( int cmkey, (struct keytab [], int, char *, char *, xx_strp) );
_PROTOTYP( int cmkeyx, (struct keytab [], int, char *, char *, xx_strp) );
_PROTOTYP( int cmkey2,(struct keytab [],int,char *,char *,char *,xx_strp,int));
_PROTOTYP( int cmdate,(char *, char *, char **, int, xx_strp) );
_PROTOTYP( int cmfdb, (struct FDB *) );
_PROTOTYP( VOID cmfdbi, (struct FDB *,
int, char *, char *, char *, int, int, xx_strp,
struct keytab *, struct FDB *) );
_PROTOTYP( int chktok, (char *) );
_PROTOTYP( int cmcfm, (void) );
_PROTOTYP( int rdigits, (char *) );
_PROTOTYP( int chknum, (char *) );
_PROTOTYP( int lower, (char *) );
_PROTOTYP( int lookup, (struct keytab [], char *, int, int *) );
_PROTOTYP( VOID kwdhelp, (struct keytab[],int,char *,char *,char *,int,int) );
_PROTOTYP( int ungword, (void) );
_PROTOTYP( VOID unungw, (void) );
_PROTOTYP( int cmdsquo, (int) );
_PROTOTYP( int cmdgquo, (void) );
#ifdef CK_RECALL
_PROTOTYP( char * cmgetcmd, (char *) );
_PROTOTYP( VOID addcmd, (char *) );
_PROTOTYP( VOID cmaddnext, () );
#endif /* CK_RECALL */
#ifdef DCMDBUF
_PROTOTYP( int cmsetup, (void) );
#endif /* DCMDBUF */
#endif /* CKUCMD_H */
/* End of ckucmd.h */
|