1 /* C K U C M D . H -- Header file for Unix cmd package */
4 Author: Frank da Cruz <fdc@columbia.edu>
5 Columbia University Kermit Project, New York City.
7 Copyright (C) 1985, 2009,
8 Trustees of Columbia University in the City of New York.
9 All rights reserved. See the C-Kermit COPYING.TXT file or the
10 copyright text in the ckcmai.c module for disclaimer and permissions.
18 #ifdef pdp11 /* Not enough room for this */
24 #ifdef DYNAMIC /* Dynamic command buffers */
26 Use malloc() to allocate the many command-related buffers in ckucmd.c.
39 #endif /* CK_RECALL */
50 #endif /* CK_RECALL */
56 #endif /* NOARROWKEYS */
59 /* Special getchars */
62 #ifdef getchar /* This is for VMS GCC */
65 #define getchar() vms_getchar()
66 int vms_getchar(void);
71 #define getchar() coninc(0)
76 #define getchar() coninc(0)
81 #define getchar() coninc(0)
83 #define putchar(c) conoc(c)
85 #define printf conprint
92 #define CMDDEP 64 /* Maximum command recursion depth */
97 #define HLPLW 78 /* Width of ?-help line */
98 #define HLPCW 19 /* Width of ?-help column */
99 #define HLPBL 100 /* Help string buffer length */
101 #define ATMBL 10238 /* Command atom buffer length*/
108 #endif /* BIGBUFOK */
112 /* No script programming language, save some space */
113 #define CMDBL 608 /* Command buffer length */
123 /* Special characters */
125 #define RDIS 0022 /* Redisplay (^R) */
126 #define LDEL 0025 /* Delete line (^U) */
127 #define WDEL 0027 /* Delete word (^W) */
129 #define C_UP 0020 /* Go Up in recall buffer (^P) */
130 #define C_UP2 0002 /* Alternate Go Up (^B) for VMS */
131 #define C_DN 0016 /* Go Down in recall buffer (^N) */
132 #endif /* CK_RECALL */
134 /* Keyword flags (bits, powers of 2) */
136 #define CM_INV 1 /* Invisible keyword */
137 #define CM_ABR 2 /* Abbreviation for another keyword */
138 #define CM_HLP 4 /* Help-only keyword */
139 #define CM_ARG 8 /* An argument is required */
140 #define CM_NOR 16 /* No recall for this command */
141 #define CM_PRE 32 /* Long-form cmdline arg for prescan */
142 #define CM_PSH 64 /* Command disabled if nopush */
143 #define CM_LOC 128 /* Command disabled if nolocal */
146 A long-form command line option is a keyword using the regular struct keytab
147 and lookup mechanisms. Flags that make sense in this context are CM_ARG,
148 indicating this option requires an argument (operand), and CM_PRE, which
149 means this option must be processed before the initialization file. The
150 absence of CM_PRE means the option is to be processed after the
151 initialization file in the normal manner.
154 /* Token flags (numbers) */
156 #define CMT_COM 0 /* Comment (; or #) */
157 #define CMT_SHE 1 /* Shell escape (!) */
158 #define CMT_LBL 2 /* Label (:) */
159 #define CMT_FIL 3 /* Indirect filespec (@) (not used) */
161 /* Path separator for path searches */
176 /* Keyword Table Template perhaps already defined in ckcdeb.h */
178 struct keytab { /* Keyword table */
179 char *kwd; /* Pointer to keyword string */
180 int kwval; /* Associated value */
181 int flgs; /* Flags (as defined above) */
183 #endif /* CK_KEYTAB */
185 /* String preprocessing function */
187 #ifdef CK_ANSIC /* ANSI C */
188 #ifdef M_SYSV /* SCO Microsoft C wants no args */
189 typedef int (*xx_strp)();
191 typedef int (*xx_strp)(char *, char **, int *);
193 #else /* Not ANSI C */
194 typedef int (*xx_strp)();
195 #endif /* CK_ANSIC */
200 int fcode; /* Function code */
201 char * hlpmsg; /* Help message */
202 char * dflt; /* Default */
203 char * sdata; /* Additional string data */
204 int ndata1; /* Additional numeric data 1 */
205 int ndata2; /* Additional numeric data 2 */
206 xx_strp spf; /* String processing function */
207 struct keytab * kwdtbl; /* Keyword table */
208 struct FDB * nxtfdb; /* Pointer to next alternative */
211 typedef struct OFDB {
212 struct FDB * fdbaddr; /* Address of succeeding FDB struct */
213 int fcode; /* Function code */
214 char * sresult; /* String result */
215 int nresult; /* Integer result */
216 int kflags; /* Keyword flags if any */
217 CK_OFF_T wresult; /* Long integer ("wide") result */
221 extern struct OFDB cmresult;
222 #endif /* CKUCMD_C */
224 /* Codes for primary parsing function */
226 #define _CMNUM 0 /* Number */
227 #define _CMOFI 1 /* Output file */
228 #define _CMIFI 2 /* Input file */
229 #define _CMFLD 3 /* Arbitrary field */
230 #define _CMTXT 4 /* Text string */
231 #define _CMKEY 5 /* Keyword */
232 #define _CMCFM 6 /* Confirmation */
233 #define _CMDAT 7 /* Date/time */
234 #define _CMNUW 8 /* Wide version of cmnum */
236 /* Function prototypes */
238 _PROTOTYP( int xxesc, (char **) );
239 _PROTOTYP( int cmrini, (int) );
240 _PROTOTYP( VOID cmsetp, (char *) );
241 _PROTOTYP( VOID cmsavp, (char [], int) );
242 _PROTOTYP( char * cmgetp, (void) );
243 _PROTOTYP( VOID prompt, (xx_strp) );
244 _PROTOTYP( VOID pushcmd, (char *) );
245 _PROTOTYP( VOID cmres, (void) );
246 _PROTOTYP( VOID cmini, (int) );
247 _PROTOTYP( int cmgbrk, (void) );
248 _PROTOTYP( int cmgkwflgs, (void) );
249 _PROTOTYP( int cmpush, (void) );
250 _PROTOTYP( int cmpop, (void) );
251 _PROTOTYP( VOID untab, (char *) );
252 _PROTOTYP( int cmnum, (char *, char *, int, int *, xx_strp ) );
253 _PROTOTYP( int cmnumw, (char *, char *, int, CK_OFF_T *, xx_strp ) );
254 _PROTOTYP( int cmofi, (char *, char *, char **, xx_strp ) );
255 _PROTOTYP( int cmifi, (char *, char *, char **, int *, xx_strp ) );
256 _PROTOTYP( int cmiofi, (char *, char *, char **, int *, xx_strp ) );
257 _PROTOTYP( int cmifip,(char *, char *, char **, int *, int, char *, xx_strp ));
258 _PROTOTYP( int cmifi2,(char *,char *,char **,int *,int,char *,xx_strp,int ));
259 _PROTOTYP( int cmdir, (char *, char *, char **, xx_strp ) );
260 _PROTOTYP( int cmdirp, (char *, char *, char **, char *, xx_strp ) );
261 _PROTOTYP( int cmfld, (char *, char *, char **, xx_strp ) );
262 _PROTOTYP( int cmtxt, (char *, char *, char **, xx_strp ) );
263 _PROTOTYP( int cmkey, (struct keytab [], int, char *, char *, xx_strp) );
264 _PROTOTYP( int cmkeyx, (struct keytab [], int, char *, char *, xx_strp) );
265 _PROTOTYP( int cmkey2,(struct keytab [],int,char *,char *,char *,xx_strp,int));
266 _PROTOTYP( int cmswi, (struct keytab [], int, char *, char *, xx_strp) );
267 _PROTOTYP( int cmdate,(char *, char *, char **, int, xx_strp) );
268 _PROTOTYP( char * cmpeek, (void) );
269 _PROTOTYP( int cmfdb, (struct FDB *) );
270 _PROTOTYP( VOID cmfdbi, (struct FDB *,
271 int, char *, char *, char *, int, int, xx_strp,
272 struct keytab *, struct FDB *) );
273 _PROTOTYP( int chktok, (char *) );
274 _PROTOTYP( int cmcfm, (void) );
275 _PROTOTYP( int lookup, (struct keytab [], char *, int, int *) );
276 _PROTOTYP( VOID kwdhelp, (struct keytab[],int,char *,char *,char *,int,int) );
277 _PROTOTYP( int ungword, (void) );
278 _PROTOTYP( VOID unungw, (void) );
279 _PROTOTYP( int cmdsquo, (int) );
280 _PROTOTYP( int cmdgquo, (void) );
281 _PROTOTYP( char * ckcvtdate, (char *, int) );
282 _PROTOTYP( int cmdgetc, (int));
284 _PROTOTYP( int cmdconchk, (void) );
285 #endif /* NOARROWKEYS */
288 _PROTOTYP( char * cmgetcmd, (char *) );
289 _PROTOTYP( VOID addcmd, (char *) );
290 _PROTOTYP( VOID cmaddnext, (void) );
291 #endif /* CK_RECALL */
292 _PROTOTYP( char * cmcvtdate, (char *, int) );
293 _PROTOTYP( char * cmdiffdate, (char *, char *) );
294 _PROTOTYP( char * cmdelta, (int,
295 int,int,int,int,int,int,int,int,int,int,int,int ));
296 _PROTOTYP( char * shuffledate, (char *, int) );
297 _PROTOTYP( int filhelp, (int, char *, char *, int, int) );
298 _PROTOTYP( int xfilhelp, (int, char *, char *, int, int,
300 char *, char *, char *, char *,
304 _PROTOTYP( int delta2sec, (char *, long *) );
307 _PROTOTYP( int cmsetup, (void) );
310 #endif /* CKUCMD_H */
312 /* End of ckucmd.h */