6 int cmdsrc() { return(0); }
9 /* C K U U S 5 -- "User Interface" for C-Kermit, part 5 */
13 Frank da Cruz <fdc@columbia.edu>,
14 The Kermit Project, Columbia University, New York City
15 Jeffrey E Altman <jaltman@secure-endpoints.com>
16 Secure Endpoints Inc., New York City
18 Copyright (C) 1985, 2011,
19 Trustees of Columbia University in the City of New York.
20 All rights reserved. See the C-Kermit COPYING.TXT file or the
21 copyright text in the ckcmai.c module for disclaimer and permissions.
32 char *line; /* Character buffer for anything */
35 char line[LINBUFSIZ+1];
36 char tmpbuf[TMPBUFSIZ+1]; /* Temporary buffer */
52 extern char * ck_cryear; /* (ckcmai.c) Latest C-Kermit copyright year */
58 #define INCL_VIO /* Needed for ckocon.h */
63 #define TAPI_CURRENT_VERSION 0x00010004
68 extern int DialerHandle;
69 extern int StartedFromDialer;
79 #define putchar(x) conoc(x)
80 extern int cursor_save ;
81 extern bool cursorena[] ;
84 /* 2010-03-09 SMS. VAX C V3.1-051 needs <stat.h> for off_t. */
89 /* For formatted screens, "more?" prompting, etc. */
92 #define isxdigit(c) isdigit(c)
95 #ifdef STRATUS /* Stratus Computer, Inc. VOS */
99 #define putchar(x) conoc(x)
103 #define getchar(x) coninc(0)
106 /* External variables */
108 extern int carrier, cdtimo, local, quiet, backgrd, bgset, sosi, xsuspend,
109 binary, escape, xargs, flow, cmdmsk, duplex, ckxech, seslog, what,
110 inserver, diractive, tlevel, cwdf, nfuncs, msgflg, remappd, hints, mdmtyp,
111 zincnt, cmask, rcflag, success, xitsta, pflag, tnlm, tn_nlm, xitwarn,
112 debses, xaskmore, parity, saveask, wasclosed, whyclosed, cdactive,
113 rcdactive, keepallchars, cmd_err;
116 extern int locus, autolocus;
124 extern int prefixing;
125 #endif /* CK_SPEED */
127 extern int g_matchdot;
130 extern int recursive;
131 #endif /* RECURSIVE */
132 extern int xfiletype;
135 extern char * iksdconf;
137 #endif /* IKSDCONF */
140 extern int on_recall;
141 #endif /* CK_RECALL */
143 extern int ngetpath, exitonclose;
144 extern char * getpath[];
145 extern CHAR * epktmsg;
147 extern char * snd_move;
148 extern char * snd_rename;
149 extern char * rcv_move;
150 extern char * rcv_rename;
151 extern char * g_snd_move;
152 extern char * g_snd_rename;
153 extern char * g_rcv_move;
154 extern char * g_rcv_rename;
159 extern char unm_mch[];
160 extern char unm_mod[];
161 extern char unm_nam[];
162 extern char unm_rel[];
163 extern char unm_ver[];
164 #endif /* CK_UTSNAME */
168 extern char editor[];
169 extern char editfile[];
170 extern char editopts[];
172 extern char browser[];
173 extern char browsopts[];
174 extern char browsurl[];
176 #endif /* NOFRILLS */
181 _PROTOTYP(VOID shorename, (void));
182 #endif /* NORENAME */
183 #endif /* NOFRILLS */
186 extern char * x_user, * x_passwd, * x_acct;
187 #endif /* NOSERVER */
191 extern char diafil[];
192 #endif /* CKLOGDIAL */
195 extern int ckrooterr;
199 extern int cfilef, xxdot, vareval;
200 extern char cmdfil[];
202 struct localvar * localhead[CMDSTKL];
203 struct localvar * localtail = NULL;
204 struct localvar * localnext = NULL;
206 _PROTOTYP( VOID shosexp, (void) );
207 _PROTOTYP( static VOID shoinput, (void) );
208 _PROTOTYP( static char gettok, (void) );
209 _PROTOTYP( static VOID factor, (void) );
210 _PROTOTYP( static VOID term, (void) );
211 _PROTOTYP( static VOID termp, (void) );
212 _PROTOTYP( static VOID exprp, (void) );
213 _PROTOTYP( static VOID expr, (void) );
214 _PROTOTYP( static VOID simple, (void) );
215 _PROTOTYP( static VOID simpler, (void) );
216 _PROTOTYP( static VOID simplest, (void) );
217 _PROTOTYP( static CK_OFF_T xparse, (void) );
220 _PROTOTYP( int sho_iks, (void) );
224 char * ckprompt = "Mac-Kermit>"; /* Default prompt for Macintosh */
225 char * ikprompt = "IKSD>";
229 char * ckprompt = "K-95> "; /* Default prompt for Win32 */
230 char * ikprompt = "IKSD> ";
232 char * ckprompt = "C-Kermit>";
233 char * ikprompt = "IKSD>";
237 /* Default prompt for OS/2 and Win32 */
239 char * ckprompt = "[\\freplace(\\flongpath(\\v(dir)),/,\\\\)] K-95> ";
240 char * ikprompt = "[\\freplace(\\flongpath(\\v(dir)),/,\\\\)] IKSD> ";
242 char * ckprompt = "[\\freplace(\\v(dir),/,\\\\)] K-95> ";
243 char * ikprompt = "[\\freplace(\\v(dir),/,\\\\)] IKSD> ";
247 char * ckprompt = "\\v(dir) C-Kermit>"; /* Default prompt VMS */
248 char * ikprompt = "\\v(dir) IKSD>";
250 char * ckprompt = "(\\v(dir)) C-Kermit>"; /* Default prompt for others */
251 char * ikprompt = "(\\v(dir)) IKSD>";
258 #define CCHMAXPATH 257
259 #endif /* CCHMAXPATH */
260 char inidir[CCHMAXPATH] = { NUL, NUL }; /* Directory INI file executed from */
263 extern int tn_b_nlm; /* TELNET BINARY newline mode */
267 extern struct keytab kverbs[]; /* Table of \Kverbs */
268 extern int nkverbs; /* Number of \Kverbs */
269 #endif /* NOKVERBS */
276 extern int cm_recall;
277 #endif /* CK_RECALL */
279 extern char *ccntab[];
283 extern char *printername;
284 extern int printpipe;
286 extern int printbidi, pportparity, pportflow;
287 extern long pportspeed;
291 _PROTOTYP (int os2getcp, (void) );
292 _PROTOTYP (int os2getcplist, (int *, int) );
295 #endif /* OS2MOUSE */
296 extern int tt_update, tt_updmode, updmode, tt_utf8;
298 extern int tt_status[];
299 #endif /* IKSDONLY */
301 extern struct keytab term_font[];
304 extern struct keytab * term_font;
307 extern int ntermfont, tt_font, tt_font_size;
308 extern unsigned char colornormal, colorunderline, colorstatus,
309 colorhelp, colorselect, colorborder, colorgraphic, colordebug,
310 colorreverse, colorcmd, coloritalic;
312 extern struct keytab prtytab[];
314 char * cmdmac = NULL;
318 _PROTOTYP (int zkermini, (char *, int, char *) );
322 extern int inecho, insilence, inbufsize, nvars, inintr;
323 extern char *protv, *fnsv, *cmdv, *userv, *ckxv, *ckzv, *ckzsys, *xlav,
328 #ifdef CK_AUTHENTICATION
329 extern char * ckathv;
330 #endif /* CK_AUTHENTICATION */
332 extern char * cksslv;
336 extern char * ckcrpv;
337 #endif /* CRYPT_DLL */
338 #endif /* CK_ENCRYPTION */
343 extern char *cksftpv;
344 #endif /* SFTP_BUILTIN */
345 #endif /* SSHBUILTIN */
352 extern char * ckftpv;
359 extern char *ckonetv;
362 extern char *ckonbiv;
363 #endif /* CK_NETBIOS */
365 extern char *ckomouv;
366 #endif /* OS2MOUSE */
378 #endif /* NOSCRIPT */
381 extern int nmdm, dirline;
382 extern struct keytab mdmtab[];
385 extern int network, nettype, ttnproto;
389 /* SET TERMINAL items... */
390 extern int tt_type, tt_arrow, tt_keypad, tt_wrap, tt_answer, tt_scrsize[];
391 extern int tt_bell, tt_roll[], tt_ctstmo, tt_cursor, tt_pacing, tt_type_mode;
392 extern char answerback[];
393 extern struct tt_info_rec tt_info[]; /* Indexed by terminal type */
398 _PROTOTYP( VOID shotrm, (void) );
399 _PROTOTYP( int shofea, (void) );
402 extern int tt_rows[], tt_cols[];
404 extern int tt_rows, tt_cols;
406 extern int cmd_rows, cmd_cols;
409 extern int f_tmpdir; /* Directory changed temporarily */
410 extern char savdir[]; /* Temporary directory */
411 #endif /* CK_TMPDIR */
414 extern int tt_crd, tt_lfd, tt_escape;
418 extern int language, nfilc, tcsr, tcsl, tcs_transp, fcharset;
419 extern struct keytab fcstab[];
420 extern struct csinfo fcsinfo[];
422 extern struct keytab ttcstab[];
429 extern int xmitf, xmitl, xmitp, xmitx, xmits, xmitw, xmitt;
430 extern char xmitbuf[];
433 extern char **xargv, *versio, *ckxsys, *dftty, *lp;
436 extern char *cmdbuf, *atmbuf; /* Command buffers */
438 extern char *savbuf; /* Command buffers */
441 extern char cmdbuf[], atmbuf[]; /* Command buffers */
443 extern char savbuf[]; /* Command buffers */
447 extern char toktab[], ttname[], psave[];
448 extern CHAR sstate, feol;
449 extern int cmflgs, techo, repars, ncmd;
450 extern struct keytab cmdtab[];
455 #define mapkey(x) keymap[x]
458 _PROTOTYP( VOID shostrdef, (CHAR *) );
459 #endif /* NOSETKEY */
464 extern struct mtab *mactab;
465 extern struct keytab mackey[];
466 extern struct keytab vartab[], fnctab[], iftab[];
467 extern int maclvl, nmac, mecho, fndiags, fnerror, fnsuccess, nif;
470 FILE *tfile[MAXTAKE]; /* TAKE file stack */
471 char *tfnam[MAXTAKE];
474 int topcmd = -1; /* cmdtab index of current command */
476 extern int dblquo; /* Doublequoting enabled */
478 #ifdef DCMDBUF /* Initialization filespec */
481 char kermrcb[KERMRCL];
482 char *kermrc = kermrcb;
486 int cm_retry = 1; /* Command retry enabled */
487 xx_strp xxstring = zzstring;
490 extern int displa, bye_active, protocol, pktlog, remfile, rempipe, unkcs,
491 keep, lf_opts, fncnv, pktpaus, autodl, xfrcan, xfrchr, xfrnum, srvtim,
492 srvdis, query, retrans, streamed, reliable, crunched, timeouts,
493 fnrpath, autopath, rpackets, spackets, epktrcvd, srvping;
496 extern int inautodl, cmdadl;
497 #endif /* CK_AUTODL */
500 extern int en_asg, en_cwd, en_cpy, en_del, en_dir, en_fin, en_bye, en_ret,
501 en_get, en_hos, en_que, en_ren, en_sen, en_set, en_spa, en_typ, en_who,
502 en_mai, en_pri, en_mkd, en_rmd, en_xit, en_ena;
503 #endif /* NOSERVER */
506 atenci, atenco, atdati, atdato, atleni, atleno, atblki, atblko,
507 attypi, attypo, atsidi, atsido, atsysi, atsyso, atdisi, atdiso;
510 extern int atfrmi, atfrmo, atcrei, atcreo, atacti, atacto;
514 extern int atlpri, atlpro, atgpri, atgpro;
515 #endif /* CK_PERMS */
518 extern char * anonfile; /* Anonymous login init file */
519 extern char * anonroot; /* Anonymous file-system root */
520 extern char * userfile; /* Forbidden user file */
521 extern int isguest; /* Flag for anonymous user */
522 #endif /* CK_LOGIN */
533 char * prstring[CMDSTKL];
537 extern long ck_alarm;
538 extern char alrm_date[], alrm_time[];
540 /* Local declarations */
542 static int nulcmd = 0; /* Flag for next cmd to be ignored */
544 /* Definitions for predefined macros */
546 /* First, the single-line macros, installed with addmac()... */
548 /* IBM-LINEMODE macro */
549 char *m_ibm = "set parity mark, set dupl half, set handsh xon, set flow none";
552 char *m_fat = "if def \\%1 echo \\%1, if not = \\v(local) 0 hangup, stop 1";
556 char *m_fast = "set win 30, set rec pack 4000, set prefix cautious";
559 /* Because of bug in telnet server */
560 char *m_fast = "set window 30, set rec pack 4000, set send pack 4000,\
564 char *m_fast = "set win 3, set rec pack 1024, set prefix cautious";
567 char *m_fast = "set win 30, set rec pack 4000, set prefix cautious";
569 char *m_fast = "set win 4, set rec pack 2200, set prefix cautious";
570 #endif /* BIGBUFOK */
575 char *m_cautious = "set win 2, set rec pack 512, set prefixing cautious";
577 char *m_cautious = "set win 4, set rec pack 1000, set prefixing cautious";
579 char *m_robust = "set win 1, set rec pack 90, set prefixing all, \
580 set reliable off, set clearchannel off";
584 char *m_fast = "set win 30, set rec pack 4000";
587 char *m_fast = "set win 30, set rec pack 4000, set send pack 4000";
589 char *m_fast = "set win 30, set rec pack 4000";
592 #else /* Not BIGBUFOK */
593 char *m_fast = "set win 4, set rec pack 2200";
594 #endif /* BIGBUFOK */
595 char *m_cautious = "set win 4, set rec pack 1000";
596 char *m_robust = "set win 1, set rec pack 90, set reliable off";
597 #endif /* CK_SPEED */
600 char *m_purge = "run purge \\%*";
604 char *m_manual = "browse \\v(exedir)docs/manual/kermit95.htm";
607 /* Now the multiline macros, defined with addmmac()... */
609 /* FOR macro for \%i-style loop variables (see dofor()...) */
611 char *for_def[] = { "_assign _for\\v(cmdlevel) { _getargs,",
612 "def \\\\\\%1 \\feval(\\%2),:_..top,if \\%5 \\\\\\%1 \\%3 goto _..bot,",
613 "\\%6,:_..inc,incr \\\\\\%1 \\%4,goto _..top,:_..bot,_putargs},",
614 "def break goto _..bot, def continue goto _..inc,",
615 "do _for\\v(cmdlevel) \\%1 \\%2 \\%3 \\%4 { \\%5 },_assign _for\\v(cmdlevel)",
618 /* This is the FOR macro when the loop variable is itself a macro */
620 char *foz_def[] = { "_assign _for\\v(cmdlevel) { _getargs,",
621 "def \\%1 \\feval(\\%2),:_..top,if \\%5 \\%1 \\%3 goto _..bot,",
622 "\\%6,:_..inc,incr \\%1 \\%4,goto _..top,:_..bot,_putargs},",
623 "def break goto _..bot, def continue goto _..inc,",
624 "do _for\\v(cmdlevel) \\%1 \\%2 \\%3 \\%4 { \\%5 },_assign _for\\v(cmdlevel)",
628 char *whil_def[] = { "_assign _whi\\v(cmdlevel) {_getargs,",
629 ":_..inc,\\%1,\\%2,goto _..inc,:_..bot,_putargs},",
630 "_def break goto _..bot, _def continue goto _..inc,",
631 "do _whi\\v(cmdlevel),_assign _whi\\v(cmdlevel)",
635 char *sw_def[] = { "_assign _sw_\\v(cmdlevel) {_getargs,",
636 "_forward {\\%1},\\%2,:default,:_..bot,_putargs},_def break goto _..bot,",
637 "do _sw_\\v(cmdlevel),_assign _sw_\\v(cmdlevel)",
642 "_assign _if\\v(cmdlevel) {_getargs,\\%1,_putargs},",
643 "do _if\\v(cmdlevel),_assign _if\\v(cmdlevel)",
647 Variables declared here for use by other ckuus*.c modules.
648 Space is allocated here to save room in ckuusr.c.
651 struct cmdptr *cmdstk;
661 struct cmdptr cmdstk[CMDSTKL];
662 int ifcmd[CMDSTKL], count[CMDSTKL], iftest[CMDSTKL], intime[CMDSTKL],
663 inpcas[CMDSTKL], takerr[CMDSTKL], merror[CMDSTKL];
669 char *topline = NULL; /* Program invocation arg line */
670 char *m_line[MACLEVEL] = { NULL, NULL }; /* Stack of macro invocation lines */
673 char **m_xarg[MACLEVEL]; /* Pointers to arg vector arrays */
674 int n_xarg[MACLEVEL]; /* Sizes of arg vector arrays */
675 char *m_arg[MACLEVEL][NARGS]; /* Args of each level */
676 int macargc[MACLEVEL]; /* Argc of each level */
677 char *macp[MACLEVEL]; /* Current position in each macro */
678 char *macx[MACLEVEL]; /* Beginning of each macro def */
679 char *mrval[MACLEVEL]; /* RETURN value at each level */
680 int lastcmd[MACLEVEL]; /* Last command at each level */
681 int topargc = 0; /* Argc at top level */
682 char **topxarg = NULL; /* Argv at top level */
683 char *toparg[MAXARGLIST+2];
685 /* Global Variables */
687 char *g_var[GVARS+1]; /* Global \%a..z pointers */
688 extern char varnam[]; /* \%x variable name buffer */
690 /* Arrays -- Dimension must be 'z' - ARRAYBASE + 1 */
691 /* Note: a_link[x] < 0 means no link; >= 0 is a link */
693 char **a_ptr[32]; /* Array pointers, for arrays a-z */
694 int a_dim[32]; /* Dimensions for each array */
695 int a_link[32]; /* Link (index of linked-to-array) */
697 char **aa_ptr[CMDSTKL][32]; /* Array stack for automatic arrays */
698 int aa_dim[CMDSTKL][32]; /* Dimensions for each array */
700 /* INPUT command buffers and variables */
702 char * inpbuf = NULL; /* Buffer for INPUT and REINPUT */
703 extern char * inpbp; /* Global/static pointer to it */
704 char inchar[2] = { NUL, NUL }; /* Last character that was INPUT */
705 int incount = 0; /* INPUT character count */
706 extern int instatus; /* INPUT status */
707 static char * i_text[] = { /* INPUT status text */
708 "success", "timeout", "interrupted", "internal error", "i/o error"
711 char lblbuf[LBLSIZ]; /* Buffer for labels */
718 static char *prevdir = NULL;
720 int pacing = 0; /* OUTPUT pacing */
722 char *tp; /* Temporary buffer pointer */
724 int timelimit = 0, asktimer = 0; /* Timers for time-limited commands */
726 #ifdef CK_APC /* Application Program Command (APC) */
727 int apcactive = APC_INACTIVE;
728 int apcstatus = APC_OFF; /* OFF by default everywhere */
732 char apcbuf[APCBUFLEN];
736 extern char pktfil[],
746 extern int rmailf, rprintf; /* REMOTE MAIL & PRINT items */
747 extern char optbuf[];
748 #endif /* NOFRILLS */
750 extern int noinit; /* Flat to skip init file */
753 static struct keytab kcdtab[] = { /* Symbolic directory names */
755 { "appdata", VN_APPDATA, 0 },
756 { "common", VN_COMMON, 0 },
757 { "desktop", VN_DESKTOP, 0 },
759 { "download", VN_DLDIR, 0 },
761 { "exedir", VN_EXEDIR, 0 },
762 #endif /* OS2ORUNIX */
763 { "home", VN_HOME, 0 },
764 { "inidir", VN_INI, 0 },
766 { "lockdir", VN_LCKDIR, 0 },
769 { "my_documents",VN_PERSONAL, 0 },
770 { "personal", VN_PERSONAL, CM_INV },
772 { "startup", VN_STAR, 0 },
773 { "textdir", VN_TXTDIR, 0 },
774 { "tmpdir", VN_TEMP, 0 }
776 static int nkcdtab = (sizeof(kcdtab) / sizeof(struct keytab));
780 _PROTOTYP( VOID freelocal, (int) );
781 _PROTOTYP( static CK_OFF_T expon, (CK_OFF_T, CK_OFF_T) );
782 _PROTOTYP( static CK_OFF_T gcd, (CK_OFF_T, CK_OFF_T) );
783 _PROTOTYP( static CK_OFF_T fact, (CK_OFF_T) );
785 int /* Initialize macro data structures. */
786 macini() { /* Allocate mactab and preset the first element. */
788 if (!(mactab = (struct mtab *) malloc(sizeof(struct mtab) * MAC_MAX)))
790 mactab[0].kwd = NULL;
791 mactab[0].mval = NULL;
793 for (i = 0; i < MACLEVEL; i++)
799 /* C M D S R C -- Returns current command source */
801 /* 0 = top level, 1 = file, 2 = macro, -1 = error (shouldn't happen) */
804 As of 19 Aug 2000 this routine is obsolete. The scalar global variable
805 xcmdsrc can be checked instead to save the overhead of a function call.
815 else if (cmdstk[cmdlvl].src == CMD_MD)
817 else if (cmdstk[cmdlvl].src == CMD_TF)
830 /* C M D I N I -- Initialize the interactive command parser */
832 static int cmdinited = 0; /* Command parser initialized */
833 extern int cmdint; /* Interrupts are allowed */
835 int cmdadl = 1; /* Autodownload */
838 #endif /* CK_AUTODL */
840 char * k_info_dir = NULL; /* Where to find text files */
842 static char * txtdir[] = {
843 "/usr/local/doc/", /* Linux, SunOS, ... */
844 "/usr/share/lib/", /* HP-UX 10.xx... */
845 "/usr/share/doc/", /* Other possibilities... */
846 "/usr/local/lib/", /* NOTE: Each of these is tried */
847 "/usr/local/share/", /* as is, and also with a kermit */
848 "/usr/local/share/doc/", /* subdirectory. */
849 "/usr/local/share/lib/",
850 "/opt/kermit/", /* Solaris */
860 lookup() cache to speed up script execution.
862 This is a static cache. Items are stored in decreasing frequency of
863 reference based on statistics from a range of scripts. This gives
864 better performance than a dynamic cache, which would require a lot more
865 code and also would require system-dependent elements including system
866 calls (e.g. to get subsecond times for entry aging).
868 #ifdef USE_LUCACHE /* Set in ckuusr.h */
869 #define LUCACHE 32 /* Change this to reduce cache size */
871 char * lucmd[LUCACHE];
874 struct keytab * lutab[LUCACHE];
875 #endif /* USE_LUCACHE */
878 luinit() { /* Initialize lookup() cache */
882 x = lookup(cmdtab,"if",ncmd,&y);
883 lucmd[lusize] = "if";
886 lutab[lusize] = cmdtab;
887 if (++lusize > LUCACHE) return;
889 x = lookup(iftab,"not",nif,&y);
890 lucmd[lusize] = "not";
893 lutab[lusize] = iftab;
894 if (++lusize > LUCACHE) return;
896 x = lookup(vartab,"cmdlevel",nvars,&y);
897 lucmd[lusize] = "cmdlevel";
900 lutab[lusize] = vartab;
901 if (++lusize > LUCACHE) return;
903 x = lookup(cmdtab,"goto",ncmd,&y);
904 lucmd[lusize] = "goto";
907 lutab[lusize] = cmdtab;
908 if (++lusize > LUCACHE) return;
910 x = lookup(iftab,">",nif,&y);
914 lutab[lusize] = iftab;
915 if (++lusize > LUCACHE) return;
917 x = lookup(cmdtab,"incr",ncmd,&y);
918 lucmd[lusize] = "incr";
921 lutab[lusize] = cmdtab;
922 if (++lusize > LUCACHE) return;
924 x = lookup(cmdtab,"def",ncmd,&y);
925 lucmd[lusize] = "def";
928 lutab[lusize] = cmdtab;
929 if (++lusize > LUCACHE) return;
931 x = lookup(cmdtab,"_assign",ncmd,&y);
932 lucmd[lusize] = "_assign";
935 lutab[lusize] = cmdtab;
936 if (++lusize > LUCACHE) return;
938 x = lookup(cmdtab,"echo",ncmd,&y);
939 lucmd[lusize] = "echo";
942 lutab[lusize] = cmdtab;
943 if (++lusize > LUCACHE) return;
945 x = lookup(fnctab,"eval",nfuncs,&y);
946 lucmd[lusize] = "eval";
949 lutab[lusize] = fnctab;
950 if (++lusize > LUCACHE) return;
952 x = lookup(fnctab,"lit",nfuncs,&y);
953 lucmd[lusize] = "lit";
956 lutab[lusize] = fnctab;
957 if (++lusize > LUCACHE) return;
959 x = lookup(cmdtab,"do",ncmd,&y);
960 lucmd[lusize] = "do";
963 lutab[lusize] = cmdtab;
964 if (++lusize > LUCACHE) return;
966 x = lookup(cmdtab,"_getargs",ncmd,&y);
967 lucmd[lusize] = "_getargs";
970 lutab[lusize] = cmdtab;
971 if (++lusize > LUCACHE) return;
973 x = lookup(iftab,"<",nif,&y);
977 lutab[lusize] = iftab;
978 if (++lusize > LUCACHE) return;
980 x = lookup(cmdtab,"_putargs",ncmd,&y);
981 lucmd[lusize] = "_putargs";
984 lutab[lusize] = cmdtab;
985 if (++lusize > LUCACHE) return;
987 x = lookup(cmdtab,"asg",ncmd,&y);
988 lucmd[lusize] = "asg";
991 lutab[lusize] = cmdtab;
992 if (++lusize > LUCACHE) return;
994 x = lookup(cmdtab,"else",ncmd,&y);
995 lucmd[lusize] = "else";
998 lutab[lusize] = cmdtab;
999 #endif /* USE_LUCACHE */
1004 int i = 0, x = 0, y = 0, z = 0, skip = 0;
1009 extern struct keytab * spdtab;
1010 #endif /* TTSPDLIST */
1014 On stack to allow recursion!
1016 char vnambuf[VNAML]; /* Buffer for variable names */
1019 if (cmdinited) /* Already initialized */
1020 return; /* Don't do it again */
1022 for (i = 0; i < CMDSTKL; i++) /* Prompt strings for each */
1023 prstring[i] = NULL; /* command level */
1026 p = getenv("K_CHARSET"); /* Set default file character set */
1027 if (p) { /* from environment */
1028 x = lookup(fcstab,p,nfilc,&y);
1032 #endif /* NOCSETS */
1034 p = getenv("K_INFO_DIRECTORY"); /* Find Kermit info directory */
1035 if (p && *p && strlen(p) <= CKMAXPATH)
1036 makestr(&k_info_dir,p);
1038 p = getenv("K_INFO_DIR");
1039 if (p && *p && strlen(p) <= CKMAXPATH)
1040 makestr(&k_info_dir,p);
1043 if (k_info_dir) { /* Look for Kermit docs directory */
1044 if (zchki(k_info_dir) == -2) {
1045 char xbuf[CKMAXPATH+32], *s = "";
1046 if (ckrchar(k_info_dir) != '/')
1048 ckmakmsg(xbuf,CKMAXPATH+32,k_info_dir,s,"ckubwr.txt",NULL);
1049 if (zchki(xbuf) < 0)
1050 makestr(&k_info_dir,NULL);
1054 char xbuf[CKMAXPATH+32];
1056 for (i = 0; *(txtdir[i]); i++) {
1057 ckmakmsg(xbuf,CKMAXPATH+32,txtdir[i],"ckubwr.txt",NULL,NULL);
1058 if (zchki(xbuf) > 0) {
1059 makestr(&k_info_dir,txtdir[i]);
1060 debug(F110,"k_info_dir 1",k_info_dir,0);
1063 ckmakmsg(xbuf,CKMAXPATH+32,
1064 txtdir[i],"kermit/","ckubwr.txt",NULL);
1065 if (zchki(xbuf) > 0) {
1066 ckmakmsg(xbuf,CKMAXPATH+32,txtdir[i],"kermit/",NULL,NULL);
1067 makestr(&k_info_dir,xbuf);
1068 debug(F110,"k_info_dir 2",k_info_dir,0);
1071 ckmakmsg(xbuf,CKMAXPATH+32,
1072 txtdir[i],"ckermit/","ckubwr.txt",NULL);
1073 if (zchki(xbuf) > 0) {
1074 ckmakmsg(xbuf,CKMAXPATH+32,txtdir[i],"ckermit/",NULL,NULL);
1075 makestr(&k_info_dir,xbuf);
1076 debug(F110,"k_info_dir 3",k_info_dir,0);
1080 if (k_info_dir) { /* Make sure it ends with "/" */
1081 if (ckrchar(k_info_dir) != '/') {
1082 char xbuf[CKMAXPATH+32];
1083 ckmakmsg(xbuf,CKMAXPATH+32,k_info_dir,"/",NULL,NULL);
1084 makestr(&k_info_dir,xbuf);
1091 char xdir[CKMAXPATH+8], *s = "";
1092 extern char startupdir[];
1094 if (ckrchar(startupdir) != '/')
1096 if (strlen(s) + strlen(startupdir) + 5 < CKMAXPATH + 8 )
1097 ckmakmsg(xdir,CKMAXPATH+8,s,startupdir,"DOC/",NULL);
1098 makestr(&k_info_dir,xdir);
1104 if (!spdtab && (ss = ttspdlist())) { /* Get speed list if necessary */
1105 int j, k, m = 0, n; /* Create sorted keyword table */
1109 (struct keytab *) malloc(sizeof(struct keytab) * ss[0]))) {
1110 for (i = 1; i <= ss[0]; i++) { /* ss[0] = number of elements */
1111 if (ss[i] < 1L) break; /* Shouldn't happen */
1112 buf[0] = NUL; /* Make string */
1113 sprintf(buf,"%ld",ss[i]); /* SAFE */
1115 ckstrncpy(buf,"75/1200",sizeof(buf));
1117 ckstrncat(buf,".5",16);
1119 if ((n > 0) && (p = (char *)malloc(n+1))) {
1120 if (m > 0) { /* Have at least one in list */
1121 for (j = 0; /* Find slot */
1122 j < m && strcmp(buf,spdtab[j].kwd) > 0;
1126 if (j < m) { /* Must insert */
1127 for (k = m-1; k >= j; k--) { /* Move others down */
1128 spdtab[k+1].kwd = spdtab[k].kwd;
1129 spdtab[k+1].flgs = spdtab[k].flgs;
1130 spdtab[k+1].kwval = spdtab[k].kwval;
1133 } else /* First one */
1135 ckstrncpy(p,buf,n+1); /* Add new speed */
1138 spdtab[j].kwval = (int) ss[i] / 10;
1139 m++; /* Count this one */
1145 #endif /* TTSPDLIST */
1148 /* Allocate INPUT command buffer */
1150 if (!(inpbuf = (char *) malloc(INPBUFSIZ+8)))
1151 fatal("cmdini: no memory for INPUT buffer");
1153 for (x = 0; x < INPBUFSIZ; x++) /* Initialize it */
1155 inpbp = inpbuf; /* Initialize pointer */
1156 inbufsize = INPBUFSIZ; /* and size. */
1160 if (cmsetup() < 0) fatal("Can't allocate command buffers!");
1163 /* Allocate command stack allowing command parser to call itself */
1165 if (!(cmdstk = (struct cmdptr *) malloc(sizeof(struct cmdptr)*CMDSTKL)))
1166 fatal("cmdini: no memory for cmdstk");
1167 if (!(ifcmd = (int *) malloc(sizeof(int)*CMDSTKL)))
1168 fatal("cmdini: no memory for ifcmd");
1169 if (!(count = (int *) malloc(sizeof(int)*CMDSTKL)))
1170 fatal("cmdini: no memory for count");
1171 if (!(iftest = (int *) malloc(sizeof(int)*CMDSTKL)))
1172 fatal("cmdini: no memory for iftest");
1173 if (!(intime = (int *) malloc(sizeof(int)*CMDSTKL)))
1174 fatal("cmdini: no memory for intime");
1175 if (!(inpcas = (int *) malloc(sizeof(int)*CMDSTKL)))
1176 fatal("cmdini: no memory for inpcas");
1177 if (!(takerr = (int *) malloc(sizeof(int)*CMDSTKL)))
1178 fatal("cmdini: no memory for takerr");
1179 if (!(merror = (int *) malloc(sizeof(int)*CMDSTKL)))
1180 fatal("cmdini: no memory for merror");
1181 if (!(xquiet = (int *) malloc(sizeof(int)*CMDSTKL)))
1182 fatal("cmdini: no memory for xquiet");
1183 if (!(xvarev = (int *) malloc(sizeof(int)*CMDSTKL)))
1184 fatal("cmdini: no memory for xvarev");
1186 if (!(kermrc = (char *) malloc(KERMRCL+1)))
1187 fatal("cmdini: no memory for kermrc");
1189 /* Application Program Command buffer */
1190 if (!(apcbuf = malloc(APCBUFLEN + 1)))
1191 fatal("cmdini: no memory for apcbuf");
1195 /* line[] and tmpbuf[] are the two string buffers used by the command parser */
1197 if (!(line = malloc(LINBUFSIZ + 1)))
1198 fatal("cmdini: no memory for line");
1199 if (!(tmpbuf = malloc(LINBUFSIZ + 1)))
1200 fatal("cmdini: no memory for tmpbuf");
1201 #endif /* DCMDBUF */
1205 { /* Initialize MINPUT pointers */
1208 for (i = 0; i < MINPMAX; i++)
1211 #endif /* CK_MINPUT */
1213 if (macini() < 0) /* Allocate macro buffers */
1214 fatal("Can't allocate macro buffers!");
1216 ifcmd[0] = 0; /* Command-level related variables. */
1217 iftest[0] = 0; /* Initialize variables at top level */
1218 count[0] = 0; /* of stack... */
1224 xvarev[0] = vareval;
1228 cmdlvl = 0; /* Initialize the command stack */
1230 cmdstk[cmdlvl].src = CMD_KB; /* Source is console */
1231 cmdstk[cmdlvl].lvl = 0; /* Level is 0 */
1232 cmdstk[cmdlvl].ccflgs = 0; /* No flags */
1235 tlevel = -1; /* Take file level = keyboard */
1236 for (i = 0; i < MAXTAKE; i++) /* Initialize command file names */
1239 cmsetp(ckprompt); /* Set up C-Kermit's prompt */
1240 /* Can't set IKSD prompt here since */
1241 /* we do not yet know if we are IKSD */
1244 initmac(); /* Initialize macro table */
1246 /* Predefine built-in one-line macros */
1248 addmac("ibm-linemode",m_ibm); /* IBM-LINEMODE */
1249 addmac("fatal",m_fat); /* FATAL macro */
1250 y = addmac("fast",m_fast); /* FAST macro */
1251 addmac("cautious",m_cautious); /* CAUTIOUS macro */
1252 addmac("robust",m_robust); /* ROBUST macro */
1254 addmac("manual",m_manual); /* MANUAL macro */
1257 addmac("purge",m_purge); /* PURGE macro */
1261 Predefine built-in multiline macros; these are top-level commands
1262 that are implemented internally as macros. NOTE: When adding a new
1263 one of these, remember to update the END and RETURN commands to
1264 account for it, or else END and RETURN from within it won't work right.
1266 x = addmmac("_forx",for_def); /* FOR macro */
1267 if (x > -1) mactab[x].flgs = CM_INV;
1268 x = addmmac("_forz",foz_def); /* Other FOR macro */
1269 if (x > -1) mactab[x].flgs = CM_INV;
1270 x = addmmac("_xif",xif_def); /* XIF macro */
1271 if (x > -1) mactab[x].flgs = CM_INV;
1272 x = addmmac("_while",whil_def); /* WHILE macro */
1273 if (x > -1) mactab[x].flgs = CM_INV;
1274 x = addmmac("_switx",sw_def); /* SWITCH macro */
1275 if (x > -1) mactab[x].flgs = CM_INV;
1277 /* Fill in command-line argument vector */
1279 sprintf(vnambuf,"\\&@[%d]",xargs); /* SAFE */
1280 if (inserver) { /* But hidden in IKSD */
1284 y = arraynam(vnambuf,&x,&z); /* goes in array \&@[] */
1290 dclarray((char)x,z); /* Declare the array */
1292 /* Macro argument vector */
1293 sprintf(vnambuf,"\\&_[%d]",z); /* SAFE */
1294 yy = arraynam(vnambuf,&x,&z); /* goes in array \&_[] */
1295 if (yy > -1) /* Name is OK */
1296 dclarray((char)x,z); /* Declare the array */
1297 #endif /* NOTAKEARGS */
1299 for (i = 0; i < xargs; i++) { /* Fill the arrays */
1300 sprintf(vnambuf,"\\&@[%d]",i); /* SAFE */
1301 addmac(vnambuf,xargv[i]);
1302 if (cfilef && i == 0)
1310 #endif /* KERBANG */
1311 if (j < 0 && /* Assign items after "=" or "--"*/
1312 (!strcmp(xargv[i],"=") || !strcmp(xargv[i],"--"))
1314 j = 0; /* to \%1..\%9 */
1317 (!strcmp(xargv[i],"+") ||
1318 !strncmp(xargv[i],"+ ",2) ||
1319 !strncmp(xargv[i],"+\t",2))
1323 #endif /* KERBANG */
1324 } else if (j > -1) {
1329 vnambuf[2] = (char)(j+'0');
1331 addmac(vnambuf,xargv[i]);
1337 makestr(&(toparg[j]),p);
1338 while ((c = *p++)) { if (c == SP) { flag++; break; } }
1340 ckstrncat(tmpbuf,"\"",TMPBUFSIZ);
1341 ckstrncat(tmpbuf,xargv[i],TMPBUFSIZ);
1343 ckstrncat(tmpbuf,"\"",TMPBUFSIZ);
1344 ckstrncat(tmpbuf," ",TMPBUFSIZ);
1349 addmac("\\%0",cmdfil);
1351 makestr(&(toparg[0]),cmdfil);
1353 addmac("\\%0",xargv[0]);
1355 makestr(&(toparg[0]),xargv[0]);
1358 topargc = (j < 0) ? 1 : j + 1;
1361 /* This needs work */
1363 makestr(&topline,tmpbuf);
1364 #endif /* COMMENT */
1369 a_dim[0] = topargc - 1;
1371 debug(F111,"a_dim[0]","A",a_dim[0]);
1376 luinit(); /* Initialize lookup() cache */
1378 /* Get our home directory now. This needed in lots of places. */
1384 _PROTOTYP(char * GetAppData,(int));
1390 extern int ckrooterr;
1401 return; /* Mac Kermit has no init file */
1405 /* If skipping init file ('-Y' on Kermit command line), return now. */
1411 But returning from here results in inidir[] never being set to anything.
1412 Instead it should be set to wherever the init file *would* have been
1413 executed from. So this bit of code should be removed, and then we should
1414 sprinkle "if (noinit)" tests throughout the following code until we have
1415 set inidir[], and then return without actually taking the init file.
1422 The -y init file must be fully specified or in the current directory.
1423 KERMRC is looked for via INIT, DPATH and PATH in that order. Finally, our
1424 own executable file path is taken and the .EXE suffix is replaced by .INI
1425 and this is tried as the initialization file.
1428 debug(F101,"doinit inserver","",inserver);
1429 debug(F101,"doinit isguest","",isguest);
1430 debug(F110,"doinit anonfile",anonfile,0);
1432 if (isguest && anonfile) {
1433 ckstrncpy(line, anonfile, LINBUFSIZ+1);
1435 #endif /* CK_LOGIN */
1437 ckstrncpy(line,kermrc,LINBUFSIZ+1);
1439 } else if (inserver) {
1440 char * appdata = NULL;
1442 appdata = GetAppData(1);
1444 ckmakmsg(line,LINBUFSIZ+1,appdata,
1445 "Kermit 95/k95.ini",NULL,NULL);
1446 if ( zchki(line) < 0 )
1450 appdata = GetAppData(0);
1452 ckmakmsg(line,LINBUFSIZ+1,appdata,
1453 "Kermit 95/k95.ini",NULL,NULL);
1454 if ( zchki(line) < 0 )
1462 ckmakmsg(line,LINBUFSIZ+1,appdata,
1469 if ( zchki(line) < 0 )
1473 debug(F110,"doinit inserver inifile",line,0);
1474 #endif /* CK_LOGIN */
1478 env = getenv("K95.KSC");
1480 env = getenv("K2.KSC");
1484 env = getenv("K95.INI");
1486 env = getenv("K2.INI");
1490 env = getenv("CKERMIT.INI");
1492 env = getenv("CKERMIT_INI");
1495 debug(F110,"doinit env",env,0);
1497 ckstrncpy(line,env,LINBUFSIZ+1);
1501 env = GetAppData(1);
1503 ckmakmsg(line,LINBUFSIZ+1,env,"Kermit 95/k95.ini",NULL,NULL);
1504 if ( zchki(line) < 0 )
1509 env = GetAppData(0);
1511 ckmakmsg(line,LINBUFSIZ+1,env,"Kermit 95/k95.ini",NULL,NULL);
1512 if ( zchki(line) < 0 )
1521 ckmakmsg(line,LINBUFSIZ+1,env,
1528 if ( zchki(line) < 0 )
1534 _searchenv(kermrc,"INIT",line);
1536 _searchenv(kermrc,"DPATH",line);
1538 _searchenv(kermrc,"PATH",line);
1540 char *pgmptr = GetLoadPath();
1541 if (pgmptr && strlen(pgmptr) < LINBUFSIZ-8) {
1542 lp = strrchr(pgmptr, '\\');
1544 strncpy(line, pgmptr, lp - pgmptr);
1546 strcpy(line + (lp - pgmptr), "/k95.ini");
1548 strcpy(line + (lp - pgmptr), "/k2.ini");
1551 lp = strrchr(pgmptr, '.');
1553 strncpy(line, pgmptr, lp - pgmptr);
1554 strcpy(line + (lp - pgmptr), ".ini");
1562 if (!zinroot(line)) {
1563 debug(F110,"doinit setroot violation",line,0);
1568 debug(F110,"doinit fopen()",line,0);
1569 if ((tfile[0] = fopen(line,"r")) != NULL) {
1573 if (tfnam[tlevel] = malloc(strlen(line)+1))
1574 strcpy(tfnam[tlevel],line); /* safe */
1578 cmdstk[cmdlvl].src = CMD_TF;
1579 cmdstk[cmdlvl].lvl = tlevel;
1580 cmdstk[cmdlvl].ccflgs = 0;
1583 count[cmdlvl] = count[cmdlvl-1]; /* Inherit from previous level */
1584 intime[cmdlvl] = intime[cmdlvl-1];
1585 inpcas[cmdlvl] = inpcas[cmdlvl-1];
1586 takerr[cmdlvl] = takerr[cmdlvl-1];
1587 merror[cmdlvl] = merror[cmdlvl-1];
1588 xquiet[cmdlvl] = quiet;
1589 xvarev[cmdlvl] = vareval;
1591 debug(F110,"doinit init file",line,0);
1593 debug(F100,"doinit no init file","",0);
1595 ckstrncpy(kermrc,line,KERMRCL);
1596 for (ptr = kermrc; *ptr; ptr++) /* Convert backslashes to slashes */
1602 debug(F101,"doinit rcflag","",rcflag);
1604 zkermini(line, rcflag, kermrc);
1609 x = zkermini(line,LINBUFSIZ,kermrc);
1610 debug(F111,"CUSTOM zkermini",line,x);
1616 debug(F101,"doinit isguest","",isguest);
1618 ckstrncpy(lp, anonfile ? anonfile : kermrc, LINBUFSIZ);
1620 #endif /* CK_LOGIN */
1621 if (rcflag) { /* If init file name from cmd line */
1622 ckstrncpy(lp,kermrc,LINBUFSIZ); /* use it, */
1623 } else { /* otherwise... */
1624 #ifdef CK_INI_A /* If we've a system-wide init file */
1625 /* And it takes precedence over the user's... */
1626 ckstrncpy(lp,CK_SYSINI,KERMRCL); /* Use it */
1627 if (zchki(lp) < 0) { /* (if it exists...) */
1628 #endif /* CK_INI_A */
1633 /* Add support for environment variable */
1634 env = getenv("CKERMIT.INI");
1636 env = getenv("CKERMIT_INI");
1638 ckstrncpy(lp,env,KERMRCL);
1642 if (homdir) { /* Home directory for init file. */
1643 ckstrncpy(lp,homdir,KERMRCL);
1645 ckstrncat(lp,">",KERMRCL);/* VOS dirsep */
1647 if (lp[0] == '/') ckstrncat(lp,"/",KERMRCL);
1648 #endif /* STRATUS */
1650 ckstrncat(lp,kermrc,KERMRCL);/* Append default file name */
1654 #endif /* CK_INI_A */
1655 #ifdef CK_INI_B /* System-wide init defined? */
1656 /* But user's ini file takes precedence */
1657 if (zchki(lp) < 0) /* If user doesn't have her own, */
1658 ckstrncpy(lp,CK_SYSINI,KERMRCL); /* use system-wide one. */
1659 #endif /* CK_INI_B */
1665 reqoff(); /* Disable requestors */
1669 /* If no init file was found, execute the customization file */
1670 debug(F111,"CUSTOM 1",line,rcflag);
1671 if ((!line[0] || zchki(line) < 0) && !rcflag) {
1674 x = ckmakestr(line,LINBUFSIZ,GetAppData(1),"/","K95CUSTOM.INI",NULL);
1675 debug(F111,"CUSTOM 2",line,x);
1676 if (zchki(line) < 0) {
1677 x = ckmakestr(line,LINBUFSIZ,GetAppData(0),"/","K95USER.INI",NULL);
1678 debug(F111,"CUSTOM 3",line,x);
1681 x = ckstrncpy(line,zhome(),LINBUFSIZ);
1683 /* VMS zhome() returns "SYS$LOGIN:" */
1684 if (line[x-1] != DIRSEP) {
1689 x = ckstrncat(line,MYCUSTOM,LINBUFSIZ);
1690 debug(F111,"CUSTOM 4",line,x);
1693 debug(F110,"CUSTOM 5",line,0);
1694 #endif /* USE_CUSTOM */
1697 if (!zinroot(line)) {
1698 debug(F110,"doinit setroot violation",line,0);
1703 debug(F110,"doinit ini file is",line,0);
1704 if ((tfile[0] = fopen(line,"r")) != NULL) { /* Try to open init file. */
1708 if ((tfnam[tlevel] = malloc(strlen(line)+1)))
1709 strcpy(tfnam[tlevel],line); /* safe */
1711 ckstrncpy(kermrc,line,KERMRCL);
1717 count[cmdlvl] = count[cmdlvl-1]; /* Inherit from previous level */
1718 intime[cmdlvl] = intime[cmdlvl-1];
1719 inpcas[cmdlvl] = inpcas[cmdlvl-1];
1720 takerr[cmdlvl] = takerr[cmdlvl-1];
1721 merror[cmdlvl] = merror[cmdlvl-1];
1722 xquiet[cmdlvl] = quiet;
1723 xvarev[cmdlvl] = vareval;
1724 debug(F101,"doinit open ok","",cmdlvl);
1726 cmdstk[cmdlvl].src = CMD_TF;
1727 cmdstk[cmdlvl].lvl = tlevel;
1728 cmdstk[cmdlvl].ccflgs = 0;
1730 } else if (rcflag) {
1731 /* Print an error message only if a specific file was asked for. */
1732 printf("?%s - %s\n", ck_errstr(), line);
1736 /* If CKERMIT.INI not found in home directory, look in searchlist */
1737 if (/* homdir && */ (tlevel < 0)) {
1738 ckstrncpy(lp,kermrc,LINBUFSIZ);
1739 if ((tfile[0] = fopen(line,"r")) != NULL) {
1743 if (tfnam[tlevel] = malloc(strlen(line)+1))
1744 strcpy(tfnam[tlevel],line); /* safe */
1748 cmdstk[cmdlvl].src = CMD_TF;
1749 cmdstk[cmdlvl].lvl = tlevel;
1750 cmdstk[cmdlvl].ccflgs = 0;
1753 count[cmdlvl] = count[cmdlvl-1]; /* Inherit from previous level */
1754 intime[cmdlvl] = intime[cmdlvl-1];
1755 inpcas[cmdlvl] = inpcas[cmdlvl-1];
1756 takerr[cmdlvl] = takerr[cmdlvl-1];
1757 merror[cmdlvl] = merror[cmdlvl-1];
1758 xquiet[cmdlvl] = quiet;
1759 xvarev[cmdlvl] = vareval;
1763 #endif /* datageneral */
1765 #ifdef AMIGA /* Amiga... */
1766 reqpop(); /* Restore requestors */
1771 /* Assign value to inidir */
1776 ckstrncpy(inidir, kermrc, CCHMAXPATH);
1780 for (i = x - 1; i > 0; i-- ) {
1781 if (ISDIRSEP(inidir[i])) {
1788 GetShortPathName(inidir,inidir,CCHMAXPATH);
1796 /* IKSD doesn't request client certs */
1797 ssl_verify_flag = SSL_VERIFY_NONE;
1806 _searchenv(iksdconf,"INIT",line);
1808 _searchenv(iksdconf,"DPATH",line);
1810 _searchenv(iksdconf,"PATH",line);
1812 char *pgmptr = GetLoadPath();
1813 if (pgmptr && strlen(pgmptr) < LINBUFSIZ-8) {
1814 lp = strrchr(pgmptr, '\\');
1816 strncpy(line, pgmptr, lp - pgmptr);
1817 strcpy(line + (lp - pgmptr), "\\");
1818 strcpy(line + (lp - pgmptr + 1), iksdconf);
1820 lp = strrchr(pgmptr, '.');
1822 strncpy(line, pgmptr, lp - pgmptr);
1823 strcpy(line + (lp - pgmptr), ".ksc");
1828 debug(F110,"doiksdinit() line",line,0);
1829 tfile[0] = fopen(line,"r");
1831 tfile[0] = fopen(iksdconf,"r");
1833 if (tfile[0] != NULL) {
1837 if (tfnam[tlevel] = malloc(strlen(line)+1))
1838 strcpy(tfnam[tlevel],line);
1840 if ((tfnam[tlevel] = malloc(strlen(iksdconf)+1)))
1841 strcpy(tfnam[tlevel],iksdconf);
1846 cmdstk[cmdlvl].src = CMD_TF;
1847 cmdstk[cmdlvl].lvl = tlevel;
1848 cmdstk[cmdlvl].ccflgs = 0;
1851 count[cmdlvl] = count[cmdlvl-1]; /* Inherit from previous level */
1852 intime[cmdlvl] = intime[cmdlvl-1];
1853 inpcas[cmdlvl] = inpcas[cmdlvl-1];
1854 takerr[cmdlvl] = takerr[cmdlvl-1];
1855 merror[cmdlvl] = merror[cmdlvl-1];
1856 xquiet[cmdlvl] = quiet;
1857 xvarev[cmdlvl] = vareval;
1859 debug(F110,"doiksdinit file ok",tfnam[tlevel],0);
1861 debug(F110,"doiksdinit open failed",tfnam[tlevel],0);
1863 #endif /* IKSDCONF */
1870 Get next command from current macro definition. Command is copied
1871 into string pointed to by argument s, max length n. Returns:
1872 0 if a string was copied;
1873 -1 if there was no string to copy.
1876 getncm(s,n) char *s; int n; {
1877 int y = 0; /* Character counter */
1879 int kp = 0; /* Brace up-down counter */
1880 int pp = 0; /* Parenthesis up-down counter */
1882 int dq = 0; /* Doublequote counter */
1883 #endif /* NODQMACRO */
1884 char *s2; /* Copy of destination pointer */
1886 s2 = s; /* Initialize string pointers */
1887 *s = NUL; /* and destination buffer */
1889 /* debug(F010,"getncm entry",macp[maclvl],0); */
1891 for (y = 0; /* Loop for n bytes max */
1892 macp[maclvl] && *macp[maclvl] && y < n;
1893 y++, s++, macp[maclvl]++) {
1895 *s = *macp[maclvl]; /* Get next char from macro def */
1899 This is to allow quoting of parentheses, commas, etc, in function
1900 arguments, but it breaks just about everything else. DON'T REMOVE THIS
1901 COMMENT! (Otherwise you'll wind up adding the same code again and breaking
1902 everything again.) <-- The preceding warning should be obsolete since the
1903 statements below have been fixed, but in case of fire, remove the "n" from
1904 the <#>ifndef above. NEW WARNING: code added 12 Apr 2002 to exempt the
1905 opening brace in \{nnn} from being treated as a quoted brace.
1907 if (!quote && *s == CMDQ) {
1914 if (*s == '{') { /* Check for \{nnn} (8.0.203) */
1916 p = macp[maclvl] + 1;
1917 while ((c = *p++)) {
1920 else if (c == '}') {
1931 #endif /* COMMENT */
1934 Allow braces around macro definition to prevent commas from being turned to
1935 end-of-lines and also treat any commas within parens as text so that
1936 multiple-argument functions won't cause the command to break prematurely.
1937 19 Oct 2001: Similar treatment was added for doublequotes, so
1939 define foo { echo "one, two, three" }
1941 would work as expected. This doesn't seem to have broken anything but
1942 if something comes up later, rebuild with NODQMACRO defined.
1944 if (*s == '{') kp++; /* Count braces */
1945 if (*s == '}' && kp > 0) kp--;
1946 if (*s == '(') pp++; /* Count parentheses. */
1947 if (*s == ')' && pp > 0) pp--;
1950 /* Too many false positives */
1951 /* No, not really -- this is indeed the best we can do */
1952 /* Reverted to this method Sun May 11 18:43:45 2003 */
1953 if (*s == '"') dq = 1 - dq; /* Account for doublequotes */
1954 #else /* Fri Apr 4 13:21:29 2003 */
1955 /* The code below breaks the SWITCH statement */
1956 /* There is no way to make this work -- it would require */
1957 /* building in all the knowledge of command parser. */
1958 if (dblquo && (*s == '"')) { /* Have doublequote */
1959 if (dq == 1) { /* Close quote only if... */
1960 if ((*(macp[maclvl]+1) == SP) || /* followed by space or... */
1961 (!*(macp[maclvl]+1)) || /* at end or ... */
1962 /* Next char is command separator... */
1963 /* Sun May 11 17:24:12 2003 */
1964 (kp < 1 && pp < 1 && (*(macp[maclvl]+1) == ','))
1966 dq = 0; /* Close the quote */
1967 } else if (dq == 0) {
1968 /* Open quote only if at beginning or preceded by space */
1972 } else if (s == s2) {
1977 #endif /* COMMENT */
1978 #endif /* NODQMACRO */
1979 if (*s == ',' && pp <= 0 && kp <= 0
1982 #endif /* NODQMACRO */
1984 macp[maclvl]++; /* Comma not in {} or () */
1985 /* debug(F110,"next cmd",s,0); */
1986 kp = pp = 0; /* so we have the next command */
1989 } /* Reached end. */
1991 /* DON'T DO THIS - IT BREAKS EVERYTHING */
1993 #endif /* COMMENT */
1994 if (*s2 == NUL) { /* If nothing was copied, */
1995 /* debug(F100,"XXX getncm eom","",0); */
1996 popclvl(); /* pop command level. */
1998 } else { /* otherwise, tack CR onto end */
2001 /* debug(F110,"XXX getncm OK",s,0); */
2002 if (mecho && pflag) /* If MACRO ECHO ON, echo the cmd */
2008 /* D O M A C -- Define and then execute a macro */
2011 domac(name, def, flags) char *name, *def; int flags; {
2016 int term_io_sav = term_io;
2017 term_io = 0; /* Disable Terminal Emulator I/O */
2019 #endif /* NOLOCAL */
2020 m = maclvl; /* Current macro stack level */
2021 x = addmac(name, def); /* Define a new macro */
2022 if (x > -1) { /* If successful, */
2023 dodo(x,NULL,flags); /* start it (increments maclvl). */
2024 while (maclvl > m) { /* Keep going till done with it, */
2025 debug(F101,"domac loop maclvl 1","",maclvl);
2026 sstate = (CHAR) parser(1); /* parsing & executing each command, */
2027 debug(F101,"domac loop maclvl 2","",maclvl);
2028 if (sstate) proto(); /* including protocol commands. */
2030 debug(F101,"domac loop exit maclvl","",maclvl);
2034 term_io = term_io_sav;
2036 #endif /* NOLOCAL */
2044 Get next command from TAKE (command) file.
2047 s Pointer to buffer to read into
2049 f File descriptor of file to read from
2050 flag 0 == keep line terminator on and allow continuation
2051 1 == discard line terminator and don't allow continuation
2053 Call with flag == 0 to read a command from a TAKE file;
2054 Call with flag != 0 to read a line from a dialing or network directory.
2056 In both cases, trailing comments and/or trailing whitespace is/are stripped.
2057 If flag == 0, continued lines are combined into one line. A continued line
2058 is one that ends in hypen, or any line in a "block", which starts with "{"
2059 at the end of a line and ends with a matching "}" at the beginning of a
2060 subsequent line; blocks may be nested.
2063 0 if a string was copied,
2065 -2 on malloc failure
2066 -3 if line is not properly terminated
2067 -4 if (possibly continued) line is too long.
2069 static int lpxlen = 0;
2072 getnct(s,n,f,flag) char *s; int n; FILE *f; int flag; {
2073 int i = 0, len = 0, buflen = 0;
2074 char c = NUL, cc = NUL, ccl = NUL, ccx = NUL, *s2 = NULL;
2075 char *lp = NULL, *lpx = NULL, *lp2 = NULL, *lp3 = NULL, *lastcomma = NULL;
2077 int bc = 0; /* Block counter */
2079 s2 = s; /* Remember original pointer */
2080 prev = s2; /* Here too */
2081 buflen = n; /* Remember original buffer length */
2086 /* Allocate a line buffer only if we don't have one that's big enough */
2088 debug(F111,"getnct",ckitoa(lpxlen),n);
2090 if (lpx && (n > lpxlen)) { /* Have one already */
2091 debug(F101,"getnct new buffer","",lpxlen);
2092 free(lpx); /* But it's not big enough */
2093 lpx = NULL; /* Free current one */
2096 if (!lpx) { /* Get new one */
2097 if (!(lpx = (char *) malloc(n))) {
2098 debug(F101,"getnct malloc failure","",0);
2099 printf("?Memory allocation failure [getnct:%d]\n",n);
2106 /* NOTE: No longer used as of 14 Aug 2000 */
2110 while (1) { /* Loop to read lines from file */
2111 debug(F101,"getnct while (1)","",n);
2112 if (fgets(lp2,n,f) == NULL) { /* Read a line into lp2 */
2113 debug(F110,"getnct EOF",s2,0); /* EOF */
2114 free(lpx); /* Free temporary storage */
2116 *s = NUL; /* Make destination be empty */
2117 return(-1); /* Return failure code */
2121 if (flag) /* Count this line */
2126 len = strlen(lp2) - 1; /* Position of line terminator */
2127 if (len == 0 && lp2[0] != '\n') { /* Last line in file has one char */
2128 lp2[++len] = '\n'; /* that is not a newline */
2131 debug(F010,"getnct",lp2,0);
2134 if (techo && pflag) /* If TAKE ECHO ON, */
2135 printf("%3d. %s", /* echo it this line. */
2142 lp3 = lp2; /* Working pointer */
2143 i = len; /* Get first nonwhitespace character */
2144 while (i > 0 && (*lp3 == SP || *lp3 == HT)) {
2148 if (i == 0 && bc > 0) /* Blank line in {...} block */
2151 /* Isolate, remove, and check terminator */
2153 c = lp2[len]; /* Value of line terminator */
2154 /* debug(F101,"getnct terminator","",c); */
2155 if (c < LF || c > CR) { /* It's not a terminator */
2156 /* debug(F111,"getnct bad line",lp2,c); */
2157 if (feof(f) && len > 0 && len < n) {
2158 /* Kludge Alert... */
2160 printf("WARNING: Last line of %s lacks terminator\n",
2161 s2 == cmdbuf ? "command file" : "directory file");
2162 c = lp2[++len] = '\n'; /* No big deal - supply one. */
2163 } else { /* Something's wrong, fail. */
2169 /* Trim trailing whitespace */
2171 for (i = len - 1; i > -1 && lp2[i] <= SP; i--) /* Trim */
2173 /* debug(F101,"getnct i","",i); */
2174 lp2[i+1] = NUL; /* Terminate the string */
2175 /* debug(F110,"getnct lp2",lp2,0); */
2176 lp = lp2; /* Make a working pointer */
2178 /* Remove trailing or full-line comment */
2180 while ((cc = *lp)) {
2181 if (cc == ';' || cc == '#') { /* Comment introducer? */
2182 if (lp == lp2) { /* First char on line */
2185 } else if (*(lp - 1) == SP || *(lp - 1) == HT) {
2187 *lp = NUL; /* Or preceded by whitespace */
2194 lp--; /* Back up over the NUL */
2196 /* Now trim any space that preceded the comment */
2198 while ((*lp == SP || *lp == HT) && lp >= lp2) {
2204 /* debug(F110,"getnct comment trimmed",lp2,0); */
2206 len = strlen(lp2); /* Length after trimming */
2208 if (n - len < 2) { /* Check remaining space */
2209 debug(F111,"getnct command too long",s2,buflen);
2210 printf("?Line too long, maximum length: %d.\n",buflen);
2214 ccl = (len > 0) ? lp2[len-1] : 0; /* Last character in line */
2215 ccx = (len > 1) ? lp2[len-2] : 0; /* Penultimate char in line */
2218 /* Line containing only whitespace and ,- */
2219 if ((len > 1) && (lp3 == lp2+len-2) && (ccl == '-') && (ccx == ','))
2221 #endif /* COMMENT */
2225 If it is a command and it begins with a token (like ! or .) that is not
2226 followed by a space, insert a space now; otherwise cmkey() can get mighty
2229 if (s == s2 && !flag) {
2232 if (*p == *lp3 && *(p+1) != SP) {
2233 debug(F110,"getnct token",p,0);
2248 while ((*s++ = *lp++)) /* Copy result to target buffer */
2249 n--; /* accounting for length */
2250 s--; /* Back up over the NUL */
2252 /* Check whether this line is continued */
2254 if (flag) /* No line continuation when flag=1 */
2255 break; /* So break out of read-lines loop */
2258 debug(F000,"getnct first char","",*lp3);
2259 debug(F000,"getnct last char","",ccl);
2260 debug(F000,"getnct next-to-last char","",ccx);
2261 #endif /* COMMENT */
2263 if (bc > 0 && *lp3 == '}') { /* First char on line is '}' */
2264 bc--; /* Decrement block counter */
2267 if (bc == 0 && /* Line is continued if bc > 0 */
2269 /* Not supported as of C-Kermit 6.0 */
2270 ccl != CMDQ && /* or line ends with CMDQ */
2271 #endif /* COMMENT */
2272 ccl != '-' && /* or line ends with dash */
2273 ccl != '{') /* or line ends with opening brace */
2274 break; /* None of those, we're done. */
2276 if (ccl == '-' || ccl == '{') /* Continuation character */
2277 if (ccx == CMDQ) /* But it's quoted */
2278 break; /* so ignore it */
2280 if (ccl == '{') { /* Last char on line is '{'? */
2281 bc++; /* Count the block opener. */
2282 } else if (ccl == '-') { /* Explicit continue? */
2285 s--; /* Yes, back up over terminators */
2286 n++; /* and over continuation character */
2287 nn = n; /* Save current count */
2288 ss = s; /* and pointer */
2289 s--; /* Back up over dash */
2291 while (state < 2 && s >= prev) { /* Check for "{,-" */
2296 if (c != ',' && c != '{')
2299 case 0: /* Looking for comma */
2303 case 1: /* Looking for left brace */
2313 if (state != 2) { s = ss; n = nn; }
2315 } else { /* None of those but (bc > 0) */
2317 *s++ = ','; /* and insert a comma */
2321 debug(F101,"getnct bc","",bc);
2322 debug(F100,"getnct continued","",0);
2323 #endif /* COMMENT */
2328 } /* read-lines while loop */
2332 if (!flag) /* Tack line terminator back on */
2334 *s++ = NUL; /* Terminate the string */
2335 untab(s2); /* Done, convert tabs to spaces */
2338 debug(F010,"CMD(F)",s2,0);
2341 free(lpx); /* Free temporary storage */
2342 return(0); /* Return success */
2346 shostack() { /* Dump the command stack */
2350 for (i = cmdlvl; i > 0; i--) {
2351 if (cmdstk[i].src == CMD_TF) {
2352 p = tfnam[cmdstk[i].lvl];
2353 if (zfnqfp(p,TMPBUFSIZ,tmpbuf))
2355 printf(" %2d. File : %s (line %d)\n",
2358 tfline[cmdstk[i].lvl]
2360 } else if (cmdstk[i].src == CMD_MD) {
2362 m = m_arg[cmdstk[i].lvl][0]; /* Name of this macro */
2363 if (i > 0) { /* Special handling for 2-level */
2364 char *s; /* built-in macros... */
2365 s = m_arg[cmdstk[i-1].lvl][0]; /* Name next level up */
2366 if (s && cmdstk[i-1].src == CMD_MD) {
2367 if (!strcmp(s,"_forx"))
2369 else if (!strcmp(s,"_xif"))
2371 else if (!strcmp(s,"_while"))
2373 else if (!strcmp(s,"_switx"))
2377 printf(" %2d. Macro : %s\n",i,m);
2378 } else if (cmdstk[i].src == CMD_KB) {
2379 printf(" %2d. Prompt:\n",i);
2381 printf(" %2d. ERROR : Command source unknown\n",i);
2385 for (i = tlevel; i > -1; i--) {
2387 if (zfnqfp(p,TMPBUFSIZ,tmpbuf))
2389 printf(" %2d. File : %s (line %d)\n",
2397 printf(" %2d. Prompt: (top level)\n",0);
2400 /* For command error messages - avoid dumping out the contents of some */
2401 /* some huge FOR loop if it contains a syntax error. */
2404 cmddisplay(s, cx) char * s; int cx; {
2405 static char buf[80];
2406 if ((int)strlen(s) > 70) {
2407 sprintf(buf,"%.64s...",s); /* SAFE */
2416 switch (cmd_err) { /* SET COMMAND ERROR-DISPLAY */
2425 "In macro or block defined in file: %s starting about line %d\n",
2426 tfnam[tlevel] ? tfnam[tlevel] : "", tfline[tlevel]
2430 printf("File: %s, Line: %d\n",
2431 tfnam[tlevel] ? tfnam[tlevel] : "", tfline[tlevel]
2436 if (cmdstk[cmdlvl].src == CMD_MD) { /* Executing a macro? */
2438 m = cmdstk[cmdlvl].lvl;
2439 if (mlook(mactab,m_arg[m][0],nmac) >= 0)
2440 printf("Macro name: %s\n", m_arg[m][0]);
2447 printf("Command stack:\n");
2453 /* P A R S E R -- Top-level interactive command parser. */
2457 m = 0 for normal behavior: keep parsing and executing commands
2458 until an action command is parsed, then return with a
2459 Kermit start-state as the value of this function.
2460 m = 1 to parse only one command, can also be used to call parser()
2462 m = 2 to read but do not execute one command.
2463 In all cases, parser() returns:
2464 0 if no Kermit protocol action required
2465 > 0 with a Kermit protocol start-state.
2470 int tfcode, xx, yy, zz; /* Workers */
2475 int inlevel; /* Level we were called at */
2476 extern int askflag, echostars;
2478 char *cbp; /* Command buffer pointer */
2480 extern char *lfiles; /* Fake extern cast */
2482 extern int interrupted;
2484 extern int sndcmd, getcmd, fatalio, clearrq;
2488 reqres(); /* Restore AmigaDOS requestors */
2492 if (cursor_save > -1) { /* Restore cursor if it was */
2493 cursorena[VCMD] = cursor_save; /* turned off during file transfer */
2499 if (ikdbopen) slotstate(what,"COMMAND PROMPT","",""); /* IKSD database */
2502 is_tn = (local && network && IS_TELNET()) ||
2503 (!local && sstelnet);
2505 if (!xcmdsrc) /* If at top (interactive) level ... */
2506 concb((char)escape); /* put console in 'cbreak' mode. */
2509 /* If we were cd'd temporarily to another device or directory ... */
2512 x = zchdir((char *) savdir); /* ... restore previous directory */
2513 f_tmpdir = 0; /* and remember we did it. */
2514 debug(F111,"parser tmpdir restoring",savdir,x);
2516 #endif /* CK_TMPDIR */
2519 inlevel = cmdlvl; /* Current macro level */
2522 debug(F101,"&parser entry maclvl","",maclvl);
2523 debug(F101,"&parser entry inlevel","",inlevel);
2524 debug(F101,"&parser entry tlevel","",tlevel);
2525 debug(F101,"&parser entry cmdlvl","",cmdlvl);
2526 debug(F101,"&parser entry m","",m);
2532 ftreset(); /* Reset global file settings */
2535 sstate becomes nonzero when a command has been parsed that requires some
2536 action from the protocol module. Any non-protocol actions, such as local
2537 directory listing or terminal emulation, are invoked directly from below.
2539 sstate = 0; /* Start with no start state. */
2543 query = 0; /* QUERY not active */
2547 if (local && !network && carrier != CAR_OFF) {
2548 int x; /* Serial connection */
2549 x = ttgmdm(); /* with carrier checking */
2551 if (!(x & BM_DCD)) {
2560 debug(F101,"parser top what","",what);
2561 debug(F101,"parser top interrupted","",interrupted);
2562 debug(F101,"parser top cdlost","",cdlost);
2563 debug(F101,"parser top sndcmd","",sndcmd);
2564 debug(F101,"parser top getcmd","",getcmd);
2567 if (cdlost && !interrupted && (sndcmd || getcmd)) {
2568 printf("?Connection broken (carrier signal lost)\n");
2570 if (sndcmd && protocol == PROTO_K &&
2571 !success && hints && !interrupted && !fatalio && !xcmdsrc) {
2573 printf("\n*************************\n");
2574 printf("SEND-class command failed.\n");
2575 printf(" Packets sent: %d\n", spackets);
2576 printf(" Retransmissions: %d\n",retrans);
2577 printf(" Timeouts: %d\n", timeouts);
2578 printf(" Damaged packets: %d\n", crunched);
2580 printf(" Transfer canceled by receiver.\n");
2581 printf(" Receiver's message: \"%s\"\n",(char *)epktmsg);
2584 if (epktmsg) if (*epktmsg) {
2585 printf(" Fatal Kermit Protocol Error: %s\n",epktmsg);
2589 if (local && !network && carrier != CAR_OFF) {
2590 int xx; /* Serial connection */
2591 xx = ttgmdm(); /* with carrier checking */
2602 printf(" Most recent local OS error: \"%s\"\n",ck_errstr());
2606 "\nHINTS... If the preceding error message%s not explain the failure:\n",
2607 (n > 1) ? "s do" : " does"
2611 if (rpackets == 0) {
2612 printf(" . Did you start a Kermit receiver on the far end?\n");
2615 " . Try changing the remote Kermit's FLOW-CONTROL setting.\n");
2616 if (!network && mdmtyp > 0)
2617 if ((3 * crunched) > spackets)
2619 " . Try placing a new call to get a cleaner connection.\n");
2621 } else if (rpackets > 0) {
2622 if (flow == FLO_NONE)
2623 printf(" . Give me a SET FLOW XON/XOFF command and try again.\n");
2625 printf(" . Give me a SET FLOW NONE command and try again.\n");
2628 #endif /* NOLOCAL */
2630 if ((3 * timeouts) > spackets)
2631 printf(" . Adjust the timeout method (see HELP SET SEND).\n");
2632 if ((3 * retrans) > spackets)
2633 printf(" . Increase the retry limit (see HELP SET RETRY).\n");
2636 if (prefixing != PX_ALL && rpackets > 2) {
2637 printf(" . Try it again with: SET PREFIXING ALL\n");
2640 #endif /* CK_SPEED */
2643 printf(" . Try it again with: SET STREAMING OFF\n");
2645 } else if (reliable) {
2646 printf(" . Try it again with: SET RELIABLE OFF\n");
2649 #endif /* STREAMING */
2652 if (clearrq > 0 && prefixing == PX_NON) {
2653 printf(" . Try it again with: SET CLEAR-CHANNEL OFF\n");
2656 #endif /* CK_SPEED */
2658 printf(" . Try it again with: SET PARITY SPACE\n");
2661 printf(" . %sive a ROBUST command and try again.\n",
2662 (x > 0) ? "As a last resort, g" : "G"
2665 printf(" . Be sure the source file has read permission.\n");
2666 printf(" . Be sure the target directory has write permission.\n");
2668 if the file was 2G or larger make sure other Kermit supports LFs...
2670 printf(" . Be sure the target disk has sufficient space.\n");
2671 printf("(Use SET HINTS OFF to suppress hints.)\n");
2672 printf("*************************\n\n");
2674 debug(F101,"topcmd","",topcmd);
2675 if (getcmd && protocol == PROTO_K &&
2676 !success && hints && !interrupted && !fatalio && !xcmdsrc) {
2678 extern int urpsiz, wslotr;
2679 printf("\n*************************\n");
2680 printf("RECEIVE- or GET-class command failed.\n");
2681 printf(" Packets received: %d\n", rpackets);
2682 printf(" Damaged packets: %d\n", crunched);
2683 printf(" Timeouts: %d\n", timeouts);
2685 printf(" Packet length: %d\n", urpsiz);
2687 printf(" Transfer canceled by sender.\n");
2688 printf(" Sender's message: \"%s\"\n",(char *)epktmsg);
2693 printf(" Most recent local error: \"%s\"\n",ck_errstr());
2695 "\nHINTS... If the preceding error message%s not explain the failure:\n",
2696 epktrcvd ? "s do" : " does"
2700 if (topcmd == XXGET)
2701 printf(" . Did you start a Kermit SERVER on the far end?\n");
2702 if (rpackets == 0) {
2703 if (topcmd != XXGET)
2704 printf(" . Did you start a Kermit SENDer on the far end?\n");
2707 " . Choose a different FLOW-CONTROL setting and try again.\n");
2709 } else if (topcmd == XXGET)
2710 printf(" . Is the other Kermit in (or does it have) SERVER mode?\n");
2711 if (rpackets > 0 && urpsiz > 90)
2712 printf(" . Try smaller packets (SET RECEIVE PACKET-LENGTH).\n");
2713 if (rpackets > 0 && wslotr > 1 && !streamed)
2714 printf(" . Try a smaller window size (SET WINDOW).\n");
2715 if (!local && rpackets > 0) {
2716 if (flow == FLO_NONE)
2717 printf(" . Give me a SET FLOW XON/XOFF command and try again.\n");
2719 printf(" . Give me a SET FLOW NONE command and try again.\n");
2722 #endif /* NOLOCAL */
2725 printf(" . Try it again with: SET STREAMING OFF\n");
2727 } else if (reliable && local) {
2728 printf(" . Try it again with: SET RELIABLE OFF\n");
2731 #endif /* STREAMING */
2733 printf(" . Try it again with: SET PARITY SPACE\n");
2737 " . As a last resort, give a ROBUST command and try again.\n" :
2738 " . Give a ROBUST command and try again.\n"
2741 printf(" . Be sure the target directory has write permission.\n");
2742 printf(" . Be sure the target disk has sufficient space.\n");
2743 printf(" . Try telling the %s to SET PREFIXING ALL.\n",
2744 topcmd == XXGET ? "server" : "sender"
2746 printf(" . Try giving a ROBUST command to the %s.\n",
2747 topcmd == XXGET ? "server" : "sender"
2749 printf("(Use SET HINTS OFF to suppress hints.)\n");
2750 printf("*************************\n\n");
2752 #endif /* NOHINTS */
2758 while (sstate == 0) { /* Parse cmds until action requested */
2759 debug(F100,"parse top","",0);
2760 what = W_COMMAND; /* Now we're parsing commands. */
2761 rcdactive = 0; /* REMOTE CD not active */
2762 keepallchars = 0; /* MINPUT not active */
2765 if (apcactive == APC_INACTIVE)
2766 WaitCommandModeSem(-1);
2772 TELOPT_ME(TELOPT_KERMIT) &&
2773 TELOPT_SB(TELOPT_KERMIT).kermit.me_start) ||
2776 TELOPT_ME(TELOPT_KERMIT) &&
2777 TELOPT_SB(TELOPT_KERMIT).kermit.me_start)
2779 tn_siks(KERMIT_STOP);
2781 #endif /* IKS_OPTION */
2785 fnrpath = PATH_AUTO;
2788 remfile = 0; /* Clear these in case REMOTE */
2789 remappd = 0; /* command was interrupted... */
2791 makestr(&snd_move,g_snd_move); /* Restore these */
2792 makestr(&rcv_move,g_rcv_move);
2793 makestr(&snd_rename,g_snd_rename);
2794 makestr(&rcv_rename,g_rcv_rename);
2797 /* Take requested action if there was an error in the previous command */
2800 debug(F101,"parser tlevel","",tlevel);
2801 debug(F101,"parser cmd_rows","",cmd_rows);
2804 debug(F101,"parser wasclosed","",wasclosed);
2805 if (wasclosed) { /* If connection was just closed */
2808 k = mlook(mactab,"on_close",nmac); /* Look up "on_close" */
2809 if (k >= 0) { /* If found, */
2810 /* printf("ON_CLOSE CMD LOOP\n"); */
2811 dodo(k,ckitoa(whyclosed),0); /* Set it up */
2814 whyclosed = WC_REMO;
2817 #endif /* NOLOCAL */
2820 xxdot = 0; /* Clear this... */
2822 debug(F101,"parser success","",success);
2824 if (cmdstk[cmdlvl].src == CMD_TF && takerr[cmdlvl]) {
2825 printf("Command file terminated by error.\n");
2827 if (cmdlvl == 0) return(0);
2829 if (cmdstk[cmdlvl].src == CMD_MD && merror[cmdlvl]) {
2830 printf("Command error: macro terminated.\n");
2832 if (m && (cmdlvl < inlevel))
2833 return((int) sstate);
2837 debug(F101,"parser nulcmd","",nulcmd);
2839 if (success == 0 && tlevel > -1 && takerr[tlevel]) {
2840 printf("Command file terminated by error.\n");
2842 cmini(ckxech); /* Clear the cmd buffer. */
2843 if (tlevel < 0) /* Just popped out of cmd files? */
2844 return(0); /* End of init file or whatever. */
2849 /* Check for TAKE initiated by menu. */
2850 if ((tlevel == -1) && lfiles)
2854 /* If in TAKE file, check for EOF */
2861 ((cmdstk[cmdlvl].src == CMD_TF) /* If end of take file */
2863 && feof(tfile[tlevel])) {
2864 popclvl(); /* pop command level */
2865 cmini(ckxech); /* and clear the cmd buffer. */
2866 if (cmdlvl == 0) { /* Just popped out of all cmd files? */
2867 return(0); /* End of init file or whatever. */
2872 if (sstate == 'a') { /* if cmd-. cancel */
2873 debug(F100, "parser: cancel take due to sstate", "", sstate);
2876 return(0); /* End of init file or whatever. */
2881 if ((tlevel > -1) && feof(tfile[tlevel])) { /* If end of take */
2882 popclvl(); /* Pop up one level. */
2883 cmini(ckxech); /* and clear the cmd buffer. */
2884 if (tlevel < 0) /* Just popped out of cmd files? */
2885 return(0); /* End of init file or whatever. */
2891 debug(F101,"parser cmdlvl","",cmdlvl);
2892 debug(F101,"parser cmdsrc","",cmdstk[cmdlvl].src);
2894 if (cmdstk[cmdlvl].src == CMD_MD) { /* Executing a macro? */
2895 debug(F100,"parser macro","",0);
2896 maclvl = cmdstk[cmdlvl].lvl; /* Get current level */
2897 debug(F101,"parser maclvl","",maclvl);
2898 cbp = cmdbuf; /* Copy next cmd to command buffer. */
2900 if (*savbuf) { /* In case then-part of 'if' command */
2901 ckstrncpy(cbp,savbuf,CMDBL); /* was saved, restore it. */
2903 } else { /* Else get next cmd from macro def */
2904 if (getncm(cbp,CMDBL) < 0) {
2907 debug(F101,"parser end of macro m","",m);
2908 debug(F101,"parser end of macro cmdlvl","",cmdlvl);
2909 debug(F101,"parser end of macro inlevel","",inlevel);
2912 if (m && (cmdlvl < inlevel))
2913 return((int) sstate);
2914 else /* if (!m) */ continue;
2917 debug(F010,"CMD(M)",cmdbuf,0);
2919 } else if (cmdstk[cmdlvl].src == CMD_TF)
2925 debug(F111,"parser savbuf",savbuf,tlevel);
2926 if (*savbuf) { /* In case THEN-part of IF command */
2927 ckstrncpy(cmdbuf,savbuf,CMDBL); /* was saved, restore it. */
2932 /* Get next line from TAKE file */
2934 if ((tfcode = getnct(cmdbuf,CMDBL,tfile[tlevel],0)) < 0) {
2935 debug(F111,"parser tfcode",tfile[tlevel],tfcode);
2936 if (tfcode < -1) { /* Error */
2937 printf("?Error in TAKE command file: %s\n",
2938 (tfcode == -2) ? "Memory allocation failure" :
2939 "Line too long or contains NUL characters"
2943 continue; /* -1 means EOF */
2946 /* If interactive, get next command from user. */
2948 } else { /* User types it in. */
2949 if (pflag) prompt(xxstring);
2953 /* Now we know where next command is coming from. Parse and execute it. */
2955 repars = 1; /* 1 = command needs parsing */
2957 displa = 0; /* Assume no file transfer display */
2960 while (repars) { /* Parse this cmd until entered. */
2962 debug(F101,"parser top of while loop","",0);
2963 xaskmore = saveask; /* Restore global more-prompting */
2964 diractive = 0; /* DIR command not active */
2965 cdactive = 0; /* CD command not active */
2967 askflag = 0; /* ASK command not active */
2968 echostars = 0; /* Nor ASKQ */
2969 debok = 1; /* Undisable debugging */
2973 /* In case of "send /recursive ./?<Ctrl-U>" etc */
2974 recursive = 0; /* This is never sticky */
2975 #endif /* RECURSIVE */
2976 xfiletype = -1; /* Reset this between each command */
2979 #endif /* NOMSEND */
2982 #endif /* CK_RECALL */
2983 /* This might have been changed by a switch */
2984 if (g_matchdot > -1) {
2985 matchdot = g_matchdot;
2988 cmres(); /* Reset buffer pointers. */
2992 /* we check to see if a macro is waiting to be executed */
2993 /* if so, we call domac on it */
2995 ckstrncpy(cmdbuf, cmdmac, CMDBL);
2999 #endif /* COMMENT */
3005 xx = cmkey2(cmdtab,ncmd,"Command","",toktab,xxstring,1);
3006 debug(F101,"top-level cmkey2","",xx);
3008 yy = chktok(toktab);
3009 debug(F101,"top-level cmkey token","",yy);
3011 /* Either way makes absolutely no difference */
3012 debug(F110,"NO UNGWORD",atmbuf,0);
3015 debug(F110,"TOKEN UNGWORD",atmbuf,0);
3017 #endif /* COMMENT */
3019 case '#': xx = XXCOM; break; /* Comment */
3020 case ';': xx = XXCOM; break; /* Comment */
3022 case '.': xx = XXDEF; xxdot = 1; break; /* Assignment */
3023 case ':': xx = XXLBL; break; /* GOTO label */
3029 #endif /* CK_REDIR */
3034 if ((x = cmtxt("Text to be ignored","",&s,NULL)) < 0)
3041 case '<': xx = XXFUN; break; /* REDIRECT */
3042 #endif /* CK_REDIR */
3044 case '!': xx = XXSHE; break; /* Shell escape */
3050 case '^': xx = XXREDO; break;
3051 #endif /* CK_RECALL */
3053 case '{': xx = XXMACRO; break;
3054 case '(': xx = XXSEXP; break;
3058 if (!quiet && !cmd_err) {
3059 printf("\n?Invalid - \"%s\"\n",
3060 cmddisplay((char *)cmdbuf,xx)
3067 debug(F101,"HAVE TOKEN","",xx);
3070 topcmd = xx; /* Top-level command index */
3073 lastcmd[maclvl] = xx;
3075 debug(F101,"topcmd","",topcmd);
3076 debug(F101,"cmflgs","",cmflgs);
3080 /* Special handling for IF..ELSE */
3082 debug(F101,"cmdlvl","",cmdlvl);
3083 debug(F101,"ifcmd[cmdlvl]","",ifcmd[cmdlvl]);
3085 if (ifcmd[cmdlvl]) /* Count stmts after IF */
3087 if (ifcmd[cmdlvl] > 2 && xx != XXELS && xx != XXCOM)
3090 /* Execute the command and take action based on return code. */
3092 if (nulcmd) { /* Ignoring this command? */
3093 xx = XXCOM; /* Make this command a comment. */
3095 fnsuccess = 1; /* For catching \function() errors */
3098 debug(F101,"calling docmd()","",xx);
3099 zz = docmd(xx); /* Parse rest of command & execute. */
3102 { /* For \v(lastcommand) */
3103 extern char * prevcmd;
3104 /* The exception list kind of a hack but let's try it... */
3105 if (ckstrcmp(cmdbuf,"_getarg",7,0) &&
3106 ckstrcmp(cmdbuf,"if ",3,0) &&
3107 ckstrcmp(cmdbuf,"xif ",4,0) &&
3108 ckstrcmp(cmdbuf,"do _if",6,0) &&
3109 ckstrcmp(cmdbuf,"_assign _if",11,0))
3110 ckstrncpy(prevcmd,cmdbuf,CMDBL);
3115 if (fnerror && !fnsuccess)
3118 debug(F101,"docmd returns","",zz);
3119 /* debug(F011,"cmdbuf",cmdbuf,30); */
3120 /* debug(F011,"atmbuf",atmbuf,30); */
3123 if (sstate == 'a') { /* if cmd-. cancel */
3124 debug(F110, "parser: cancel take, sstate:", "a", 0);
3127 return(0); /* End of init file or whatever. */
3132 case -4: /* EOF (e.g. on redirected stdin) */
3133 doexit(GOOD_EXIT,xitsta); /* ...exit successfully */
3134 case -1: /* Reparse needed */
3135 repars = 1; /* Just set reparse flag and... */
3138 case -7: /* They typed a disk letter */
3139 if (!zchdir((char *)cmdbuf)) {
3140 perror((char *)cmdbuf);
3147 case -6: /* Invalid command given w/no args */
3148 case -2: { /* Invalid command given w/args */
3151 x = strlen(cmdbuf); /* Avoid blank line */
3153 if (cmdbuf[x-1] != LF)
3155 printf("?Invalid: %s%s",
3156 cmddisplay(cmdbuf,xx),eol
3159 printf("?Invalid\n");
3161 case -9: /* Bad, error message already done */
3163 debug(F110,"top-level cmkey failed",cmdbuf,0);
3164 /* If in background w/ commands coming stdin, terminate */
3165 if (pflag == 0 && tlevel < 0)
3166 fatal("Kermit command error in background execution");
3168 Command retry feature, edit 190. If we're at interactive prompting level,
3169 reprompt the user with as much of the command as didn't fail.
3172 if (cm_retry && !xcmdsrc) { /* If at top level */
3175 len = strlen(cmdbuf); /* Length of command buffer */
3176 p = malloc(len + 1); /* Allocate space for copy */
3177 if (p) { /* If we got the space copy */
3178 strcpy(p,cmdbuf); /* the command buffer (SAFE). */
3179 /* Chop off final field, the one that failed. */
3180 s = p + len - 1; /* Point to end */
3181 while (*s == SP && s > p) /* Trim blanks */
3183 while (*s != SP && s > p) /* Trim last field */
3185 if (s > p) /* Keep the space */
3186 s++; /* after last good field */
3187 if (s >= p) /* Cut off remainder */
3189 cmini(ckxech); /* Reinitialize the parser */
3190 ckstrncpy(cmdbuf,p,CMDBL); /* Copy result back */
3191 free(p); /* Free temporary storage */
3193 prompt(xxstring); /* Reprint the prompt */
3194 printf("%s",cmdbuf); /* Reprint partial command */
3195 repars = 1; /* Force reparse */
3199 #endif /* CK_RECALL */
3202 cmini(ckxech); /* (fall thru) */
3204 case -3: /* Empty command OK at top level */
3205 repars = 0; /* Don't need to reparse. */
3206 continue; /* Go back and get another command. */
3208 default: /* Command was successful. */
3210 debug(F101,"parser preparing to continue","",maclvl);
3212 debug(F101,"parser success","",success);
3213 repars = 0; /* Don't need to reparse. */
3214 continue; /* Go back and get another command. */
3218 debug(F101,"parser breaks out of while loop","",maclvl);
3219 if (m && (cmdlvl < inlevel)) return((int) sstate);
3223 /* Got an action command, return start state. */
3225 return((int) sstate);
3231 Buffering and pacing added by L.I. Kirby, 5A(189), June 1993.
3233 #define OBSIZE 80 /* Size of local character buffer */
3235 static int obn; /* Buffer offset (high water mark) */
3236 static char obuf[OBSIZE+1]; /* OUTPUT buffer. */
3237 static char *obp; /* Pointer to output buffer. */
3238 _PROTOTYP( static int oboc, (char) );
3239 _PROTOTYP( static int xxout, (char *, int) );
3243 xxout(char *obuf, int obsize)
3245 xxout(obuf, obsize) char *obuf; int obsize;
3246 #endif /* CK_ANSIC */
3247 /* xxout */ { /* OUTPUT command's output function */
3250 debug(F101,"xxout obsize","",obsize);
3251 debug(F101,"xxout pacing","",pacing);
3252 debug(F111,"xxout string",obuf,strlen(obuf));
3254 rc = 0; /* Initial return code. */
3255 if (!obuf || (obsize <= 0)) /* Nothing to output. */
3256 goto xxout_x; /* Return successfully */
3258 rc = -1; /* Now assume failure */
3259 if (pacing == 0) { /* Is pacing enabled? */
3260 if ((local ? /* No, write entire string at once */
3261 ttol((CHAR *)obuf, obsize) : /* to communications device */
3262 conxo(obsize, obuf)) /* or to console */
3266 for (i = 0; i < obsize; i++) { /* Write individual chars */
3267 if ((local ? ttoc(obuf[i]) : conoc(obuf[i])) < 0)
3274 if (inecho && local) {
3276 for (i = 0; i < obsize; i++) { /* Write to emulator */
3277 scriptwrtbuf((USHORT)obuf[i]); /* which also logs session */
3279 #endif /* NOLOCAL */
3281 } else if (seslog) { /* or log session here */
3282 logstr((char *) obuf, obsize);
3286 logstr((char *) obuf, obsize);
3288 if (inecho && local) {
3293 rc = 0; /* Success */
3295 obn = 0; /* Reset count */
3296 obp = obuf; /* and pointers */
3297 return(rc); /* return our return code */
3302 Macros for OUTPUT command execution, to make it go faster.
3304 #define obfls() ((xxout(obuf,obn)<0)?-1:0)
3305 #define oboc(c) ((*obp++=(char)(c)),*obp=0,(((++obn)>=OBSIZE)?obfls():0))
3307 #else /* The macros cause some compilers to generate bad code. */
3314 #endif /* CK_ANSIC */
3315 /* oboc */ { /* OUTPUT command's output function */
3317 *obp++ = c; /* Deposit character */
3318 *obp = NUL; /* Flush buffer if it's now full */
3320 return(((++obn) >= OBSIZE) ? xxout(obuf,obn) : 0);
3322 #endif /* COMMENT */
3324 /* Routines for handling local variables -- also see popclvl(). */
3327 freelocal(m) int m; { /* Free local variables */
3328 struct localvar * v, * tv; /* at macro level m... */
3329 debug(F101,"freelocal level","",m);
3331 v = localhead[m]; /* List head for level m */
3333 if (v->lv_name) /* Variable name */
3335 if (v->lv_value) /* Value */
3337 tv = v; /* Save pointer to this node */
3338 v = v->lv_next; /* Get next one */
3339 if (tv) /* Free this one */
3342 localhead[m] = (struct localvar *) NULL; /* Done, set list head to NULL */
3345 #define MAXLOCALVAR 64
3347 /* Return a pointer to the definition of a user-defined variable */
3350 vardef(s,isarray,x1,x2) char * s; int * isarray, * x1, * x2; {
3354 if (!s) return(NULL);
3355 if (!*s) return(NULL);
3361 if ((c = *p) == '%') { /* Scalar variable. */
3362 c = *++p; /* Get ID character. */
3363 p = ""; /* Assume definition is empty */
3366 if (c >= '0' && c <= '9') { /* Digit for macro arg */
3367 if (maclvl < 0) /* Digit variables are global */
3368 return(g_var[c]); /* if no macro is active */
3369 else /* otherwise */
3370 return(m_arg[maclvl][c - '0']); /* they're on the stack */
3371 } else if (isalpha(c)) {
3372 if (isupper(c)) c -= ('a'-'A');
3373 return(g_var[c]); /* Letter for global variable */
3376 } else if (c == '&') { /* Array reference. */
3378 x = arraynam(p,&vbi,&d); /* Get name and subscript */
3379 if (x > -1 || d == -17) {
3382 *x2 = (d == -17) ? 0 : d;
3386 if (chkarray(vbi,d) >= 0) { /* Array is declared? */
3387 vbi -= ARRAYBASE; /* Convert name to index */
3388 if (a_dim[vbi] >= d) { /* If subscript in range */
3391 return((ap) ? ap[d] : NULL);
3398 k = mxlook(mactab,s,nmac);
3399 return((k > -1) ? mactab[k].mval : NULL);
3405 addlocal(p) char * p; {
3406 int x, z, isarray = 0;
3408 struct localvar * v, *prev = (struct localvar *)NULL;
3409 extern int tra_asg; int tra_tmp;
3413 s = vardef(p,&isarray,&x,&z); /* Get definition of variable */
3414 if (isarray) { /* Arrays are handled specially */
3419 if ((v = localhead[cmdlvl])) { /* Already have some at this level? */
3420 while (v) { /* Find end of list */
3425 v = (struct localvar *) malloc(sizeof(struct localvar));
3427 printf("?Failure to allocate storage for local variables");
3430 if (!localhead[cmdlvl]) /* If first, set list head */
3431 localhead[cmdlvl] = v;
3432 else /* Otherwise link previous to this */
3434 prev = v; /* And make this previous */
3435 v->lv_next = (struct localvar *) NULL; /* No next yet */
3437 if (!(v->lv_name = (char *) malloc((int) strlen(p) + 1)))
3439 strcpy(v->lv_name, p); /* Copy name into new node (SAFE) */
3442 if (!(v->lv_value = (char *) malloc((int) strlen(s) + 1)))
3444 strcpy(v->lv_value, s); /* Copy value into new node (SAFE) */
3449 delmac(p,1); /* Delete the original macro */
3455 dolocal() { /* Do the LOCAL command */
3458 char * list[MAXLOCALVAR+2]; /* Up to 64 variables per line */
3460 if ((x = cmtxt("Variable name(s)","",&s,NULL)) < 0)
3463 xwords(s,MAXLOCALVAR,list,0); /* Break up line into "words" */
3465 /* Note: Arrays do not use the localhead list, but have their own stack */
3467 for (i = 1; i < MAXLOCALVAR && list[i]; i++) { /* Go through the list */
3468 if (addlocal(list[i]) < 0)
3471 return(success = 1);
3474 printf("?Failure to allocate storage for local variables");
3479 /* D O O U T P U T -- Returns 0 on failure, 1 on success */
3483 #define SEND_BUFLEN 255
3484 #define sendbufd(x) { osendbuf[sendndx++] = x;\
3485 if (sendndx == SEND_BUFLEN) {dooutput(s,cx); sendndx = 0;}}
3486 #endif /* NOKVERBS */
3488 int outesc = 1; /* Process special OUTPUT escapes */
3491 dooutput(s, cx) char *s; int cx; {
3494 extern char * ssh_cmd;
3495 #endif /* SSHBUILTIN */
3496 int x, xx, y, quote; /* Workers */
3499 is_tn = (local && network && IS_TELNET()) ||
3500 (!local && sstelnet);
3502 debug(F111,"dooutput s",s,(int)strlen(s));
3504 if (local) { /* Condition external line */
3510 if (carrier != CAR_OFF) {
3513 if ((x > -1) && ((x & BM_DCD) == 0)) {
3515 "?Carrier signal required but not present - Try SET CARRIER-WATCH OFF.\n"
3521 "?Problem with serial port or modem or cable - Try SHOW COMMUNICATIONS.\n"
3526 printf("?Connection %s %s is not open or not functioning.\n",
3527 network ? "to" : "on",
3532 if (ttvt(speed,flow) < 0) {
3533 printf("?OUTPUT initialization error\n");
3536 #endif /* NOLOCAL */
3539 if ( network && nettype == NET_SSH && ssh_cas && ssh_cmd &&
3540 !(strcmp(ssh_cmd,"kermit") && strcmp(ssh_cmd,"sftp"))) {
3542 printf("?SSH Subsystem active: %s\n", ssh_cmd);
3545 #endif /* SSHBUILTIN */
3547 if (!cmdgquo()) { /* COMMAND QUOTING OFF */
3548 x = strlen(s); /* Just send the string literally */
3549 xx = local ? ttol((CHAR *)s,x) : conxo(x,s);
3550 return(success = (xx == x) ? 1 : 0);
3552 quote = 0; /* Initialize backslash (\) quote */
3553 obn = 0; /* Reset count */
3554 obp = obuf; /* and pointers */
3557 while ((x = *s++)) { /* Loop through the string */
3558 y = 0; /* Error code, 0 = no error. */
3559 debug(F000,"dooutput","",x);
3560 if (quote) { /* This character is quoted */
3562 if (x == 'k' || x == 'K') { /* \k or \K */
3563 extern struct keytab kverbs[];
3565 extern char * keydefptr;
3568 int x, y, brace = 0;
3571 char kbuf[K_BUFLEN + 1]; /* Key verb name buffer */
3572 char osendbuf[SEND_BUFLEN +1];
3575 if (xxout(obuf,obn) < 0) /* Flush buffer */
3577 debug(F100,"OUTPUT KVERB","",0); /* Send a KVERB */
3578 { /* Have K verb? */
3583 We assume that the verb name is {braced}, or it extends to the end of the
3584 string, s, or it ends with a space, control character, or backslash.
3586 p = kbuf; /* Copy verb name into local buffer */
3588 while ((x++ < K_BUFLEN) && (*s > SP) && (*s != CMDQ)) {
3589 if (brace && *s == '}') {
3594 if (*s && !brace) /* If we broke because of \, etc, */
3595 s--; /* back up so we get another look. */
3597 *p = NUL; /* Terminate. */
3598 p = kbuf; /* Point back to beginning */
3599 debug(F110,"dooutput kverb",p,0);
3600 y = xlookup(kverbs,p,nkverbs,&x); /* Look it up */
3601 debug(F101,"dooutput lookup",0,y);
3604 dooutput(osendbuf,cx);
3609 } else { /* Is it a macro? */
3610 y = mxlook(mactab,p,nmac);
3613 keymac = 1; /* Flag for key macro active */
3614 keymacx = y; /* Key macro index */
3615 keydefptr = s; /* Where to resume next time */
3616 debug(F111,"dooutput mxlook",keydefptr,y);
3626 #endif /* NOKVERBS */
3627 if (outesc && (x == 'n' || x == 'N')) { /* \n or \N */
3628 if (xxout(obuf,obn) < 0) /* Flush buffer */
3630 debug(F100,"OUTPUT NUL","",0); /* Send a NUL */
3638 } else if (outesc && (x == 'b' || x == 'B')) { /* \b or \B */
3640 if (xxout(obuf,obn) < 0) /* Flush buffer first */
3642 debug(F100,"OUTPUT BREAK","",0);
3644 ttsndb(); /* Send BREAK signal */
3650 #endif /* NOLOCAL */
3651 quote = 0; /* Turn off quote flag */
3652 continue; /* and not the b or B */
3654 } else if (outesc && (x == 'l' || x == 'L')) { /* \l or \L */
3655 if (xxout(obuf,obn) < 0) /* Flush buffer first */
3657 debug(F100,"OUTPUT Long BREAK","",0);
3659 ttsndlb(); /* Send Long BREAK signal */
3665 #endif /* NOLOCAL */
3666 quote = 0; /* Turn off quote flag */
3667 continue; /* and not the l or L */
3668 #endif /* CK_LBRK */
3670 } else if (x == CMDQ) { /* Backslash itself */
3671 debug(F100,"OUTPUT CMDQ","",0);
3672 xx = oboc(dopar(CMDQ)); /* Output the backslash. */
3678 } else { /* if \ not followed by special esc */
3679 /* Note: Atari ST compiler won't allow macro call in "if ()" */
3680 xx = oboc(dopar(CMDQ)); /* Output the backslash. */
3683 quote = 0; /* Turn off quote flag */
3685 } else if (x == CMDQ) { /* This is the quote character */
3686 quote = 1; /* Go back and get next character */
3687 continue; /* which is quoted */
3689 xx = oboc(dopar((char)x)); /* Output this character */
3690 debug(F111,"dooutput",obuf,obn);
3694 if (seslog && duplex) { /* Log the character if log is on */
3697 #endif /* COMMENT */
3698 if (x == '\015') { /* String contains carriage return */
3699 int stuff = -1, stuff2 = -1;
3700 if (tnlm) { /* TERMINAL NEWLINE ON */
3701 stuff = LF; /* Stuff LF */
3704 /* TELNET NEWLINE ON/OFF/RAW */
3706 switch (TELOPT_ME(TELOPT_BINARY) ? /* NVT or BINARY */
3723 if (stuff > -1) { /* Stuffing another character... */
3724 xx = oboc(dopar((CHAR)stuff));
3728 if (seslog && duplex) { /* Log stuffed char if appropriate */
3729 logchar((char)stuff);
3731 #endif /* COMMENT */
3733 if (stuff2 > -1) { /* Stuffing another character... */
3734 xx = oboc(dopar((CHAR)stuff2));
3738 if (seslog && duplex) { /* Log stuffed char if appropriate */
3739 logchar((char)stuff2);
3741 #endif /* COMMENT */
3743 if (xxout(obuf,obn) < 0) /* Flushing is required here! */
3747 if (cx == XXLNOUT) {
3752 if (quote == 1) /* String ended with backslash */
3753 xx = oboc(dopar(CMDQ));
3755 if (obn > 0) /* OUTPUT done */
3756 if (xxout(obuf,obn) < 0) /* Flush the buffer if necessary. */
3760 outerr: /* OUTPUT command error handler */
3761 if (msgflg) printf("?OUTPUT execution error\n");
3764 /* Remove "local" OUTPUT macro defininitions */
3767 /* No more macros ... */
3770 #endif /* COMMENT */
3774 /* Display version herald and initial prompt */
3779 extern int srvcdmsg;
3780 extern char * cdmsgfile[];
3786 extern char * bannerfile;
3787 debug(F110,"herald bannerfile",bannerfile,0);
3789 concb((char)escape);
3790 if (dotype(bannerfile,1,0,0,NULL,0,NULL,0,0,NULL,0) > 0) {
3791 debug(F111,"herald","srvcdmsg",srvcdmsg);
3793 for (i = 0; i < 8; i++) {
3794 debug(F111,"herald cdmsgfile[i]",cdmsgfile[i],i);
3795 if (zchki(cdmsgfile[i]) > -1) {
3797 dotype(cdmsgfile[i],
3798 xaskmore,0,0,NULL,0,NULL,0,0,NULL,0);
3809 /* The following generates bad code in SCO compilers. */
3810 /* Observed in both OSR5 and Unixware 2 -- after executing this */
3811 /* statement when all conditions are false, x has a value of -32. */
3812 if (noherald || quiet || bgset > 0 || (bgset != 0 && backgrd != 0))
3816 if (noherald || quiet)
3820 else if (bgset < 0 && backgrd > 0)
3822 #endif /* COMMENT */
3827 #ifdef CK_AUTHENTICATION
3837 #endif /* CK_AUTHENTICATION */
3841 printf("%s, for%s\n",versio,ckxsys);
3844 printf("%s, for%s\n",versio,ckxsys);
3847 printf("%s, for%s%s%s%s (64-bit)\n\r",versio,ckxsys,ssl,krb4,krb5);
3849 printf("%s, for%s%s%s%s\n\r",versio,ckxsys,ssl,krb4,krb5);
3850 #endif/* CK_64BIT */
3852 #endif /* datageneral */
3853 printf(" Copyright (C) 1985, %s,\n", ck_cryear);
3854 printf(" Trustees of Columbia University in the City of New York.\n");
3859 if (!quiet && !backgrd) {
3861 /* "Default file-transfer mode is AUTOMATIC" is useless information... */
3863 extern int xfermode;
3867 if (xfermode == XMODE_A) {
3870 s = gfmode(binary,1);
3875 printf("Default file-transfer mode is %s\n", s);
3876 #endif /* COMMENT */
3878 debug(F111,"herald","srvcdmsg",srvcdmsg);
3880 for (i = 0; i < 8; i++) {
3881 debug(F111,"herald cdmsgfile[i]",cdmsgfile[i],i);
3882 if (zchki(cdmsgfile[i]) > -1) {
3884 dotype(cdmsgfile[i],
3885 xaskmore,0,0,NULL,0,NULL,0,0,NULL,0);
3890 printf("Type ? or HELP for help.\n");
3895 /* G F M O D E -- Get File (transfer) Mode */
3898 gfmode(binary,upcase) int binary, upcase; {
3901 case XYFT_T: s = upcase ? "TEXT" : "text"; break;
3903 case XYFT_B: s = upcase ? "BINARY FIXED" : "binary fixed"; break;
3904 case XYFT_I: s = upcase ? "IMAGE" : "image"; break;
3905 case XYFT_L: s = upcase ? "LABELED" : "labeled"; break;
3906 case XYFT_U: s = upcase ? "BINARY UNDEF" : "binary undef"; break;
3909 case XYFT_B: s = upcase ? "BINARY" : "binary"; break;
3910 case XYFT_M: s = upcase ? "MACBINARY" : "macbinary"; break;
3912 case XYFT_B: s = upcase ? "BINARY" : "binary"; break;
3914 case XYFT_L: s = upcase ? "LABELED" : "labeled"; break;
3915 #endif /* CK_LABELED */
3918 case XYFT_X: s = upcase ? "TENEX" : "tenex"; break;
3926 isaa(s) char * s; { /* Is associative array */
3932 while ((c = *s++)) {
3935 return ((*(s+x-1) == '>') ? 1 : 0);
3941 /* M L O O K -- Lookup the macro name in the macro table */
3944 Call this way: v = mlook(table,word,n);
3946 table - a 'struct mtab' table.
3947 word - the target string to look up in the table.
3948 n - the number of elements in the table.
3950 The keyword table must be arranged in ascending alphabetical order, and
3951 all letters must be lowercase.
3953 Returns the table index, 0 or greater, if the name was found, or:
3955 -3 if nothing to look up (target was null),
3959 A match is successful if the target matches a keyword exactly, or if
3960 the target is a prefix of exactly one keyword. It is ambiguous if the
3961 target matches two or more keywords from the table.
3964 mlook(table,cmd,n) struct mtab table[]; char *cmd; int n; {
3966 int v, w, cmdlen = 0;
3967 char c = 0, c1, * s;
3970 for (s = cmd; *s; s++) cmdlen++; /* (instead of strlen) */
3971 debug(F111,"MLOOK",cmd,cmdlen);
3979 /* Not null, look it up */
3981 if (n < 12) { /* Not worth it for small tables */
3983 } else { /* Binary search for where to start */
3987 while (lo+2 < hi && ++count < 12) {
3988 i = lo + ((hi - lo) / 2);
3989 c = *(table[i].kwd);
3990 if (isupper(c)) c = tolower(c);
3997 i = (c < c1) ? lo+1 : lo;
3999 for ( ; i < n-1; i++) {
4002 if (!*s) continue; /* Empty table entry */
4004 if (isupper(c)) c = tolower(c);
4005 if (c1 != c) continue; /* First char doesn't match */
4006 if (!ckstrcmp(s,cmd,-1,0)) /* Have exact match? */
4008 v = !ckstrcmp(s,cmd,cmdlen,0);
4009 w = ckstrcmp(table[i+1].kwd,cmd,cmdlen,0);
4010 if (v && w) /* Have abbreviated match? */
4012 if (v) /* Ambiguous? */
4014 if (w > 0) /* Past our alphabetic area? */
4018 /* Last (or only) element */
4020 if (!ckstrcmp(table[n-1].kwd,cmd,cmdlen,0))
4026 /* mxlook is like mlook, but an exact full-length match is required */
4029 mxlook(table,cmd,n) char *cmd; struct mtab table[]; int n; {
4031 int w, cmdlen = 0, one = 0;
4032 register char c = 0, c1, * s;
4034 if (!cmd) cmd = ""; /* Check args */
4036 for (s = cmd; *s; s++) cmdlen++; /* (instead of strlen) */
4037 debug(F111,"MXLOOK",cmd,cmdlen);
4039 c1 = *cmd; /* First char of string to look up */
4042 if (!*(cmd+1)) /* Special handling for 1-char names */
4045 if (cmdlen < 1) /* Nothing to look up */
4048 if (n < 12) { /* Not worth it for small tables */
4050 } else { /* Binary search for where to start */
4054 while (lo+2 < hi && ++count < 12) {
4055 i = lo + ((hi - lo) / 2);
4056 c = *(table[i].kwd);
4057 if (isupper(c)) c = tolower(c);
4064 i = (c < c1) ? lo+1 : lo;
4066 for ( ; i < n; i++) { /* Look thru table */
4067 s = table[i].kwd; /* This entry */
4069 if (!*s) continue; /* Empty table entry */
4071 if (isupper(c)) c = tolower(c);
4072 if (c1 != c) continue; /* First char doesn't match */
4073 if (one) { /* Name is one char long */
4075 return(i); /* So is table entry */
4078 if (((int)strlen(s) == cmdlen) &&
4079 (!ckstrcmp(s,cmd,cmdlen,0))) return(i);
4081 w = ckstrcmp(s,cmd,-1,0);
4083 if (w > 0) return(-1);
4084 #endif /* COMMENT */
4089 /* mxxlook is like mxlook, but case-sensitive */
4092 mxxlook(table,cmd,n) char *cmd; struct mtab table[]; int n; {
4095 if (((cmdlen = strlen(cmd)) < 1) || (n < 1)) return(-3);
4096 /* debug(F111,"mxxlook target",cmd,n); */
4097 for (i = 0; i < n; i++) {
4098 if (((int)strlen(table[i].kwd) == cmdlen) &&
4099 (!strncmp(table[i].kwd,cmd,cmdlen)))
4106 traceval(nam, val) char * nam, * val; { /* For TRACE command */
4108 printf(">>> %s: \"%s\"\n", nam, val);
4110 printf(">>> %s: (undef)\n", nam);
4114 #ifdef USE_VARLEN /* Not used */
4116 /* V A R L E N -- Get length of variable's value.
4118 Given a variable name, return the length of its definition or 0 if the
4119 variable is not defined. If it is defined, set argument s to point to its
4120 definition. Otherwise set s to NULL.
4123 varlen(nam,s) char *nam; char **s; { /* Length of value of variable */
4128 if (!nam) return(0); /* Watch out for null pointer */
4131 if (*nam == '%') { /* If it's a variable name */
4132 if (!(c = *(nam+1))) return(0); /* Get letter or digit */
4133 p = (char *)0; /* Initialize value pointer */
4134 if (maclvl > -1 && c >= '0' && c <= '9') { /* Digit? */
4135 p = m_arg[maclvl][c - '0']; /* Pointer from macro-arg table */
4136 } else { /* It's a global variable */
4137 if (c < 33 || c > GVARS) return(0);
4138 p = g_var[c]; /* Get pointer from global-var table */
4140 } else if (*nam == '&') { /* An array reference? */
4142 if (arraynam(nam,&x,&z) < 0) /* If syntax is bad */
4143 return(-1); /* return -1. */
4144 x -= ARRAYBASE; /* Convert name to number. */
4145 if ((q = a_ptr[x]) == NULL) /* If array not declared, */
4146 return(0); /* return -2. */
4147 if (z > a_dim[x]) /* If subscript out of range, */
4148 return(0); /* return -3. */
4151 } else { /* Macro */
4153 x = z ? mxxlook(mactab,nam,nmac) : mlook(mactab,nam,nmac);
4162 return((int)strlen(p));
4164 #endif /* USE_VARLEN */
4167 This routine is for the benefit of those compilers that can't handle
4168 long string constants or continued lines within them. Long predefined
4169 macros like FOR, WHILE, and XIF have their contents broken up into
4170 arrays of string pointers. This routine concatenates them back into a
4171 single string again, and then calls the real addmac() routine to enter
4172 the definition into the macro table.
4175 addmmac(nam,s) char *nam, *s[]; { /* Add a multiline macro definition */
4176 int i, x, y; char *p;
4177 x = 0; /* Length counter */
4178 for (i = 0; (y = (int)strlen(s[i])) > 0; i++) { /* Add up total length */
4179 debug(F111,"addmmac line",s[i],y);
4182 debug(F101,"addmmac lines","",i);
4183 debug(F101,"addmmac loop exit","",y);
4184 debug(F111,"addmmac length",nam,x);
4185 if (x < 0) return(-1);
4187 p = malloc(x+1); /* Allocate space for all of it. */
4189 printf("?addmmac malloc error: %s\n",nam);
4190 debug(F110,"addmmac malloc error",nam,0);
4193 *p = '\0'; /* Start off with null string. */
4194 for (i = 0; *s[i]; i++) /* Concatenate them all together. */
4195 ckstrncat(p,s[i],x+1);
4196 y = (int)strlen(p); /* Final precaution. */
4197 debug(F111,"addmmac constructed string",p,y);
4199 y = addmac(nam,p); /* Add result to the macro table. */
4201 debug(F100,"addmmac length mismatch","",0);
4202 printf("\n!addmmac internal error!\n");
4205 free(p); /* Free the temporary copy. */
4209 /* Here is the real addmac routine. */
4211 /* Returns -1 on failure, macro table index >= 0 on success. */
4216 addmac(nam,def) char *nam, *def; { /* Add a macro to the macro table */
4217 int i, x, y, z, namlen, deflen, flag = 0;
4218 int replacing = 0, deleting = 0;
4219 char * p = NULL, c, *s;
4220 extern int tra_asg; int tra_tmp;
4222 if (!nam) return(-1);
4223 if (!*nam) return(-1);
4229 #else /* IKSDCONF */
4231 #endif /* IKSDCONF */
4233 if (!ckstrcmp("on_exit",nam,-1,0) ||
4234 !ckstrcmp("on_logout",nam,-1,0))
4241 while (*p++) namlen++; /* (instead of strlen) */
4243 tra_tmp = tra_asg; /* trace... */
4244 debug(F111,"addmac nam",nam,namlen);
4245 if (!def) { /* Watch out for null pointer */
4247 debug(F111,"addmac def","(null pointer)",deflen);
4251 while (*p++) deflen++; /* (instead of strlen) */
4252 debug(F010,"addmac def",def,0);
4254 #ifdef USE_VARLEN /* NOT USED */
4255 /* This does not boost performance much because varlen() does a lot */
4257 if (x > 0 && x >= deflen) {
4258 strcpy(s,def); /* NOT USED */
4262 #endif /* USE_VARLEN */
4264 if (*nam == CMDQ) nam++; /* Backslash quote? */
4265 if (*nam == '%') { /* Yes, if it's a variable name, */
4266 if (!(c = *(nam + 1))) return(-1); /* Variable name letter or digit */
4269 delmac(nam,0); /* Delete any old value. */
4272 if (deflen < 1) { /* Null definition */
4273 p = NULL; /* Better not malloc or strcpy! */
4274 } else if (!flag) { /* A substantial definition */
4275 p = malloc(deflen + 1); /* Allocate space for it */
4277 printf("?addmac malloc error 2\n");
4279 } else strcpy(p,def); /* Copy def into new space (SAFE) */
4282 /* Now p points to the definition, or is a null pointer */
4284 if (c >= '0' && c <= '9') { /* \%0-9 variable */
4285 if (maclvl < 0) { /* Are we calling or in a macro? */
4286 g_var[c] = p; /* No, it's top level one */
4287 makestr(&(toparg[c - '0']),p); /* Take care \&_[] too */
4288 } else { /* Yes, it's a macro argument */
4289 m_arg[maclvl][c - '0'] = p; /* Assign the value */
4290 makestr(&(m_xarg[maclvl][c - '0']),p); /* And a copy here */
4292 } else { /* It's a \%a-z variable */
4293 if (c < 33 || (unsigned int)c > GVARS) return(-1);
4294 if (isupper(c)) c = (char) tolower(c);
4295 g_var[c] = p; /* Put pointer in global-var table */
4297 if (tra_asg) traceval(nam,p);
4299 } else if (*nam == '&') { /* An array reference? */
4302 if ((y = arraynam(nam,&x,&z)) < 0) /* If syntax is bad */
4303 return(-1); /* return -1. */
4304 if (chkarray(x,z) < 0) /* If array not declared or */
4305 rc = -2; /* subscript out of range, ret -2 */
4308 delmac(nam,0); /* Delete any old value. */
4311 x -= ARRAYBASE; /* Convert name letter to index. */
4312 if (x > 'z' - ARRAYBASE + 1)
4315 if ((q = a_ptr[x]) == NULL) /* If array not declared, */
4316 return(-3); /* return -3. */
4322 if ((p = malloc(deflen+1)) == NULL) { /* Allocate space */
4323 printf("addmac macro error 7: %s\n",nam);
4324 return(-4); /* for new def, return -4 on fail. */
4326 strcpy(p,def); /* Copy def into new space (SAFE). */
4329 q[z] = p; /* Store pointer to it. */
4330 if (x == 0) { /* Arg vector array */
4331 if (z >= 0 && z <= 9) { /* Copy values to corresponding */
4332 if (maclvl < 0) { /* \%1..9 variables. */
4333 makestr(&(toparg[z]),p);
4335 makestr(&(m_arg[maclvl][z]),p);
4339 if (tra_asg) traceval(nam,p);
4340 return(0); /* Done. */
4343 /* Not a macro argument or a variable, so it's a macro definition */
4347 if (tra_asg) traceval(nam,p);
4350 #endif /* USE_VARLEN */
4351 x = isaa(nam) ? /* If it's an associative array */
4352 mxxlook(mactab,nam,nmac) : /* look it up this way */
4353 mxlook(mactab,nam,nmac); /* otherwise this way. */
4354 if (x > -1) { /* If found... */
4355 if (deflen > 0) /* and a new definition was given */
4356 replacing = 1; /* we're replacing */
4357 else /* otherwise */
4358 deleting = 1; /* we're deleting */
4360 if (deleting) { /* Deleting... */
4361 if (delmac(nam,0) < 0)
4364 if (tra_asg) traceval(nam,p);
4366 } else if (deflen < 1) /* New macro with no definition */
4367 return(0); /* Nothing to do. */
4369 if (replacing) { /* Replacing an existing macro */
4370 if (mactab[x].mval) { /* If it currently has a definition, */
4371 free(mactab[x].mval); /* free it. */
4372 mactab[x].mval = NULL;
4375 y = x; /* Replacement index. */
4377 } else { /* Adding a new macro... */
4378 char c1, c2; /* Use fast lookup to find the */
4379 c1 = *nam; /* alphabetical slot. */
4380 if (isupper(c1)) c1 = (char) tolower(c1);
4382 if (nmac < 5) { /* Not worth it for small tables */
4384 } else { /* First binary search to find */
4385 int lo = 0; /* where to start */
4389 while (lo+2 < hi && ++count < 12) {
4390 y = lo + ((hi - lo) / 2);
4391 c = *(mactab[y].kwd);
4392 if (isupper(c)) c = (char) tolower(c);
4399 y = (c < c1) ? lo+1 : lo;
4401 /* Now search linearly from starting location */
4402 for ( ; y < MAC_MAX && mactab[y].kwd != NULL; y++) {
4403 c2 = *(mactab[y].kwd);
4404 if (isupper(c2)) c2 = (char) tolower(c2);
4409 if (ckstrcmp(nam,mactab[y].kwd,-1,0) <= 0)
4412 if (y == MAC_MAX) { /* Macro table is full. */
4413 debug(F101,"addmac table overflow","",y);
4414 printf("?Macro table overflow\n");
4417 if (mactab[y].kwd != NULL) { /* Must insert */
4418 for (i = nmac; i > y; i--) { /* Move the rest down one slot */
4419 mactab[i].kwd = mactab[i-1].kwd;
4420 mactab[i].mval = mactab[i-1].mval;
4421 mactab[i].flgs = mactab[i-1].flgs;
4425 p = malloc(namlen + 1); /* Allocate space for name */
4427 printf("?Addmac: Out of memory - \"%s\"\n",nam);
4430 strcpy(p,nam); /* Copy name into new space (SAFE) */
4431 mactab[y].kwd = p; /* Add pointer to table */
4433 if (deflen > 0) { /* If we have a definition */
4434 p = malloc(deflen + 1); /* Get space */
4436 printf("?Space exhausted - \"%s\"\n", nam);
4437 if (mactab[y].kwd) {
4438 free(mactab[y].kwd);
4439 mactab[y].kwd = NULL;
4443 strcpy(p,def); /* Copy the definition (SAFE) */
4445 } else { /* definition is empty */
4448 mactab[y].mval = p; /* Macro points to definition */
4449 mactab[y].flgs = 0; /* No flags */
4450 if (!replacing) /* If new macro */
4451 nmac++; /* count it */
4452 if (tra_asg) traceval(nam,p);
4457 xdelmac(x) int x; { /* Delete a macro given its index */
4460 if (x < 0) return(x);
4462 traceval(mactab[x].kwd,NULL);
4464 if (mactab[x].kwd) { /* Free the storage for the name */
4465 free(mactab[x].kwd);
4466 mactab[x].kwd = NULL;
4468 if (mactab[x].mval) { /* and for the definition */
4469 free(mactab[x].mval);
4470 mactab[x].mval = NULL;
4472 for (i = x; i < nmac; i++) { /* Now move up the others. */
4473 mactab[i].kwd = mactab[i+1].kwd;
4474 mactab[i].mval = mactab[i+1].mval;
4475 mactab[i].flgs = mactab[i+1].flgs;
4477 nmac--; /* One less macro */
4479 mactab[nmac].kwd = NULL; /* Delete last item from table */
4480 mactab[nmac].mval = NULL;
4481 mactab[nmac].flgs = 0;
4487 delmac(nam,exact) char *nam; int exact; { /* Delete the named macro */
4492 if (!nam) return(0); /* Watch out for null pointer */
4493 debug(F110,"delmac nam",nam,0);
4498 #else /* IKSDCONF */
4500 #endif /* IKSDCONF */
4502 if (!ckstrcmp("on_exit",nam,-1,0) ||
4503 !ckstrcmp("on_logout",nam,-1,0))
4508 if (*nam == CMDQ) nam++;
4509 if (*nam == '%') { /* If it's a variable name */
4510 if (!(c = *(nam+1))) return(0); /* Get variable name letter or digit */
4511 p = (char *)0; /* Initialize value pointer */
4512 if (maclvl < 0 && c >= '0' && c <= '9') { /* Top-level digit? */
4513 p = toparg[c - '0'];
4514 if (p) if (p != g_var[c]) {
4516 toparg[c - '0'] = NULL;
4519 g_var[c] = NULL; /* Zero the table entry */
4520 } else if (maclvl > -1 && c >= '0' && c <= '9') { /* Digit? */
4521 p = m_xarg[maclvl][c - '0'];
4522 if (p) if (p != g_var[c]) {
4524 m_xarg[maclvl][c - '0'] = NULL;
4526 p = m_arg[maclvl][c - '0']; /* Get pointer from macro-arg table */
4527 m_arg[maclvl][c - '0'] = NULL; /* Zero the table pointer */
4528 } else { /* It's a global variable */
4529 if (c < 33 || (unsigned int)c > GVARS) return(0);
4530 p = g_var[c]; /* Get pointer from global-var table */
4531 g_var[c] = NULL; /* Zero the table entry */
4534 debug(F010,"delmac def",p,0);
4535 free(p); /* Free the storage */
4537 } else debug(F110,"delmac def","(null pointer)",0);
4538 if (tra_asg) traceval(nam,NULL);
4541 if (*nam == '&') { /* An array reference? */
4543 if (arraynam(nam,&x,&z) < 0) /* If syntax is bad */
4544 return(-1); /* return -1. */
4545 x -= ARRAYBASE; /* Convert name to number. */
4546 if ((q = a_ptr[x]) == NULL) /* If array not declared, */
4547 return(-2); /* return -2. */
4548 if (z > a_dim[x]) /* If subscript out of range, */
4549 return(-3); /* return -3. */
4550 if (q[z]) { /* If there is an old value, */
4551 debug(F010,"delmac def",q[z],0);
4552 if (x != 0) /* Macro arg vector is just a copy */
4553 free(q[z]); /* Others are real so free them */
4555 if (x == 0) { /* Arg vector array */
4556 if (z >= 0 && z <= 9) { /* Copy values to corresponding */
4557 if (maclvl < 0) { /* \%1..9 variables. */
4558 makestr(&(toparg[z]),NULL);
4560 makestr(&(m_arg[maclvl][z]),NULL);
4564 if (tra_asg) traceval(nam,NULL);
4565 } else debug(F010,"delmac def","(null pointer)",0);
4568 /* Not a variable or an array, so it must be a macro. */
4571 debug(F111,"delmac isaa",nam,z);
4572 debug(F111,"delmac exact",nam,exact);
4573 x = z ? mxxlook(mactab,nam,nmac) :
4574 exact ? mxlook(mactab,nam,nmac) :
4575 mlook(mactab,nam,nmac);
4577 debug(F111,"delmac mlook",nam,x);
4584 initmac() { /* Init macro & variable tables */
4587 nmac = 0; /* No macros */
4588 for (i = 0; i < MAC_MAX; i++) { /* Initialize the macro table */
4589 mactab[i].kwd = NULL;
4590 mactab[i].mval = NULL;
4594 x = (MAXARGLIST + 1) * sizeof(char **);
4595 for (i = 0; i < MACLEVEL; i++) { /* Init the macro argument tables */
4596 m_xarg[i] = (char **) malloc(x);
4597 mrval[i] = NULL; /* Macro return value */
4598 /* Pointer to entire argument vector, level i, for \&_[] array */
4599 for (j = 0; j <= MAXARGLIST; j++) { /* Macro argument list */
4600 if (j < 10) /* For the \%0..\%9 variables */
4601 m_arg[i][j] = NULL; /* Pointer to arg j, level i. */
4602 if (m_xarg[i]) /* For \&_[] - all args. */
4603 m_xarg[i][j] = NULL;
4606 for (i = 0; i < GVARS; i++) { /* And the global variables table */
4609 /* And the table of arrays */
4610 for (i = 0; i < (int) 'z' - ARRAYBASE + 1; i++) {
4611 a_ptr[i] = (char **) NULL; /* Null pointer for each */
4612 a_dim[i] = 0; /* and a dimension of zero */
4614 for (j = 0; j < CMDSTKL; j++) {
4615 aa_ptr[j][i] = (char **) NULL;
4622 popclvl() { /* Pop command level, return cmdlvl */
4624 struct localvar * v;
4626 debug(F101,"popclvl cmdlvl","",cmdlvl);
4628 if ((v = localhead[cmdlvl])) { /* Did we save any variables? */
4629 while (v) { /* Yes */
4630 if (v->lv_value) /* Copy old ones back */
4631 addmac(v->lv_name,v->lv_value);
4633 delmac(v->lv_name,1);
4636 freelocal(cmdlvl); /* Free local storage */
4638 /* Automatic arrays do not use the localhead list */
4640 for (i = 0; i < 28; i++) { /* Free any local arrays */
4641 if (aa_ptr[cmdlvl][i]) { /* Does this one exist? */
4642 dclarray((char)(i+ARRAYBASE),-1); /* Destroy global one */
4643 a_ptr[i] = aa_ptr[cmdlvl][i];
4644 a_dim[i] = aa_dim[cmdlvl][i];
4645 aa_ptr[cmdlvl][i] = (char **)NULL;
4646 aa_dim[cmdlvl][i] = 0;
4647 } else if (aa_dim[cmdlvl][i] == -23) { /* Secret code */
4648 dclarray((char)(i+ARRAYBASE),-1); /* (see pusharray()) */
4649 aa_ptr[cmdlvl][i] = (char **)NULL;
4650 aa_dim[cmdlvl][i] = 0;
4653 /* Otherwise do nothing - it is a local array that was declared */
4654 /* at a level above this one so leave it alone. */
4657 if (cmdlvl < 1) { /* If we're already at top level */
4658 cmdlvl = 0; /* just make sure all the */
4659 tlevel = -1; /* stack pointers are set right */
4660 maclvl = -1; /* and return */
4661 } else if (cmdstk[cmdlvl].src == CMD_TF) { /* Reading from TAKE file? */
4662 debug(F101,"popclvl tlevel","",tlevel);
4663 if (tlevel > -1) { /* Yes, */
4664 fclose(tfile[tlevel]); /* close it */
4667 printf("[%d] -F: \"%s\"\n",cmdlvl,tfnam[tlevel]);
4668 debug(F111,"CMD -F",tfnam[tlevel],cmdlvl);
4669 if (tfnam[tlevel]) { /* free storage for name */
4670 free(tfnam[tlevel]);
4671 tfnam[tlevel] = NULL;
4673 tlevel--; /* and pop take level */
4674 cmdlvl--; /* and command level */
4675 quiet = xquiet[cmdlvl];
4676 vareval = xvarev[cmdlvl];
4679 } else if (cmdstk[cmdlvl].src == CMD_MD) { /* In a macro? */
4680 topcmd = lastcmd[maclvl];
4681 debug(F101,"popclvl maclvl","",maclvl);
4682 if (maclvl > -1) { /* Yes, */
4686 #endif /* COMMENT */
4687 macp[maclvl] = ""; /* set macro pointer to null string */
4688 *cmdbuf = '\0'; /* clear the command buffer */
4690 if ((maclvl > 0) && /* 2 May 1999 */
4691 (m_arg[maclvl-1][0]) &&
4692 (!strncmp(m_arg[maclvl-1][0],"_xif",4) ||
4693 !strncmp(m_arg[maclvl-1][0],"_for",4) ||
4694 !strncmp(m_arg[maclvl-1][0],"_swi",4) ||
4695 !strncmp(m_arg[maclvl-1][0],"_whi",4)) &&
4697 makestr(&(mrval[maclvl-1]),mrval[maclvl+1]);
4699 if (maclvl+1 < MACLEVEL) {
4700 if (mrval[maclvl+1]) { /* Free any deeper return values. */
4701 free(mrval[maclvl+1]);
4702 mrval[maclvl+1] = NULL;
4706 printf("[%d] -M: \"%s\"\n",cmdlvl,m_arg[cmdstk[cmdlvl].lvl][0]);
4707 debug(F111,"CMD -M",m_arg[cmdstk[cmdlvl].lvl][0],cmdlvl);
4709 maclvl--; /* Pop macro level */
4710 cmdlvl--; /* and command level */
4711 debug(F101,"popclvl mac new maclvl","",maclvl);
4712 debug(F010,"popclvl mac mrval[maclvl+1]",mrval[maclvl+2],0);
4714 quiet = xquiet[cmdlvl];
4715 vareval = xvarev[cmdlvl];
4717 a_ptr[0] = m_xarg[maclvl];
4718 a_dim[0] = n_xarg[maclvl] - 1;
4719 debug(F111,"a_dim[0]","B",a_dim[0]);
4722 a_dim[0] = topargc - 1;
4723 debug(F111,"a_dim[0]","C",a_dim[0]);
4729 debug(F101,"popclvl topcmd","",topcmd);
4730 if (topcmd == XXSEXP) {
4731 extern char * sexpval;
4732 makestr(&(mrval[maclvl+1]),sexpval);
4738 debug(F101,"popclvl cmdlvl","",cmdlvl);
4739 if (prstring[cmdlvl]) {
4740 cmsetp(prstring[cmdlvl]);
4741 makestr(&(prstring[cmdlvl]),NULL);
4744 if (cmdlvl < 1 || xcmdsrc == CMD_KB) { /* If at prompt */
4746 concb((char)escape); /* Go into cbreak mode */
4749 xcmdsrc = cmdstk[cmdlvl].src;
4750 debug(F101,"popclvl xcmdsrc","",xcmdsrc);
4751 debug(F101,"popclvl tlevel","",tlevel);
4752 return(cmdlvl < 1 ? 0 : cmdlvl); /* Return command level */
4754 #else /* No script programming language */
4755 int popclvl() { /* Just close current take file. */
4756 if (tlevel > -1) { /* if any... */
4757 if (tfnam[tlevel]) {
4758 free(tfnam[tlevel]);
4759 tfnam[tlevel] = NULL;
4761 fclose(tfile[tlevel--]);
4763 if (tlevel == -1) { /* And if back at top level */
4765 concb((char)escape); /* and go back into cbreak mode. */
4767 xcmdsrc = tlevel > -1 ? CMD_TF : 0;
4775 iseom(m) char * m; { /* Test if at end of macro def */
4778 debug(F111,"iseom",m,maclvl);
4780 /* Anything but Space and Comma means more macro is left */
4781 if ((*m > SP) && (*m != ',')) {
4782 debug(F111,"iseom return",m,0);
4787 debug(F111,"iseom return",m,1);
4788 return(1); /* Nothing left */
4792 /* Pop all command levels that can be popped */
4796 if (cmdlvl > 0) { /* If command level is > 0 and... */
4799 ((cmdstk[cmdlvl].src == CMD_TF) && /* Command source is file */
4802 feof(tfile[tlevel])) /* And at end of file... */
4804 /* Or command source is macro... */
4805 || ((cmdstk[cmdlvl].src == CMD_MD) &&
4807 iseom(macp[maclvl]))) /* and at end of macro, then... */
4810 popclvl(); /* pop command level. */
4813 return(cmdlvl < 1 ? 0 : cmdlvl); /* Return command level */
4816 /* STOP - get back to C-Kermit prompt, no matter where from. */
4821 while (popclvl()) ; /* Pop all macros & take files */
4823 if (cmddep > -1) /* And all recursive cmd pkg invocations */
4824 while (cmpop() > -1) ;
4826 cmini(ckxech); /* Clear the command buffer. */
4830 /* Close the given log */
4833 doclslog(x) int x; {
4839 printf("?Debugging log wasn't open\n");
4842 debug(F100,"Debug Log Closed","",0L);
4845 return(zclose(ZDFILE));
4851 printf("?Packet log wasn't open\n");
4856 return(zclose(ZPFILE));
4862 printf("?Session log wasn't open\n");
4867 return(zclose(ZSFILE));
4868 #endif /* NOLOCAL */
4873 extern int iklogopen, xferlog;
4881 printf("?Transaction log wasn't open\n");
4885 if (iklogopen && !inserver) {
4891 tlog(F100,"Transaction Log Closed","",0L);
4903 if (msgflg) printf("?Connection log wasn't open\n");
4908 return(zclose(ZDIFIL));
4909 #endif /* CKLOGDIAL */
4912 case LOGW: /* WRITE file */
4913 case LOGR: /* READ file */
4914 y = (x == LOGR) ? ZRFILE : ZWFILE;
4915 if (chkfn(y) < 1) /* If no file to close */
4916 return(1); /* succeed silently. */
4917 return(zclose(y)); /* Otherwise, close the file. */
4921 printf("\n?Unexpected log designator - %d\n", x);
4926 static int slc = 0; /* Screen line count */
4929 showstring(s) char * s; {
4930 return(s ? s : "(null)");
4935 return(x ? "on" : "off");
4941 case SET_OFF: return("off");
4942 case SET_ON: return("on");
4943 case SET_AUTO: return("automatic");
4944 default: return("(unknown)");
4949 isxdigit(c) int c; {
4950 return(isdigit(c) ||
4951 (c >= 'a' && c <= 'f') ||
4952 (c >= 'A' && c <= 'F'));
4958 static struct keytab shokeytab[] = { /* SHOW KEY modes */
4962 static int nshokey = (sizeof(shokeytab) / sizeof(struct keytab));
4964 #define SHKEYDEF TT_MAX+5
4965 struct keytab shokeymtab[] = {
4966 "aaa", TT_AAA, CM_INV, /* AnnArbor */
4967 "adm3a", TT_ADM3A, 0, /* LSI ADM-3A */
4968 "adm5", TT_ADM5, 0, /* LSI ADM-5 */
4969 "aixterm", TT_AIXTERM, 0, /* IBM AIXterm */
4970 "annarbor", TT_AAA, 0, /* AnnArbor */
4971 "ansi-bbs", TT_ANSI, 0, /* ANSI.SYS (BBS) */
4972 "at386", TT_AT386, 0, /* Unixware ANSI */
4973 "avatar/0+", TT_ANSI, 0, /* AVATAR/0+ */
4974 "ba80", TT_BA80, 0, /* Nixdorf BA80 */
4975 "be", TT_BEOS, CM_INV|CM_ABR,
4976 "beos-ansi", TT_BEOS, CM_INV, /* BeOS ANSI */
4977 "beterm", TT_BEOS, 0, /* BeOS Console */
4978 "d200", TT_DG200, CM_INV|CM_ABR, /* Data General DASHER 200 */
4979 "d210", TT_DG210, CM_INV|CM_ABR, /* Data General DASHER 210 */
4980 "d217", TT_DG217, CM_INV|CM_ABR, /* Data General DASHER 217 */
4981 "default", SHKEYDEF, 0,
4982 "dg200", TT_DG200, 0, /* Data General DASHER 200 */
4983 "dg210", TT_DG210, 0, /* Data General DASHER 210 */
4984 "dg217", TT_DG217, 0, /* Data General DASHER 217 */
4985 "emacs", TT_KBM_EMACS, 0, /* Emacs mode */
4986 "h19", TT_H19, CM_INV, /* Heath-19 */
4987 "heath19", TT_H19, 0, /* Heath-19 */
4988 "hebrew", TT_KBM_HEBREW, 0, /* Hebrew mode */
4989 "hft", TT_HFT, 0, /* IBM HFT */
4990 "hp2621a", TT_HP2621, 0, /* HP 2621A */
4991 "hpterm", TT_HPTERM, 0, /* HP TERM */
4992 "hz1500", TT_HZL1500, 0, /* Hazeltine 1500 */
4993 "ibm3151", TT_IBM31, 0, /* IBM 3101-xx,3161 */
4994 "linux", TT_LINUX, 0, /* Linux */
4995 "qansi", TT_QANSI, 0, /* QNX ANSI */
4996 "qnx", TT_QNX, 0, /* QNX */
4997 "russian", TT_KBM_RUSSIAN, 0, /* Russian mode */
4998 "scoansi", TT_SCOANSI, 0, /* SCO ANSI */
4999 "sni-97801", TT_97801, 0, /* Sinix 97801 */
5000 "sun", TT_SUN, 0, /* Sun Console */
5003 "tek4014", TT_TEK40, 0,
5004 #endif /* COMMENT */
5007 "tvi910+", TT_TVI910, 0,
5008 "tvi925", TT_TVI925, 0,
5009 "tvi950", TT_TVI950, 0,
5010 "vc404", TT_VC4404, 0,
5011 "vc4404", TT_VC4404, CM_INV,
5012 "vip7809", TT_VIP7809, 0,
5013 "vt100", TT_VT100, 0,
5014 "vt102", TT_VT102, 0,
5015 "vt220", TT_VT220, 0,
5016 "vt220pc", TT_VT220PC, 0,
5017 "vt320", TT_VT320, 0,
5018 "vt320pc", TT_VT320PC, 0,
5021 "wy160", TT_WY160, 0,
5023 "wy370", TT_WY370, 0,
5026 "wyse30", TT_WY30, CM_INV,
5027 "wyse370", TT_WY370, CM_INV,
5028 "wyse50", TT_WY50, CM_INV,
5029 "wyse60", TT_WY60, CM_INV
5031 int nshokeym = (sizeof(shokeymtab) / sizeof(struct keytab));
5036 shokeycode(c,m) int c, m;
5038 shokeycode(c) int c;
5059 printf(" Key code \\%d => ", c);
5066 if (IS_KVERB(km)) { /* \Kverb? */
5068 kv = km & ~(F_KVERB);
5070 for (i = 0; i < nkverbs; i++)
5071 if (kverbs[i].kwval == kv) {
5072 printf("\\K%s",kverbs[i].kwd);
5077 #endif /* NOKVERBS */
5079 int xkm = km & 0xFF;
5080 if (xkm <= 32 || xkm >= 127)
5081 printf("String: \\{27}[\\{%d}\n",xkm);
5083 printf("String: \\{27}[%c\n",xkm);
5084 } else if (IS_ESC(km)) {
5085 int xkm = km & 0xFF;
5086 if (xkm <= 32 || xkm >= 127)
5087 printf("String: \\{27}\\{%d}\n",xkm);
5089 printf("String: \\{27}%c\n",xkm);
5090 } else if (macrotab[c]) { /* See if there's a macro */
5091 printf("String: "); /* If so, display its definition */
5096 } else if (km >= 0x100) { /* This means "undefined" */
5097 printf("Undefined\n");
5098 #endif /* NOKVERBS */
5099 } else { /* No macro, show single character */
5100 printf("Character: ");
5102 if (ch < 32 || ch == 127
5110 || (ch > 127 && ch < 160)
5117 These used to be %d, but gcc 1.93 & later complain about type mismatches.
5118 %u is supposed to be totally portable.
5120 printf("\\%u",(unsigned int) ch);
5121 else printf("%c \\%u",(CHAR) (ch & 0xff),(unsigned int) ch);
5123 printf(" (self, no translation)\n");
5132 km = maptermkey(c,m);
5133 for (i = 0; i < nshokeym; i++) {
5134 if (m == shokeymtab[i].kwval) {
5135 mstr = shokeymtab[i].kwd;
5141 debug(F111,"shokeycode mstr",mstr,m);
5142 debug(F111,"shokeycode keyname",s,c);
5143 printf(" %sKey code \\%d %s (%s) => ",
5144 mskkeys ? "mskermit " : "",
5145 mskkeys ? cktomsk(c) : c,
5146 s == NULL ? "" : s, mstr);
5152 kv = km.kverb.id & ~(F_KVERB);
5154 for (i = 0; i < nkverbs; i++) {
5155 if (kverbs[i].kwval == kv) {
5156 printf("\\K%s",kverbs[i].kwd);
5163 #endif /* NOKVERBS */
5165 int xkm = km.csi.key & 0xFF;
5166 if (xkm <= 32 || xkm >= 127)
5167 printf("String: \\{27}[\\{%d}\n",xkm);
5169 printf("String: \\{27}[%c\n",xkm);
5173 int xkm = km.esc.key & 0xFF;
5174 if (xkm <= 32 || xkm >= 127)
5175 printf("String: \\{%d}\\{%d}\n",ISDG200(tt_type)?30:27,xkm);
5177 printf("String: \\{%d}%c\n",ISDG200(tt_type)?30:27,xkm);
5181 printf("String: "); /* Macro, display its definition */
5182 shostrdef(km.macro.string);
5187 printf("Literal string: "); /* Literal, display its definition */
5188 shostrdef(km.literal.string);
5194 printf("Undefined\n");
5196 printf("Character: ");
5198 if (ch < 32 || ch == 127 || ch > 255
5203 || (ch > 127 && ch < 160)
5210 These used to be %d, but gcc 1.93 & later complain about type mismatches.
5211 %u is supposed to be totally portable.
5213 printf("\\%u",(unsigned int) ch);
5214 else printf("%c \\%u",(CHAR) (ch & 0xff),(unsigned int) ch);
5215 printf(" (self, no translation)\n");
5220 printf("Character: ");
5221 ch = km.key.scancode;
5222 if (ch < 32 || ch == 127 || ch > 255
5227 || (ch > 127 && ch < 160)
5236 These used to be %d, but gcc 1.93 & later complain about type mismatches.
5237 %u is supposed to be totally portable.
5239 printf("\\%u",(unsigned int) ch);
5240 else printf("%c \\%u",(CHAR) (ch & 0xff),(unsigned int) ch);
5242 printf(" (self, no translation)\n");
5250 #endif /* NOSETKEY */
5253 shostrdef(s) CHAR * s; {
5255 if (!s) s = (CHAR *)"";
5256 while ((ch = *s++)) {
5257 if (ch < 32 || ch == 127 || ch == 255
5259 Systems whose native character sets have graphic characters in C1...
5261 #ifndef NEXT /* NeXT */
5262 #ifndef AUX /* Macintosh */
5263 #ifndef XENIX /* IBM PC */
5266 It doesn't matter whether the local host can display 8-bit characters;
5267 they are not portable among character-sets and fonts. Who knows what
5268 would be displayed...
5272 || (ch > 127 && ch < 160)
5278 printf("\\{%d}",ch); /* Display control characters */
5279 else putchar((char) ch); /* in backslash notation */
5283 #define xxdiff(v,sys) strncmp(v,sys,strlen(sys))
5289 extern char ckxsystem[];
5291 extern char *ck_patch, * cklibv;
5292 printf("\nVersions:\n %s\n",versio);
5293 printf(" Numeric: %ld\n",vernum);
5295 printf(" Operating System: %s\n", ckxsystem);
5297 printf(" Built for: %s\n", ckxsys);
5300 printf(" Running on: %s %s %s %s\n", unm_nam,unm_ver,unm_rel,unm_mch);
5301 #endif /* CK_UTSNAME */
5302 printf(" Patches: %s\n", *ck_patch ? ck_patch : "(none)");
5304 if (xxdiff(ckxv,ckxsys))
5305 printf(" %s for%s\n",ckxv,ckxsys);
5307 printf(" %s\n",ckxv);
5308 if (xxdiff(ckzv,ckzsys))
5309 printf(" %s for%s\n",ckzv,ckzsys);
5311 printf(" %s\n",ckzv);
5312 printf(" %s\n",cklibv);
5313 printf(" %s\n",protv);
5314 printf(" %s\n",fnsv);
5315 printf(" %s\n %s\n",cmdv,userv);
5317 printf(" %s\n",xlav);
5318 #endif /* NOCSETS */
5321 printf(" %s\n",connv);
5323 printf(" %s\n",ckyv);
5325 #endif /* NOLOCAL */
5328 printf(" %s\n",dialv);
5331 printf(" %s\n",loginv);
5332 #endif /* NOSCRIPT */
5334 printf(" %s\n",cknetv);
5336 printf(" %s\n",ckonetv);
5338 printf(" %s\n",ckonbiv);
5339 #endif /* CK_NETBIOS */
5341 #endif /* NETCONN */
5343 printf(" %s\n",cktelv);
5346 printf(" %s\n",cksshv);
5348 printf(" %s\n",cksftpv);
5349 #endif /* SFTP_BUILTIN */
5350 #endif /* SSHBUILTIN */
5353 printf(" %s\n",ckomouv);
5354 #endif /* OS2MOUSE */
5357 printf(" %s\n",ckftpv);
5359 #ifdef CK_AUTHENTICATION
5360 printf(" %s\n",ckathv);
5361 #endif /* CK_AUTHENTICATION */
5362 #ifdef CK_ENCRYPTION
5364 printf(" %s\n",ck_crypt_dll_version());
5365 #else /* CRYPT_DLL */
5366 printf(" %s\n",ckcrpv);
5367 #endif /* CRYPT_DLL */
5368 #endif /* CK_ENCRYPTION */
5370 printf(" %s\n",cksslv);
5379 printf("VMS Labeled File Features:\n");
5380 printf(" acl %s (ACL info %s)\n",
5381 showoff(lf_opts & LBL_ACL),
5382 lf_opts & LBL_ACL ? "preserved" : "discarded");
5383 printf(" backup-date %s (backup date/time %s)\n",
5384 showoff(lf_opts & LBL_BCK),
5385 lf_opts & LBL_BCK ? "preserved" : "discarded");
5386 printf(" name %s (original filename %s)\n",
5387 showoff(lf_opts & LBL_NAM),
5388 lf_opts & LBL_NAM ? "preserved" : "discarded");
5389 printf(" owner %s (original file owner id %s)\n",
5390 showoff(lf_opts & LBL_OWN),
5391 lf_opts & LBL_OWN ? "preserved" : "discarded");
5392 printf(" path %s (original file's disk:[directory] %s)\n",
5393 showoff(lf_opts & LBL_PTH),
5394 lf_opts & LBL_PTH ? "preserved" : "discarded");
5397 printf("OS/2 Labeled File features (attributes):\n");
5398 printf(" archive: %s\n", showoff(lf_opts & LBL_ARC));
5399 printf(" extended: %s\n", showoff(lf_opts & LBL_EXT));
5400 printf(" hidden: %s\n", showoff(lf_opts & LBL_HID));
5401 printf(" read-only: %s\n", showoff(lf_opts & LBL_RO ));
5402 printf(" system: %s\n", showoff(lf_opts & LBL_SYS));
5406 #endif /* CK_LABELED */
5409 shotcs(csl,csr) int csl, csr; { /* Show terminal character set */
5413 extern struct _vtG G[4], *GL, *GR;
5414 extern int decnrcm, sni_chcode;
5415 extern int tt_utf8, dec_nrc, dec_kbd, dec_lang;
5418 printf(" Terminal character-sets:\n");
5419 if (IS97801(tt_type_mode)) {
5421 printf(" Mode: 8-bit Mode\n");
5423 printf(" Mode: 7-bit Mode\n");
5424 printf(" CH.CODE is %s\n",sni_chcode?"On":"Off");
5425 } else if (ISVT100(tt_type_mode)) {
5427 printf(" Mode: 7-bit National Mode\n");
5429 printf(" Mode: 8-bit Multinational Mode\n");
5432 printf(" Local: Unicode display / %s input\n",
5433 csl == TX_TRANSP ? "transparent" :
5434 csl == TX_UNDEF ? "undefined" : txrinfo[csl]->keywd);
5436 printf(" Local: %s\n",
5437 csl == TX_TRANSP ? "transparent" :
5438 csl == TX_UNDEF ? "undefined" : txrinfo[csl]->keywd);
5441 printf(" Remote: UTF-8\n");
5443 printf(" Remote: %sG0: %s (%s)\n",
5444 GL == &G[0] ? "GL->" : GR == &G[0] ? "GR->" : " ",
5445 txrinfo[G[0].designation]->keywd,
5446 G[0].designation == TX_TRANSP ? "" :
5447 G[0].size == cs94 ? "94 chars" :
5448 G[0].size == cs96 ? "96 chars" : "multi-byte");
5449 printf(" %sG1: %s (%s)\n",
5450 GL == &G[1] ? "GL->" : GR == &G[1] ? "GR->" : " ",
5451 txrinfo[G[1].designation]->keywd,
5452 G[1].designation == TX_TRANSP ? "" :
5453 G[1].size == cs94 ? "94 chars" :
5454 G[1].size == cs96 ? "96 chars" : "multi-byte");
5455 printf(" %sG2: %s (%s)\n",
5456 GL == &G[2] ? "GL->" : GR == &G[2] ? "GR->" : " ",
5457 txrinfo[G[2].designation]->keywd,
5458 G[2].designation == TX_TRANSP ? "" :
5459 G[2].size == cs94 ? "94 chars" :
5460 G[2].size == cs96 ? "96 chars" : "multi-byte");
5461 printf(" %sG3: %s (%s)\n",
5462 GL == &G[3] ? "GL->" : GR == &G[3] ? "GR->" : " ",
5463 txrinfo[G[3].designation]->keywd,
5464 G[3].designation == TX_TRANSP ? "" :
5465 G[3].size == cs94 ? "94 chars" :
5466 G[3].size == cs96 ? "96 chars" : "multi-byte");
5469 printf(" Keyboard character-sets:\n");
5470 printf(" Multinational: %s\n",txrinfo[dec_kbd]->keywd);
5471 printf(" National: %s\n",txrinfo[dec_nrc]->keywd);
5473 printf(" Printer character-set: %s\n",txrinfo[prncs]->keywd);
5479 debug(F101,"TERM LOCAL CSET","",csl);
5480 debug(F101,"TERM REMOTE CSET","",csr);
5481 printf(" Terminal character-set: ");
5482 if (tcs_transp) { /* No translation */
5483 printf("transparent\n");
5484 } else { /* Translation */
5485 printf("%s (remote) %s (local)\n",
5486 fcsinfo[csr].keyword,fcsinfo[csl].keyword);
5488 switch(gettcs(csr,csl)) {
5489 case TC_USASCII: s = "ascii"; break;
5490 case TC_1LATIN: s = "latin1-iso"; break;
5491 case TC_2LATIN: s = "latin2-iso"; break;
5492 case TC_CYRILL: s = "cyrillic-iso"; break;
5493 case TC_JEUC: s = "japanese-euc"; break;
5494 case TC_HEBREW: s = "hebrew-iso"; break;
5495 case TC_GREEK: s = "greek-iso"; break;
5496 case TC_9LATIN: s = "latin9-iso"; break;
5497 default: s = "transparent"; break;
5499 if (strcmp(s,fcsinfo[csl].keyword) &&
5500 strcmp(s,fcsinfo[csr].keyword))
5501 printf(" (via %s)\n",s);
5506 #endif /* NOCSETS */
5516 printf("Tab Stops:\n\n");
5517 for (i = 0, j = 1, k = VscrnGetWidth(VCMD); i < MAXTERMCOL; ) {
5519 printf("%c",htab[++i]=='T'?'T':'-');
5520 } while (i % k && i < MAXTERMCOL);
5522 for ( ; j <= i; j++) {
5525 printf("%c",j == 1 ? '1' : '.');
5559 for (i = 1; i <= 70; i++)
5560 printf("%c",htab[i]=='T'?'T':'-');
5561 printf("\n1.......10........20........30........40........50........60\
5563 for (; i <= 140; i++)
5564 printf("%c",htab[i]=='T'?'T':'-');
5565 printf("\n........80........90.......100.......110.......120.......130\
5567 for (; i <= 210; i++)
5568 printf("%c",htab[i]=='T'?'T':'-');
5569 printf("\n.......150.......160.......170.......180.......190.......200\
5571 for (; i <= 255; i++)
5572 printf("%c",htab[i]=='T'?'T':'-');
5573 printf("\n.......220.......230.......240.......250..255\n");
5578 #endif /* NOLOCAL */
5583 int button, event, id, i;
5586 printf("Mouse settings:\n");
5587 printf(" Button Count: %d\n",mousebuttoncount());
5588 printf(" Active: %s\n\n",showoff(tt_mouse));
5590 for (button = 0; button < MMBUTTONMAX; button++)
5591 for (event = 0; event < MMEVENTSIZE; event++)
5592 if (mousemap[button][event].type != error)
5593 switch (mousemap[button][event].type) {
5595 printf(" %s = Character: %c \\%d\n",
5596 mousename(button,event),
5597 mousemap[button][event].key.scancode,
5598 mousemap[button][event].key.scancode );
5601 id = mousemap[button][event].kverb.id & ~(F_KVERB);
5602 if (id != K_IGNORE) {
5603 for (i = 0; i< nkverbs; i++)
5604 if (id == kverbs[i].kwval) {
5605 name = kverbs[i].kwd;
5608 printf(" %s = Kverb: \\K%s\n",
5609 mousename(button,event),
5615 printf(" %s = Macro: ",
5616 mousename(button,event) );
5617 shostrdef(mousemap[button][event].macro.string);
5622 #endif /* OS2MOUSE */
5628 extern char * getiact();
5629 extern int tt_print, adl_err;
5631 extern char * tt_trigger[];
5632 #endif /* NOTRIGGER */
5634 extern char * tt_idlesnd_str;
5635 extern int tt_idlesnd_tmo;
5636 extern int tt_idlelimit, tt_idleact;
5637 #endif /* CKTIDLE */
5639 extern int wy_autopage, autoscroll, sgrcolors, colorreset, user_erasemode,
5640 decscnm, decscnm_usr, tt_diff_upd, tt_senddata,
5641 wy_blockend, marginbell, marginbellcol, tt_modechg, dgunix;
5644 extern CKFLOAT tt_linespacing[];
5645 extern tt_cursor_blink;
5651 if (IsOS2FullScreen()) { /* Determine the font name */
5652 if (!os2LoadPCFonts()) {
5653 for (i = 0; i < ntermfont; i++) {
5654 if (tt_font == term_font[i].kwval) {
5655 font = term_font[i].kwd;
5660 font = "(DLL not available)";
5663 font = "(full screen only)";
5665 #endif /* PCFONTS */
5667 char font[64] = "(unknown)";
5668 if ( ntermfont > 0 ) {
5670 for (i = 0; i < ntermfont; i++) {
5671 if (tt_font == term_font[i].kwval) {
5672 ckstrncpy(font,term_font[i].kwd,59);
5673 ckstrncat(font," ",64);
5674 ckstrncat(font,ckitoa(tt_font_size/2),64);
5675 if ( tt_font_size % 2 )
5676 ckstrncat(font,".5",64);
5683 printf("Terminal parameters:\n");
5684 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5685 printf(" %19s: %1d%-12s %13s: %1d%-14s\n",
5686 "Bytesize: Command",
5687 (cmdmsk == 0377) ? 8 : 7,
5689 (cmask == 0377) ? 8 : 7," bits");
5690 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5691 printf(" %19s: %-13s","Type",
5692 (tt_type >= 0 && tt_type <= max_tt) ?
5693 tt_info[tt_type].x_name :
5695 if (tt_type >= 0 && tt_type <= max_tt)
5696 if (strlen(tt_info[tt_type].x_id))
5697 printf(" %13s: <ESC>%s","ID",tt_info[tt_type].x_id);
5699 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5700 printf(" %19s: %-13s %13s: %-15s\n","Echo",
5701 duplex ? "local" : "remote","Locking-shift",showoff(sosi));
5702 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5703 printf(" %19s: %-13s %13s: %-15s\n","Newline-mode", showoff(tnlm),
5704 "Cr-display",tt_crd ? "crlf" : "normal");
5705 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5706 printf(" %19s: %-13s %13s: %-15s\n","Cursor",
5708 (tt_cursor == 2) ? (tt_cursor_blink ?
5709 "full (*)" : "full (.)") :
5710 (tt_cursor == 1) ? (tt_cursor_blink ?
5711 "half (*)" : "half (.)") :
5712 (tt_cursor_blink ? "underline (*)" : "underline (.)"),
5714 (tt_cursor == 2) ? "full" :
5715 (tt_cursor == 1) ? "half" : "underline",
5718 "autodownload",autodl == TAD_ON ?
5719 (adl_err ? "on, error stop" : "on, error continue") :
5721 (adl_err ? "ask, error stop" : "ask, error continue") :
5723 #else /* CK_AUTODL */
5725 #endif /* CK_AUTODL */
5727 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5728 printf(" %19s: %-13s %13s: %-15s\n","Arrow-keys",
5729 tt_arrow ? "application" : "cursor",
5730 "Keypad-mode", tt_keypad ? "application" : "numeric"
5733 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5735 /* Just to make sure we are using current info */
5739 This line doesn't end with '\n' because the answerback string
5740 is terminated with a newline
5742 printf(" %19s: %-13s %13s: %-15s","Answerback",
5743 showoff(tt_answer),"response",answerback);
5751 case XYB_AUD | XYB_BEEP:
5754 case XYB_AUD | XYB_SYS:
5760 printf(" %19s: %-13s %13s: %-15s\n","Bell",s,
5761 "Wrap",showoff(tt_wrap));
5762 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5763 printf(" %19s: %-13s %13s: %-15s\n","Autopage",showoff(wy_autopage),
5764 "Autoscroll",showoff(autoscroll));
5765 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5766 printf(" %19s: %-13s %13s: %-15s\n","SGR Colors",showoff(sgrcolors),
5767 "ESC[0m color",colorreset?"default-color":"current-color");
5768 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5769 printf(" %19s: %-13s %13s: %-15s\n",
5770 "Erase color",user_erasemode?"default-color":"current-color",
5771 "Screen mode",decscnm?"reverse":"normal");
5772 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5774 printf(" %19s: %-13d %13s: %-15d\n","Transmit-timeout",tt_ctstmo,
5775 "Output-pacing",tt_pacing);
5776 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5778 printf(" %19s: %-13d %13s: %s\n","Idle-timeout",tt_idlelimit,
5779 "Idle-action", getiact());
5781 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5782 printf(" %19s: %-13s %13s: %-15s\n","Send data",
5783 showoff(tt_senddata),"End of Block", wy_blockend?"crlf/etx":"us/cr");
5784 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5786 printf(" %19s: %-13s %13s: %d seconds\n","Auto-exit trigger",
5787 tt_trigger[0],"Output pacing",tt_pacing );
5788 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5789 #endif /* NOTRIGGER */
5790 printf(" %19s: %-13s %13s: %-15d\n","Margin bell",
5791 showoff(marginbell),"at column", marginbellcol);
5792 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5793 switch (tt_modechg) {
5794 case TVC_DIS: s = "disabled"; break;
5795 case TVC_ENA: s = "enabled"; break;
5796 case TVC_W95: s = "win95-restricted"; break;
5797 default: s = "(unknown)";
5799 printf(" %19s: %-13s %13s: %-15s\n","DG Unix mode",
5800 showoff(dgunix),"Video change", s);
5801 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5804 if (apcstatus == APC_ON) s = "on";
5805 else if (apcstatus == APC_OFF) s = "off";
5806 else if (apcstatus == APC_ON|APC_UNCH) s = "unchecked";
5807 else if (apcstatus == APC_ON|APC_NOINP) s = "no-input";
5808 else if (apcstatus == APC_ON|APC_UNCH|APC_NOINP) s = "unchecked-no-input";
5809 printf(" %19s: %-13s %13s: %-15s\n",
5817 "Font","(not supported)"
5819 #endif /* PCFONTS */
5823 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5825 #ifdef CK_TTGWSIZ /* Console terminal screen size */
5826 if (tt_cols[VTERM] < 0 || tt_rows[VTERM] < 0)
5827 ttgwsiz(); /* Try to get latest size */
5828 #endif /* CK_TTGWSIZ */
5829 printf(" %19s: %-13d %13s: %-15d\n","Height",tt_rows[VTERM],
5830 "Width",tt_cols[VTERM]);
5831 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5833 printf(" %19s: %-12f %14s: %-15d\n","Line spacing",tt_linespacing[VTERM],
5834 "Display Height",VscrnGetDisplayHeight(VTERM));
5835 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5837 printf(" %19s: %-13s %13s: %d lines\n","Roll-mode",
5838 tt_roll[VTERM]?"insert":"overwrite","Scrollback", tt_scrsize[VTERM]);
5839 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5841 if (updmode == tt_updmode)
5842 if (updmode == TTU_FAST)
5845 s = "smooth (smooth)";
5847 if (updmode == TTU_FAST)
5848 s = "fast (smooth)";
5850 s = "smooth (fast)";
5852 printf(" %19s: %-13s %13s: %d ms\n","Screen-update: mode",s,
5853 "interval",tt_update);
5854 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5855 printf(" %19s: %-13s %13s: %-15s\n",
5856 "Screen-optimization",showoff(tt_diff_upd),
5857 "Status line",showoff(tt_status[VTERM]));
5858 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5859 printf(" %19s: %-13s %13s: %-15s\n","Debug",
5860 showoff(debses),"Session log", seslog? sesfil : "(none)" );
5861 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5863 /* Display colors (should become SHOW COLORS) */
5866 char * colors[16] = {
5867 "black","blue","green","cyan","red","magenta","brown","lgray",
5868 "dgray","lblue","lgreen","lcyan","lred","lmagent","yellow","white"
5871 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5875 GetCurPos(&row, &col);
5876 WrtCharStrAtt("border", 6, row, 9, &colorborder );
5877 WrtCharStrAtt("debug", 5, row, 17, &colordebug );
5878 WrtCharStrAtt("helptext", 8, row, 25, &colorhelp );
5879 WrtCharStrAtt("reverse", 7, row, 34, &colorreverse );
5880 WrtCharStrAtt("select", 6, row, 42, &colorselect );
5881 WrtCharStrAtt("status", 6, row, 50, &colorstatus );
5882 WrtCharStrAtt("terminal", 8, row, 58, &colornormal );
5883 WrtCharStrAtt("underline", 9, row, 67, &colorunderline );
5884 #endif /* ONETERMUPD */
5885 row = VscrnGetCurPos(VCMD)->y+1;
5886 VscrnWrtCharStrAtt(VCMD, "border", 6, row, 9, &colorborder );
5887 VscrnWrtCharStrAtt(VCMD, "debug", 5, row, 17, &colordebug );
5888 VscrnWrtCharStrAtt(VCMD, "helptext", 8, row, 25, &colorhelp );
5889 VscrnWrtCharStrAtt(VCMD, "reverse", 7, row, 34, &colorreverse );
5890 VscrnWrtCharStrAtt(VCMD, "select", 6, row, 42, &colorselect );
5891 VscrnWrtCharStrAtt(VCMD, "status", 6, row, 50, &colorstatus );
5892 VscrnWrtCharStrAtt(VCMD, "terminal", 8, row, 58, &colornormal );
5893 VscrnWrtCharStrAtt(VCMD, "underline", 9, row, 67, &colorunderline );
5895 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5897 /* Foreground color names */
5898 printf("%6s: %-8s%-8s%-9s%-8s%-8s%-8s%-9s%-9s\n","fore",
5900 colors[colordebug&0x0F],
5901 colors[colorhelp&0x0F],
5902 colors[colorreverse&0x0F],
5903 colors[colorselect&0x0F],
5904 colors[colorstatus&0x0F],
5905 colors[colornormal&0x0F],
5906 colors[colorunderline&0x0F]);
5907 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5909 /* Background color names */
5910 printf("%6s: %-8s%-8s%-9s%-8s%-8s%-8s%-9s%-9s\n","back",
5911 colors[colorborder],
5912 colors[colordebug>>4],
5913 colors[colorhelp>>4],
5914 colors[colorreverse>>4],
5915 colors[colorselect>>4],
5916 colors[colorstatus>>4],
5917 colors[colornormal>>4],
5918 colors[colorunderline>>4] );
5919 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5921 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5924 GetCurPos(&row, &col);
5925 WrtCharStrAtt("graphic", 7, row, 9, &colorgraphic );
5926 WrtCharStrAtt("command", 7, row, 17, &colorcmd );
5927 WrtCharStrAtt("italic", 6, row, 26, &coloritalic );
5928 #endif /* ONETERMUPD */
5929 row = VscrnGetCurPos(VCMD)->y+1;
5930 VscrnWrtCharStrAtt(VCMD, "graphic", 7, row, 9, &colorgraphic );
5931 VscrnWrtCharStrAtt(VCMD, "command", 7, row, 17, &colorcmd );
5932 VscrnWrtCharStrAtt(VCMD, "italic", 6, row, 26, &coloritalic );
5934 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5936 /* Foreground color names */
5937 printf("%6s: %-8s%-8s%-8s\n","fore",
5938 colors[colorgraphic&0x0F],
5939 colors[colorcmd&0x0F],
5940 colors[coloritalic&0x0F]);
5941 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5943 /* Background color names */
5944 printf("%6s: %-8s%-8s%-8s\n","back",
5945 colors[colorgraphic>>4],
5946 colors[colorcmd>>4],
5947 colors[coloritalic>>4]);
5948 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5951 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5953 extern int trueblink, truedim, truereverse, trueunderline, trueitalic;
5956 blink: %-3s dim: %-3s italic: %-3s reverse: %-3s underline: %-3s\n",
5957 trueblink?"on":"off", truedim?"on":"off", trueitalic?"on":"off",
5958 truereverse?"on":"off", trueunderline?"on":"off");
5959 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5962 extern vtattrib WPattrib;
5963 printf(" ASCII Protected chars: %s%s%s%s%s%s%s\n",
5964 WPattrib.blinking?"blink ":"",
5965 WPattrib.italic?"italic ":"",
5966 WPattrib.reversed?"reverse ":"",
5967 WPattrib.underlined?"underline ":"",
5968 WPattrib.bold?"bold ":"",
5969 WPattrib.dim?"dim ":"",
5970 WPattrib.invisible?"invisible ":"");
5971 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5975 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5976 (VOID) shoesc(escape);
5977 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5978 printf(" See SHOW CHARACTER-SETS for character-set info\n");
5979 if (++lines > cmd_rows - 3) { if (!askmore()) return; else lines = 0; }
5981 #else /* OS2 */ /* Beginning of new non-OS2 version */
5984 printf("Terminal parameters:\n");
5985 printf(" %19s: %1d%-12s %13s: %1d%-14s\n",
5986 "Bytesize: Command",
5987 (cmdmsk == 0377) ? 8 : 7,
5989 (cmask == 0377) ? 8 : 7," bits");
5992 printf(" %19s: %-13s %13s: %-15s\n",
5994 s ? s : "(unknown)",
5999 printf(" %19s: %-13s\n","Type", s ? s : "(unknown)");
6001 printf(" %19s: %-13s %13s: %-15s\n","Echo",
6002 duplex ? "local" : "remote","Locking-shift",showoff(sosi));
6003 printf(" %19s: %-13s %13s: %-15s\n","Newline-mode",
6004 showoff(tnlm),"Cr-display",tt_crd ? "crlf" : "normal");
6007 if (apcstatus == APC_ON) s = "on";
6008 else if (apcstatus == APC_OFF) s = "off";
6009 else if (apcstatus == (APC_ON|APC_UNCH)) s = "unchecked";
6010 else if (apcstatus == (APC_ON|APC_NOINP)) s = "no-input";
6011 else if (apcstatus == (APC_ON|APC_UNCH|APC_NOINP))
6012 s = "unchecked-no-input";
6013 printf(" %19s: %-13s %13s: %-15s\n",
6016 "Autodownload", autodl ?
6017 (adl_err ? "on, error stop" : "on, error continue") : "off"
6020 #endif /* CK_AUTODL */
6024 #ifdef CK_TTGWSIZ /* Console terminal screen size */
6025 ttgwsiz(); /* Try to get latest size */
6026 printf(" %19s: %-13d %13s: %-15d\n","Height",tt_rows, "Width", tt_cols);
6027 #endif /* CK_TTGWSIZ */
6029 printf(" %19s: %-13s %13s: %-15s\n","Debug",
6030 showoff(debses),"Session log", seslog? sesfil : "(none)" );
6033 printf(" %19s: %-13d %13s: %s\n","Idle-timeout",tt_idlelimit,
6034 "Idle-action", getiact());
6035 #endif /* CKTIDLE */
6037 printf(" %19s: %-13s ","Lf-display", tt_lfd ? "crlf" : "normal");
6040 printf("%13s: %-15s","Suspend", showoff(xsuspend));
6046 printf(" %19s: %-13s\n","Trigger",
6047 tt_trigger[0] ? tt_trigger[0] : "(none)");
6048 #endif /* NOTRIGGER */
6051 (VOID) shoesc(escape);
6053 shotcs(tcsl,tcsr); /* Show terminal character sets */
6054 #endif /* NOCSETS */
6060 shmdmlin() { /* Briefly show modem & line */
6065 _PROTOTYP( char * gtbmodel, (void) );
6066 #endif /* OLDTBCODE */
6067 #endif /* MINIDIAL */
6071 printf(" Port: %s, Modem type: ",ttname);
6073 printf(" Line: %s, Modem type: ",ttname);
6078 " Communication device not yet selected with SET PORT\n Modem type: "
6080 " Communication device not yet selected with SET LINE\n Modem type: "
6084 printf("%s",gmdmtyp());
6087 if (tbmodel) printf(" (%s)",gtbmodel()); /* Telebit model info */
6088 #endif /* OLDTBCODE */
6089 #endif /* MINIDIAL */
6091 printf("(disabled)");
6097 shotapi(int option) {
6100 LPDEVCFG lpDevCfg = NULL;
6101 LPCOMMCONFIG lpCommConfig = NULL;
6102 LPMODEMSETTINGS lpModemSettings = NULL;
6104 extern struct keytab * tapiloctab; /* Microsoft TAPI Locations */
6105 extern int ntapiloc;
6106 extern struct keytab * tapilinetab; /* Microsoft TAPI Line Devices */
6107 extern int ntapiline;
6108 extern int tttapi; /* TAPI in use */
6109 extern int tapipass; /* TAPI Passthrough mode */
6110 extern int tapiconv; /* TAPI Conversion mode */
6111 extern int tapilights;
6112 extern int tapipreterm;
6113 extern int tapipostterm;
6114 extern int tapimanual;
6115 extern int tapiinactivity;
6116 extern int tapibong;
6117 extern int tapiusecfg;
6118 extern char tapiloc[];
6119 extern int tapilocid;
6120 extern int TAPIAvail;
6123 printf("TAPI Support not enabled\r\n");
6128 printf("TAPI Settings:\n");
6129 printf(" Line: %s\n",
6130 tttapi ? ttname : "(none in use)");
6132 cktapiBuildLocationTable(&tapiloctab, &ntapiloc);
6133 if (tapilocid == -1)
6134 tapilocid = cktapiGetCurrentLocationID();
6136 /* Find the current tapiloc entry */
6137 /* and use it as the default. */
6138 for (k = 0; k < ntapiloc; k++) {
6139 if (tapiloctab[k].kwval == tapilocid)
6142 if (k >= 0 && k < ntapiloc)
6143 s = tapiloctab[k].kwd;
6146 printf(" Location: %s\n",s);
6147 printf(" Modem-dialing: %s\n",tapipass?"off":"on");
6148 printf(" Phone-number-conversions: %s\n",
6149 tapiconv==CK_ON?"on":tapiconv==CK_AUTO?"auto":"off");
6150 printf(" Modem-lights: %s %s\n",tapilights?"on ":"off",
6151 tapipass?"(n/a)":"");
6152 printf(" Predial-terminal: %s %s\n",tapipreterm?"on ":"off",
6153 tapipass?"(n/a)":"");
6154 printf(" Postdial-terminal: %s %s\n",tapipostterm?"on ":"off",
6155 tapipass?"(n/a)":"");
6156 printf(" Manual-dial: %s %s\n",tapimanual?"on ":"off",
6157 tapipass?"(n/a)":"");
6158 printf(" Inactivity-timeout: %d seconds %s\n",tapiinactivity,
6159 tapipass?"(n/a)":"");
6160 printf(" Wait-for-bong: %d seconds %s\n",tapibong,
6161 tapipass?"(n/a)":"");
6162 printf(" Use-windows-configuration: %s %s\n",
6163 tapiusecfg?"on ":"off", tapipass?"(n/a)":"");
6168 printf("K-95 uses the TAPI Line in an exclusive mode. Other applications\n");
6169 printf("may open the device but may not place calls nor answer calls.\n");
6170 printf("Dialing is performed using the K-95 dialing procedures. SET MODEM\n");
6171 printf("TYPE TAPI after the SET TAPI LINE command to activate the modem\n");
6172 printf("definition associated with the active TAPI LINE device.\n\n");
6176 printf("K-95 uses the TAPI Line in a cooperative mode. Other applications\n");
6177 printf("may open the device, place and answer calls. Dialing is performed\n");
6178 printf("by TAPI. K-95 SET MODEM commands are not used.\n\n");
6181 if (tapiconv == CK_ON ||
6182 tapiconv == CK_AUTO && !tapipass) {
6184 "Phone numbers are converted from canonical to dialable form by TAPI\n");
6185 printf("using the dialing rules specified in the TAPI Dialing Properties\n");
6186 printf("dialog.\n\n");
6191 "Phone numbers are converted from canonical to dialable form by K-95\n");
6193 "using the dialing rules specified with the SET DIAL commands. TAPI\n");
6195 "Dialing Properties are imported automaticly upon startup and whenever\n");
6196 printf("the TAPI Dialing Properties are altered or when the TAPI Location\n");
6197 printf("is changed.\n\n");
6199 #endif /* BETATEST */
6202 printf("Type SHOW MODEM to see MODEM configuration.\n");
6203 if (tapiconv == CK_ON)
6204 printf("Type SHOW DIAL to see DIAL-related items.\n");
6206 if (tapiconv == CK_ON || tapiconv == CK_AUTO)
6207 printf("Type SHOW DIAL to see DIAL-related items.\n");
6211 cktapiDisplayTapiLocationInfo();
6214 rc = cktapiGetModemSettings(&lpDevCfg,&lpModemSettings,
6215 &lpCommConfig,&lpDCB);
6217 cktapiDisplayModemSettings(lpDevCfg,lpModemSettings,
6218 lpCommConfig,lpDCB);
6220 printf("?Unable to retrieve Modem Settings\n");
6224 HANDLE hModem = GetModemHandleFromLine((HLINE)0);
6226 DisplayCommProperties(hModem);
6228 printf("?Unable to retrieve a valid Modem Handle\n");
6229 CloseHandle(hModem);
6235 #endif /* CK_TAPI */
6236 #endif /* NOLOCAL */
6241 extern char * binpatterns[], * txtpatterns[];
6242 extern int patterns, filepeek;
6244 int i, j, k, n, flag, width;
6246 ttgwsiz(); /* Try to get latest size */
6248 width = tt_cols[VCMD];
6253 #endif /* CK_TTGWSIZ */
6256 printf(" Set file type: %s\n",gfmode(binary,1));
6257 printf(" Set file patterns: %s", showooa(patterns));
6259 if (binary == XYFT_L)
6260 printf(" (but SET FILE TYPE LABELED overrides)\n");
6262 #endif /* CK_LABELED */
6264 if (binary == XYFT_I)
6265 printf(" (but SET FILE TYPE IMAGE overrides)\n");
6269 printf(" (but SET FILE SCAN ON overrides)\n");
6272 printf(" Maximum patterns allowed: %d\n", FTPATTERNS);
6273 for (k = 0; k < 2; k++) { /* For each kind of patter */
6275 if (k == 0) { /* binary... */
6276 printf(" File binary-patterns: ");
6278 } else { /* text... */
6279 printf(" File text-patterns: ");
6287 for (i = 0; i < FTPATTERNS; i++) { /* For each pattern */
6288 if (!p[i]) /* Done */
6290 s = p[i]; /* Look for embedded space */
6291 for (j = 0, flag = 1; *s; s++, j++) /* and also get length */
6294 n += j + flag; /* Length of this line */
6295 if (n >= width - 1) {
6299 printf(flag == 3 ? " {%s}" : " %s", p[i]);
6307 #endif /* PATTERNS */
6312 printf(" Output pacing: %d (milliseconds)\n",pacing);
6313 printf(" Output special-escapes: %s\n", showoff(outesc));
6319 extern char * inpscale;
6320 #endif /* CKFLOAT */
6323 printf(" Input autodownload: %s\n", showoff(inautodl));
6324 #endif /* CK_AUTODL */
6325 printf(" Input cancellation: %s\n", showoff(inintr));
6326 printf(" Input case: %s\n", inpcas[cmdlvl] ?
6327 "observe" : "ignore");
6328 printf(" Input buffer-length: %d\n", inbufsize);
6329 printf(" Input echo: %s\n", showoff(inecho));
6330 printf(" Input silence: %d (seconds)\n", insilence);
6332 printf(" Input terminal: %s\n", showoff(interm));
6334 printf(" Input timeout: %s\n", intime[cmdlvl] ?
6335 "quit" : "proceed");
6337 printf(" Input scale-factor: %s\n", inpscale ? inpscale : "1.0");
6338 #endif /* CKFLOAT */
6341 printf(" Last INPUT: -1 (INPUT command not yet given)\n");
6343 printf(" Last INPUT: %d (%s)\n", instatus,i_text[instatus]);
6351 char * p, * q, ** ap;
6353 #endif /* COMMENT */
6354 char *s; int x = 0, y;
6357 if ((y = cmfld("Array name","",&s,NULL)) < 0)
6360 ckstrncpy(line,s,LINBUFSIZ);
6362 if ((y = cmcfm()) < 0)
6366 if ((x = arraybounds(s,&(range[0]),&(range[1]))) < 0) {
6367 printf("?Bad array: %s\n",s);
6372 printf("Array not declared: %s\n", s);
6373 return(success = 1);
6376 max = (range[1] > 0) ?
6378 ((range[0] > 0) ? range[0] : a_dim[x]);
6384 printf("\\&%c[]: Dimension = %d",arrayitoa(x),a_dim[x]);
6386 printf(" (Link to \\&%c[])",arrayitoa(a_link[x]));
6388 for (i = range[0]; i <= max; i++) {
6390 printf("%3d. %s\n",i,ap[i]);
6393 x = strlen(ap[i]) + 5;
6394 y = (x % cmd_cols) ? 1 : 0;
6395 n += (x / cmd_cols) + y;
6399 if (n > (cmd_rows - 3)) {
6412 /* All arrays - just show name and dimension */
6414 for (y = 0; y < (int) 'z' - ARRAYBASE + 1; y++) {
6416 if (x == 0) printf("Declared arrays:\n");
6418 printf(" \\&%c[%d]",
6419 (y == 1) ? 64 : y + ARRAYBASE, a_dim[y]);
6421 printf(" => \\&%c[]",arrayitoa(a_link[y]));
6424 if (!x) printf(" No arrays declared\n");
6432 int y, z, i; long zz;
6433 extern int optlines;
6437 extern int tt_kb_mode;
6439 extern int srvcdmsg;
6440 extern char * cdmsgstr, * ckcdpath;
6443 if (x == SHKEY) { /* SHOW KEY */
6446 if ((x = cmkey(shokeytab,nshokey,"How many keys should be shown?",
6447 "one",xxstring)) < 0) return(x);
6448 switch (tt_kb_mode) {
6463 if ((z = cmkey(shokeymtab,nshokeym,"Which definition should be shown?",
6464 s,xxstring)) < 0) return(z);
6468 if ((y = cmcfm()) < 0) return(y);
6471 printf("Sorry, command disabled.\r\n");
6472 return(success = 0);
6477 printf("Not implemented\n");
6483 for (c = 0; c < KMSIZE; c++) {
6484 evt = (z < 0) ? mapkey(c) : maptermkey(c,z);
6485 if (evt.type != error) {
6491 printf(" Press key: ");
6495 #endif /* NOSETBUF */
6497 conbin((char)escape); /* Put terminal in binary mode */
6499 os2gks = 0; /* Raw scancode processing */
6501 c = congks(0); /* Get character or scan code */
6503 os2gks = 1; /* Cooked scancode processing */
6505 concb((char)escape); /* Restore terminal to cbreak mode */
6506 if (c < 0) { /* Check for error */
6507 printf("?Error reading key\n");
6512 Do NOT mask when it can be a raw scan code, perhaps > 255
6514 c &= cmdmsk; /* Apply command mask */
6529 if (x == SHKVB) { /* SHOW KVERBS */
6530 if ((y = cmcfm()) < 0) return(y);
6533 printf("Sorry, command disabled.\r\n");
6534 return(success = 0);
6537 printf("\nThe following %d keyboard verbs are available:\n\n",nkverbs);
6538 kwdhelp(kverbs,nkverbs,"","\\K","",3,0);
6543 if (x == SHUDK) { /* SHOW UDKs */
6544 extern void showudk(void);
6545 if ((y = cmcfm()) < 0) return(y);
6548 printf("Sorry, command disabled.\r\n");
6549 return(success = 0);
6556 #endif /* NOKVERBS */
6557 #endif /* NOSETKEY */
6560 if (x == SHMAC) { /* SHOW MACRO */
6561 struct FDB kw, fl, cm;
6562 int i, k, n = 0, left, flag, confirmed = 0;
6564 for (i = 0; i < nmac; i++) { /* copy the macro table */
6565 mackey[i].kwd = mactab[i].kwd; /* into a regular keyword table */
6566 mackey[i].kwval = i; /* with value = pointer to macro tbl */
6567 mackey[i].flgs = mactab[i].flgs;
6571 while (!confirmed && n < 64) {
6572 cmfdbi(&kw, /* First FDB - macro table */
6574 "Macro name", /* hlpmsg */
6576 "", /* addtl string data */
6577 nmac, /* addtl numeric data 1: tbl size */
6578 0, /* addtl numeric data 2: 4 = cmswi */
6579 xxstring, /* Processing function */
6580 mackey, /* Keyword table */
6581 &fl /* Pointer to next FDB */
6583 cmfdbi(&fl, /* 2nd FDB - something not in mactab */
6587 "", /* addtl string data */
6588 0, /* addtl numeric data 1 */
6589 0, /* addtl numeric data 2 */
6594 cmfdbi(&cm, /* 3rd FDB - Confirmation */
6598 "", /* addtl string data */
6599 0, /* addtl numeric data 1 */
6600 0, /* addtl numeric data 2 */
6605 x = cmfdb(&kw); /* Parse something */
6608 s = atmbuf; /* What the user typed */
6609 switch (cmresult.fcode) {
6610 case _CMKEY: /* If it was a keyword */
6611 y = mlook(mactab,atmbuf,nmac); /* get full name */
6613 s = mactab[y].kwd; /* (fall thru on purpose...) */
6615 k = ckstrncpy(p,s,left) + 1; /* Copy result to list */
6621 q[n++] = p; /* Point to this item */
6622 p += k; /* Move buffer pointer past it */
6624 case _CMCFM: /* End of command */
6631 printf("Macros:\n");
6633 for (y = 0; y < nmac; y++)
6634 if (shomac(mactab[y].kwd,mactab[y].mval) < 0) break;
6638 for (i = 0; i < n; i++) {
6643 if (iswild(s)) { /* Pattern match */
6644 for (k = 0, x = 0; x < nmac; x++) {
6645 if (ckmatch(s,mactab[x].kwd,0,1)) {
6646 shomac(mactab[x].kwd,mactab[x].mval);
6654 } else { /* Exact match */
6655 x = mxlook(mactab,s,nmac);
6658 if (flag && x == -1)
6659 x = mlook(mactab,s,nmac);
6661 case -3: /* Nothing to look up */
6662 case -1: /* Not found */
6663 printf("%s - (not defined)\n",s);
6665 case -2: /* Ambiguous, matches more than one */
6666 printf("%s - ambiguous\n",s);
6668 default: /* Matches one exactly */
6669 shomac(mactab[x].kwd,mactab[x].mval);
6678 Other SHOW commands only have two fields. Get command confirmation here,
6679 then handle with big switch() statement.
6682 if (x != SHBUI && x != SHARR)
6684 if ((y = cmcfm()) < 0)
6688 /* This restriction is too general. */
6695 #endif /* CK_LOGIN */
6697 printf("Sorry, command disabled.\r\n");
6698 return(success = 0);
6701 #endif /* COMMENT */
6715 printf(" No network support in this version of C-Kermit.\n");
6718 printf(" No network support in this version of C-Kermit.\n");
6721 #endif /* NETCONN */
6722 #endif /* NOLOCAL */
6737 printf(" %d\n",count[cmdlvl]);
6742 case SHSER: /* Show Server */
6745 printf("Function: Status:\n");
6747 printf(" GET %s\n",nm[en_get]);
6749 printf(" SEND %s\n",nm[en_sen]);
6751 printf(" MAIL %s\n",nm[inserver ? 0 : en_mai]);
6753 printf(" PRINT %s\n",nm[inserver ? 0 : en_pri]);
6756 printf(" REMOTE ASSIGN %s\n",nm[en_asg]);
6759 printf(" REMOTE CD/CWD %s\n",nm[en_cwd]);
6762 printf(" REMOTE COPY %s\n",nm[en_cpy]);
6765 printf(" REMOTE DELETE %s\n",nm[en_del]);
6766 printf(" REMOTE DIRECTORY %s\n",nm[en_dir]);
6767 printf(" REMOTE HOST %s\n",nm[inserver ? 0 : en_hos]);
6770 printf(" REMOTE QUERY %s\n",nm[en_que]);
6773 printf(" REMOTE MKDIR %s\n",nm[en_mkd]);
6774 printf(" REMOTE RMDIR %s\n",nm[en_rmd]);
6775 printf(" REMOTE RENAME %s\n",nm[en_ren]);
6776 printf(" REMOTE SET %s\n",nm[en_set]);
6777 printf(" REMOTE SPACE %s\n",nm[en_spa]);
6778 printf(" REMOTE TYPE %s\n",nm[en_typ]);
6779 printf(" REMOTE WHO %s\n",nm[inserver ? 0 : en_who]);
6780 printf(" BYE %s\n",nm[en_bye]);
6781 printf(" FINISH %s\n",nm[en_fin]);
6782 printf(" EXIT %s\n",nm[en_xit]);
6783 printf(" ENABLE %s\n",nm[en_ena]);
6785 #endif /* NOFRILLS */
6786 if (i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
6787 printf("Server timeout: %d\n",srvtim);
6788 if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
6789 printf("Server idle-timeout: %d\n",srvidl);
6790 if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
6791 printf("Server keepalive %s\n", showoff(srvping));
6792 if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
6793 printf("Server cd-message %s\n", showoff(srvcdmsg));
6794 if (srvcdmsg && cdmsgstr)
6795 printf("Server cd-message %s\n", cdmsgstr);
6796 if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
6797 printf("Server display: %s\n", showoff(srvdis));
6798 if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
6799 printf("Server login: ");
6803 printf("\"%s\", \"%s\", \"%s\"\n",
6805 x_passwd ? x_passwd : "",
6806 x_acct ? x_acct : ""
6809 if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
6810 printf("Server get-path: ");
6811 if (ngetpath == 0) {
6812 printf(" (none)\n");
6816 for (x = 0; x < ngetpath; x++) {
6817 if (getpath[x]) printf(" %d. %s\n", x, getpath[x]);
6818 if (++i > (cmd_rows - 3)) { /* More than a screenful... */
6827 #endif /* NOSERVER */
6829 case SHSTA: /* Status of last command */
6830 printf(" %s\n", success ? "SUCCESS" : "FAILURE");
6831 return(0); /* Don't change it */
6833 case SHSTK: { /* Stack for MAC debugging */
6837 loadA0 ((char *)&sp); /* set destination address */
6838 SPtoaA0(); /* move SP to destination */
6839 printf("Stack at 0x%x\n", sp);
6840 show_queue(); /* more debugging */
6851 case SHTAB: /* SHOW TABS */
6854 printf("Sorry, command disabled.\r\n");
6855 return(success = 0);
6862 case SHTER: /* SHOW TERMINAL */
6865 printf("Sorry, command disabled.\r\n");
6866 return(success = 0);
6873 case SHVSCRN: /* SHOW Virtual Screen - for debug */
6877 #endif /* NOLOCAL */
6880 case SHMOU: /* SHOW MOUSE */
6883 printf("Sorry, command disabled.\r\n");
6884 return(success = 0);
6889 #endif /* OS2MOUSE */
6895 #endif /* NOFRILLS */
6898 case SHBUI: /* Built-in variables */
6900 if ((y = cmtxt("Variable name or pattern","",&s,xxstring)) < 0)
6902 ckstrncpy(line,s,LINBUFSIZ);
6903 /* if (line[0]) ckstrncat(line,"*",LINBUFSIZ); */
6905 case SHFUN: /* or built-in functions */
6908 if (tt_cols[VTERM] < 0 || tt_rows[VTERM] < 0)
6911 if (ttgwsiz() > 0) { /* Get current screen size */
6912 if (tt_rows > 0 && tt_cols > 0) {
6918 #endif /* CK_TTGWSIZ */
6920 if (x == SHFUN) { /* Functions */
6921 printf("\nThe following functions are available:\n\n");
6922 kwdhelp(fnctab,nfuncs,"","\\F","()",3,0);
6926 "HELP FUNCTION <name> gives the calling conventions of the given function.\n\n"
6930 } else { /* Variables */
6931 int j, flag = 0, havearg = 0;
6932 struct stringarray * q = NULL;
6934 if (line[0]) { /* Have something to search for */
6935 havearg = 1; /* Maybe a list of things */
6936 q = cksplit(1,0,line,NULL,"_-^$*?[]{}",0,0,0);
6941 for (y = 0; y < nvars; y++) {
6942 if ((vartab[y].flgs & CM_INV))
6944 if (havearg) { /* If I have something to match */
6946 for (flag = 0, j = 1; j <= q->a_size && !flag; j++) {
6947 s2 = pp[j] ? pp[j] : "";
6949 /* This is not needed because it's what the 4 arg does in ckmatch() */
6952 if (s2[len-1] != '$') {/* To allow anchors */
6953 ckmakmsg(line,LINBUFSIZ,pp[j],"*",NULL,NULL);
6957 #endif /* COMMENT */
6958 if (ckmatch(s2,vartab[y].kwd,0,4) > 0) {
6959 flag = 1; /* Matches */
6963 if (!flag) /* Doesn't match */
6966 s = nvlook(vartab[y].kwd);
6967 printf(" \\v(%s) = ",vartab[y].kwd);
6968 if (vartab[y].kwval == VN_NEWL) { /* \v(newline) */
6969 while (*s) /* Show control chars symbolically */
6970 printf("\\{%d}",*s++);
6972 } else if (vartab[y].kwval == VN_IBUF || /* \v(input) */
6973 vartab[y].kwval == VN_QUE || /* \v(query) */
6975 vartab[y].kwval == VN_SELCT || /* \v(select) */
6977 (vartab[y].kwval >= VN_M_AAA && /* modem ones */
6978 vartab[y].kwval <= VN_M_ZZZ)
6980 int r = 12; /* This one can wrap around */
6988 sprintf(buf,"\\{%d}",*s); /* SAFE */
6989 r += (int) strlen(buf);
6991 if (r >= cmd_cols - 1) {
7002 if (++i > (cmd_rows - 3)) { /* More than a screenful... */
7003 if ((y >= nvars - 1) || !askmore())
7012 case SHVAR: /* Global variables */
7013 x = 0; /* Variable count */
7014 slc = 1; /* Screen line count for "more?" */
7015 for (y = 33; y < GVARS; y++)
7017 if (x++ == 0) printf("Global variables:\n");
7018 sprintf(line," \\%%%c",y); /* SAFE */
7019 if (shomac(line,g_var[y]) < 0) break;
7021 if (!x) printf(" No variables defined\n");
7024 case SHARG: { /* Args */
7027 printf("Macro arguments at level %d (\\v(argc) = %d):\n",
7031 for (y = 0; y < macargc[maclvl]; y++) {
7032 s1 = m_arg[maclvl][y];
7033 if (!s1) s1 = "(NULL)";
7034 s2 = m_xarg[maclvl][y];
7035 if (!s2) s2 = "(NULL)";
7037 printf(" \\%%%d = %s\n",y,s1);
7039 printf(" \\&_[%d] = %s\n",y,s2);
7042 printf("Top-level arguments (\\v(argc) = %d):\n", topargc);
7043 for (y = 0; y < topargc; y++) {
7044 s1 = g_var[y + '0'];
7045 if (!s1) s1 = "(NULL)";
7047 if (!s2) s2 = "(NULL)";
7048 if (y < 10 && g_var[y])
7049 printf(" \\%%%d = %s\n",y,s1);
7051 printf(" \\&_[%d] = %s\n",y,s2);
7057 case SHARR: /* Arrays */
7058 return(showarray());
7062 case SHPRO: /* Protocol parameters */
7069 case SHCOM: /* Communication parameters */
7075 char *s = "(unknown)";
7076 for (i = 0; i < nprty; i++)
7077 if (prtytab[i].kwval == priority) {
7081 printf(" Priority: %s\n", s );
7092 #endif /* NETCONN */
7097 #endif /* NETCONN */
7104 printf("Type SHOW DIAL to see DIAL-related items.\n");
7105 printf("Type SHOW MODEM to see modem-related items.\n");
7107 printf("Type SHOW TAPI to see TAPI-related items.\n");
7108 #endif /* CK_TAPI */
7113 #endif /* NOLOCAL */
7115 case SHFIL: /* File parameters */
7117 /* printf("\n"); */ /* (out o' space) */
7121 case SHLNG: /* Languages */
7124 #endif /* NOCSETS */
7127 case SHSCR: /* Scripts */
7128 printf(" Command quoting: %s\n", showoff(cmdgquo()));
7129 printf(" Take echo: %s\n", showoff(techo));
7130 printf(" Take error: %s\n", showoff(takerr[cmdlvl]));
7131 printf(" Macro echo: %s\n", showoff(mecho));
7132 printf(" Macro error: %s\n", showoff(merror[cmdlvl]));
7133 printf(" Quiet: %s\n", showoff(quiet));
7134 printf(" Variable evaluation: %s [\\%%x and \\&x[] variables]\n",
7135 vareval ? "recursive" : "simple");
7136 printf(" Function diagnostics: %s\n", showoff(fndiags));
7137 printf(" Function error: %s\n", showoff(fnerror));
7140 extern char * learnfile;
7141 extern int learning;
7143 printf(" LEARN file: %s (%s)\n",
7145 learning ? "ON" : "OFF"
7148 printf(" LEARN file: (none)\n");
7150 #endif /* CKLEARN */
7154 printf(" Script echo: %s\n", showoff(secho));
7155 #endif /* NOSCRIPT */
7156 printf(" Command buffer length: %d\n", CMDBL);
7157 printf(" Atom buffer length: %d\n", ATMBL);
7164 printf(" File type: %s\n",
7165 binary ? "binary" : "text");
7167 printf(" File character-set: %s\n",
7168 fcsinfo[fcharset].keyword);
7170 if ( isunicode() ) {
7171 printf(" Terminal Character (remote): %s\n",
7172 tt_utf8 ? "utf-8" : tcsr == TX_TRANSP ? "transparent" :
7173 tcsr == TX_UNDEF ? "undefined" : txrinfo[tcsr]->keywd);
7174 printf(" Terminal Character (local): %s\n",
7175 tcsl == TX_TRANSP ? "transparent" :
7176 tcsl == TX_UNDEF ? "undefined" : txrinfo[tcsl]->keywd);
7178 printf(" Terminal Character (remote): %s\n",
7179 tt_utf8 ? "utf-8" : tcsr == TX_TRANSP ? "transparent" :
7180 tcsr == TX_UNDEF ? "undefined" : txrinfo[tcsr]->keywd);
7181 printf(" Terminal Character (local): %s\n",
7182 tcsl == TX_TRANSP ? "transparent" :
7183 tcsl == TX_UNDEF ? "undefined" : txrinfo[tcsl]->keywd);
7186 printf(" Terminal character-set (remote): %s\n",
7187 fcsinfo[tcsr].keyword);
7188 printf(" Terminal character-set (local): %s\n",
7189 fcsinfo[tcsl].keyword);
7191 #endif /* NOCSETS */
7192 printf(" Terminal bytesize: %d\n",
7193 (cmask == 0xff) ? 8 : 7);
7194 printf(" Terminal echo: %s\n",
7195 duplex ? "local" : "remote");
7196 printf(" Transmit EOF: ");
7197 if (*xmitbuf == NUL) {
7204 printf("^%c",ctl(*p));
7212 printf(" Transmit Fill: %d\n", xmitf);
7214 printf(" Transmit Fill: (none)\n");
7215 printf(" Transmit Linefeed: %s\n",showoff(xmitl));
7217 printf(" Transmit Prompt: %d (%s)\n",
7222 printf(" Transmit Prompt: (none)\n");
7223 printf(" Transmit Echo: %s\n", showoff(xmitx));
7224 printf(" Transmit Locking-Shift: %s\n", showoff(xmits));
7225 printf(" Transmit Pause: %d (millisecond%s)\n",
7227 (xmitw == 1) ? "" : "s"
7229 printf(" Transmit Timeout: %d (second%s)\n",
7231 (xmitt == 1) ? "" : "s"
7238 case SHMOD: /* SHOW MODEM */
7241 printf("Sorry, command disabled.\r\n");
7242 return(success = 0);
7245 shomodem(); /* Show SET MODEM items */
7251 printf("%s\n",zgtdir());
7259 printf("Sorry, command disabled.\r\n");
7260 return(success = 0);
7263 return(shoesc(escape));
7266 case SHDIA: /* SHOW DIAL */
7269 printf("Sorry, command disabled.\r\n");
7270 return(success = 0);
7274 printf(", speed: ");
7275 if ((zz = ttgspd()) < 0) {
7278 if (zz == 8880) printf("75/1200"); else printf("%ld",zz);
7280 if (carrier == CAR_OFF) s = "off";
7281 else if (carrier == CAR_ON) s = "on";
7282 else if (carrier == CAR_AUT) s = "auto";
7284 printf(", carrier: %s", s);
7285 if (carrier == CAR_ON) {
7286 if (cdtimo) printf(", timeout: %d sec", cdtimo);
7287 else printf(", timeout: none");
7294 #endif /* NETCONN */
7296 printf("Type SHOW MODEM to see modem settings.\n");
7298 printf("Type SHOW TAPI to see TAPI-related items\n");
7299 #endif /* CK_TAPI */
7300 printf("Type SHOW COMMUNICATIONS to see modem signals.\n");
7304 #endif /* NOLOCAL */
7308 case SHLBL: /* Labeled file info */
7311 #endif /* CK_LABELED */
7314 case SHCSE: /* Character sets */
7317 " Character set translation is not supported in this version of C-Kermit\n");
7321 printf("\n Unknown-Char-Set: %s\n",
7322 unkcs ? "Keep" : "Discard");
7330 /* PC Code Page information */
7333 int cplist[16], cps;
7335 cps = os2getcplist(cplist, sizeof(cplist));
7337 sprintf(cpbuf, /* SAFE */
7338 "%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d",
7339 cps > 1 ? cplist[1] : 0,
7340 cps > 2 ? cplist[2] : 0, cps > 3 ? cplist[3] : 0,
7341 cps > 4 ? cplist[4] : 0, cps > 5 ? cplist[5] : 0,
7342 cps > 6 ? cplist[6] : 0, cps > 7 ? cplist[7] : 0,
7343 cps > 8 ? cplist[8] : 0, cps > 9 ? cplist[9] : 0,
7344 cps > 10 ? cplist[10] : 0, cps > 11 ? cplist[11] : 0,
7345 cps > 12 ? cplist[12] : 0
7347 printf(" Code Pages:\n");
7348 activecp = os2getcp();
7350 printf(" Active: %d\n",activecp);
7352 printf(" Available: %s\n",cpbuf);
7354 printf(" Active: n/a\n");
7358 #endif /* NOCSETS */
7361 case SHFEA: /* Features */
7366 case SHCTL: /* Control-Prefix table */
7369 #endif /* CK_SPEED */
7372 extern int exithangup;
7373 printf("\n Exit warning %s\n", xitwarn ?
7374 (xitwarn == 1 ? "on" : "always") : "off");
7375 printf(" Exit on-disconnect: %s\n", showoff(exitonclose));
7376 printf(" Exit hangup: %s\n", showoff(exithangup));
7377 printf(" Current exit status: %d\n\n", xitsta);
7382 extern int printtimo, printertype, noprinter;
7383 extern char * printterm, * printsep;
7386 extern int printbidi;
7388 #endif /* PRINTSWI */
7394 #else /* CK_LOGIN */
7396 #endif /* CK_LOGIN */
7398 printf("Sorry, command disabled.\r\n");
7399 return(success = 0);
7404 printf("Printer: (none)\n\n");
7407 #endif /* PRINTSWI */
7409 printf("Printer: %s%s\n",
7411 printpipe ? "| " : "",
7412 printername ? printername :
7422 printf(" /BIDIRECTIONAL\n");
7424 printf(" /SPEED:%ld\n",pportspeed);
7425 printf(" /PARITY:%s\n",parnam((char)pportparity));
7426 printf(" /FLOW:%s\n",
7427 pportflow == FLO_NONE ? "NONE" :
7428 (pportflow == FLO_RTSC ? "RTS/CTS" : "XON/XOFF")
7431 printf(" /OUTPUT-ONLY\n");
7433 switch (printertype) {
7434 case PRT_NON: printf(" /NONE\n"); break;
7435 case PRT_FIL: printf(" /FILE\n"); break;
7436 case PRT_PIP: printf(" /PIPE\n"); break;
7437 case PRT_DOS: printf(" /DOS-DEVICE\n"); break;
7438 case PRT_WIN: printf(" /WINDOWS-QUEUE\n"); break;
7440 printf(" /TIMEOUT:%d\n",printtimo);
7442 printf(" /END-OF-JOB-STRING:");
7443 shostrdef(printterm);
7446 printf(" /END-OF-JOB-STRING:(none)\n");
7447 printf(" /JOB-HEADER-FILE:%s\n",printsep ? printsep : "(none)");
7448 printf(" /CHARACTER-SET: %s\n",txrinfo[prncs]->keywd);
7449 #endif /* PRINTSWI */
7455 #ifdef DOUBLEQUOTING
7457 #endif /* DOUBLEQUOTING */
7459 printf(" Command autodownload: %s\n",showoff(cmdadl));
7461 printf(" Command autodownload: (not available)\n");
7462 #endif /* CK_AUTODL */
7463 printf(" Command bytesize: %d bits\n", (cmdmsk == 0377) ? 8 : 7);
7464 printf(" Command error-display: %d\n", cmd_err);
7466 printf(" Command recall-buffer-size: %d\n",cm_recall);
7468 printf(" Command recall-buffer not available in this version\n");
7469 #endif /* CK_RECALL */
7471 printf(" Command retry: %s\n",showoff(cm_retry));
7473 printf(" Command retry not available in this version\n");
7474 #endif /* CK_RECALL */
7475 printf(" Command interruption: %s\n", showoff(cmdint));
7476 printf(" Command quoting: %s\n", showoff(cmdgquo()));
7477 #ifdef DOUBLEQUOTING
7478 printf(" Command doublequoting: %s\n", showoff(dblquo));
7479 #endif /* DOUBLEQUOTING */
7480 printf(" Command more-prompting: %s\n", showoff(xaskmore));
7481 printf(" Command height: %d\n", cmd_rows);
7482 printf(" Command width: %d\n", cmd_cols);
7485 printf(" Command statusline: %s\n",showoff(tt_status[VCMD]));
7487 #endif /* IKSDONLY */
7489 printf(" Locus: %s",
7490 autolocus ? (autolocus == 2 ? "ask" : "auto") :
7491 (locus ? "local" : "remote"));
7493 printf(" (%s)", locus ? "local" : "remote");
7496 printf(" Hints: %s\n", showoff(hints));
7497 printf(" Quiet: %s\n", showoff(quiet));
7498 printf(" Maximum command length: %d\n", CMDBL);
7503 printf(" Maximum number of macros: %d\n", MAC_MAX);
7504 printf(" Macros defined: %d\n", nmac);
7505 printf(" Maximum macro depth: %d\n", MACLEVEL);
7506 printf(" Maximum TAKE depth: %d\n", MAXTAKE);
7507 s = "(not defined)";
7508 k = mlook(mactab,"on_unknown_command",nmac);
7509 if (k > -1) if (mactab[k].mval) s = mactab[k].mval;
7510 printf(" ON_UNKNOWN_COMMAND: %s\n",s);
7515 printf(" Suspend: %s\n", showoff(xsuspend));
7518 printf(" Access to external commands and programs%s allowed\n",
7529 printf("Alarm at %s %s\n",alrm_date,alrm_time);
7531 printf("(no alarm set)\n");
7537 extern struct filelist * filehead;
7539 printf("send-list is empty\n");
7541 struct filelist * flp;
7546 if (!s) s = "(none)";
7547 printf("%s, mode: %s, alias: %s\n",
7549 gfmode(flp->fl_mode,0),
7557 #endif /* NOMSEND */
7563 #endif /* CKXXCHAR */
7569 s = getenv("EDITOR");
7570 if (s) ckstrncpy(editor,s,CKMAXPATH);
7572 printf("\n editor: %s\n", editor[0] ? editor : "(none)");
7574 printf(" options: %s\n", editopts[0] ? editopts : "(none)");
7575 printf(" file: %s\n", editfile[0] ? editfile : "(none)");
7583 s = getenv("BROWSER");
7584 if (s) ckstrncpy(browser,s,CKMAXPATH);
7586 printf("\n browser: %s\n", browser[0] ? browser : "(none)");
7588 printf(" options: %s\n", browsopts[0] ? browsopts : "(none)");
7589 printf(" url: %s\n", browsurl[0] ? browsurl : "(none)");
7593 #endif /* BROWSER */
7594 #endif /* NOFRILLS */
7599 case SHTAPI: /* TAPI options */
7602 printf("Sorry, command disabled.\r\n");
7603 return(success = 0);
7608 case SHTAPI_L: /* TAPI Locations */
7611 printf("Sorry, command disabled.\r\n");
7612 return(success = 0);
7617 case SHTAPI_M: /* TAPI Modem */
7620 printf("Sorry, command disabled.\r\n");
7621 return(success = 0);
7626 case SHTAPI_C: /* TAPI Comm */
7629 printf("Sorry, command disabled.\r\n");
7630 return(success = 0);
7635 #endif /* CK_TAPI */
7637 case SHTCP: /* SHOTCP */
7644 case SHTEL: /* TELNET */
7650 case SHTOPT: /* TELNET OPTIONS */
7659 extern char * tt_trigger[], * triggerval;
7661 if (!tt_trigger[0]) {
7662 printf(" Triggers: (none)\n");
7664 printf(" Triggers:\n");
7665 for (i = 0; i < TRIGGERS; i++) {
7668 printf(" \"%s\"\n",tt_trigger[i]);
7670 printf(" Most recent trigger encountered: ");
7672 printf("\"%s\"\n",triggerval);
7678 #endif /* CK_TRIGGER */
7679 #endif /* NOLOCAL */
7693 #else /* CK_LOGIN */
7695 #endif /* CK_LOGIN */
7697 printf("Sorry, command disabled.\r\n");
7698 return(success = 0);
7702 printf("\n Debug log: %s", deblog ? debfil : "(none)");
7705 if (debtim) printf(" (timestamps)");
7710 printf(" Packet log: %s\n", pktlog ? pktfil : "(none)");
7713 printf(" Session log: %s", seslog ? sesfil : "(none)");
7715 extern int sessft, slogts, slognul;
7717 case XYFT_T: printf(" (text)"); break;
7718 case XYFT_B: printf(" (binary)"); break;
7719 case XYFT_D: printf(" (debug)"); break;
7721 if (slogts) printf("(timestamped)");
7722 if (slognul) printf("(null-padded)");
7726 #endif /* NOLOCAL */
7728 printf(" Transaction log: %s (%s)\n",
7729 (tralog ? (*trafil ? trafil : "(none)") : "(none)"),
7730 (tlogfmt ? ((tlogfmt == 2) ? "ftp" : "verbose") : "brief")
7734 printf(" Connection log: %s\n", dialog ? diafil : "(none)");
7735 #endif /* CKLOGDIAL */
7742 case SHOUTP: /* OUTPUT */
7748 case SHOPAT: /* PATTERNS */
7751 #endif /* PATTERNS */
7754 case SHOSTR: { /* STREAMING */
7755 extern int streamrq, clearrq, cleared;
7757 debug(F101,"SHOW RELIABLE reliable","",reliable);
7758 printf("\n Reliable: %s\n",showooa(reliable));
7759 printf(" Clearchannel: %s\n",showooa(clearrq));
7760 printf(" Streaming: %s\n\n",showooa(streamrq));
7761 if ((!local && (streamrq == SET_ON)) ||
7762 (streamrq == SET_AUTO && reliable))
7763 printf(" Streaming will be done if requested.\n");
7764 else if ((streamrq == SET_OFF) ||
7765 ((streamrq == SET_AUTO) && !reliable))
7766 printf(" Streaming will not be requested and will not be done.\n");
7767 else if ((streamrq == SET_ON) ||
7768 ((streamrq == SET_AUTO) && reliable))
7770 " Streaming will be requested and will be done if the other Kermit agrees.\n");
7771 printf(" Last transfer: %sstreaming%s, %ld cps.\n",
7772 streamed > 0 ? "" : "no ",
7773 cleared ? ", clearchannel" : "",
7779 #endif /* STREAMING */
7785 #ifdef CK_AUTHENTICATION
7787 return(sho_auth(0));
7788 #endif /* CK_AUTHENTICATION */
7794 printf("Sorry, command disabled.\r\n");
7795 return(success = 0);
7800 extern char ftpapp[], ftpopts[];
7801 printf(" ftp-client: %s\n", ftpapp[0] ? ftpapp : "(none)");
7803 printf(" ftp options: %s\n", ftpopts[0] ? ftpopts : "(none)");
7809 printf("(No FTP client included in this version of Kermit.)\n");
7819 extern int dbenabled;
7820 extern char * dbfile, * dbdir;
7824 extern char * wtmpfile;
7827 extern int ckxanon, xferlog, logintimo;
7828 extern char * xferfile;
7833 extern int ckxperms;
7834 #endif /* CK_PERMS */
7835 #endif /* CK_LOGIN */
7836 extern char * bannerfile, * helpfile;
7842 #else /* CK_LOGIN */
7844 #endif /* CK_LOGIN */
7846 printf("Sorry, command disabled.\r\n");
7847 return(success = 0);
7852 printf(" --nointerrupts\n");
7853 printf(" --bannerfile=%s\n",bannerfile ? bannerfile : "(null)");
7854 printf(" --cdfile:%s\n",cdmsgstr ? cdmsgstr : "(null)");
7855 printf(" --cdmessage:%d\n",srvcdmsg);
7856 printf(" --helpfile:%d\n",helpfile);
7863 printf(" --syslog:%d (forced)\n",ckxsyslog);
7865 printf(" --syslog:%d\n",ckxsyslog);
7866 #endif /* SYSLOGLEVEL */
7867 #endif /* CKSYSLOG */
7869 printf(" --wtmplog:%d\n",ckxwtmp);
7870 printf(" --wtmpfile=%s\n",wtmpfile ? wtmpfile : "(null)");
7874 printf(" --anonymous:%d\n",ckxanon);
7876 printf(" --privid:%d\n",ckxpriv);
7879 printf(" --permission:%04o\n",ckxperms);
7880 #endif /* CK_PERMS */
7881 printf(" --initfile:%s\n",anonfile ? anonfile : "(null)");
7882 printf(" --userfile:%s\n",userfile ? userfile : "(null)");
7883 printf(" --root:%s\n",anonroot ? anonroot : "(null)");
7884 printf(" --xferlog=%d\n",xferlog);
7885 printf(" --xferfile=%s\n",xferfile ? xferfile : "(null)");
7886 printf(" --timeout=%d\n",logintimo);
7887 #endif /* CK_LOGIN */
7889 printf(" --database=%d\n",dbenabled);
7890 printf(" --dbfile=%s\n",dbfile ? dbfile : "(null)");
7892 printf(" (db directory=[%s])\n",dbdir);
7895 printf(" IKSD conf=%s\n",iksdconf);
7896 #endif /* IKSDCONF */
7904 extern char * myhome;
7905 s = getenv("CDPATH");
7906 if (!s) s = "(none)";
7907 printf("\n current directory: %s\n", zgtdir());
7908 printf(" previous directory: %s\n", prevdir ? prevdir : "(none)");
7909 printf(" cd home: %s\n", homepath());
7910 printf(" cd path: %s\n", ckcdpath ? ckcdpath : s);
7911 printf(" cd message: %s\n", showoff(srvcdmsg & 2));
7912 printf(" server cd-message: %s\n", showoff(srvcdmsg & 1));
7913 printf(" cd message file: %s\n\n",cdmsgstr ? cdmsgstr : "(none)");
7920 #endif /* NOCSETS */
7925 if (ftpisconnected()) {
7926 extern char cxlogbuf[];
7927 dologshow(W_FTP | 1);
7937 #endif /* CKLOGDIAL */
7942 (VOID) showdelopts();
7943 #endif /* NOFRILLS */
7945 (VOID) showdiropts();
7946 #endif /* DOMYDIR */
7948 (VOID) showpurgopts();
7949 #endif /* CKPURGE */
7950 (VOID) showtypopts();
7957 #endif /* NOLOCAL */
7969 #endif /* CK_RECALL */
7996 #endif /* NORENAME */
7997 #endif /* NOFRILLS */
8000 printf("\nNothing to show...\n");
8003 return(success = 1);
8009 printf("Attributes: %s\n", showoff(atcapr));
8010 if (!atcapr) return(0);
8011 printf(" Blocksize: %s\n", showoff(atblki));
8012 printf(" Date: %s\n", showoff(atdati));
8013 printf(" Disposition: %s\n", showoff(atdisi));
8014 printf(" Encoding (Character Set): %s\n", showoff(atenci));
8015 printf(" Length: %s\n", showoff(atleni));
8016 printf(" Type (text/binary): %s\n", showoff(attypi));
8017 printf(" System ID: %s\n", showoff(atsidi));
8018 printf(" System Info: %s\n", showoff(atsysi));
8020 printf(" Permissions In: %s\n", showoff(atlpri));
8021 printf(" Permissions Out: %s\n", showoff(atlpro));
8022 #endif /* CK_PERMS */
8024 printf(" Format: %s\n", showoff(atfrmi));
8025 printf(" Creator: %s\n", showoff(atcrei));
8026 printf(" Account: %s\n", showoff(atacti));
8027 #endif /* STRATUS */
8033 int /* SHOW MACROS */
8034 shomac(s1, s2) char *s1, *s2; {
8036 pp = 0; /* Parenthesis counter */
8038 debug(F110,"shomac s1",s1,0);
8039 debug(F110,"shomac s2",s2,0);
8045 #else /* IKSDCONF */
8047 #endif /* IKSDCONF */
8049 if (!ckstrcmp("on_exit",s1,-1,0) ||
8050 !ckstrcmp("on_logout",s1,-1,0))
8058 printf("%s = ",s1); /* Print blank line and macro name */
8059 n = (int)strlen(s1) + 4; /* Width of current line */
8060 if (!s2) s2 = "(not defined)";
8062 while ((x = *s2++)) { /* Loop thru definition */
8063 if (x == '(') pp++; /* Treat commas within parens */
8064 if (x == ')') pp--; /* as ordinary text */
8065 if (pp < 0) pp = 0; /* Outside parens, */
8066 if (x == ',' && pp == 0) { /* comma becomes comma-dash-NL. */
8071 if (inserver && (x == '\n')) /* Send CR before LF */
8073 putchar((CHAR)x); /* Output the character */
8074 if (x == '\n') { /* If it was a newline */
8078 #endif /* NOSETBUF */
8080 putchar(' '); /* Indent the next line 1 space */
8081 while(*s2 == ' ') s2++; /* skip past leading blanks */
8082 n = 2; /* restart the character counter */
8083 slc++; /* and increment the line counter. */
8084 } else if (++n > (cmd_cols - 1)) { /* If line is too wide */
8085 putchar('-'); /* output a dash */
8087 putchar(CR); /* and a carriage return */
8088 putchar(NL); /* and a newline */
8092 #endif /* NOSETBUF */
8094 n = 1; /* and restart the char counter */
8095 slc++; /* and increment the line counter */
8097 if (n < 3 && slc > (cmd_rows - 3)) { /* If new line and screen full */
8098 if (!askmore()) return(-1); /* ask if they want more. */
8099 n = 1; /* They do, start a new line */
8100 slc = 0; /* and restart line counter */
8105 putchar(NL); /* End of definition */
8106 if (++slc > (cmd_rows - 3)) {
8107 if (!askmore()) return(-1);
8115 int x_ifnum = 0; /* Flag for IF NUMERIC active */
8118 /* Evaluate an arithmetic expression. */
8119 /* Code adapted from ev, by Howie Kaye of Columbia U & others. */
8121 static int xerror = 0;
8124 static CK_OFF_T tokval;
8126 static CK_OFF_T expval;
8128 #define LONGBITS (8*sizeof (CK_OFF_T))
8133 Replacement for strchr() and index(), neither of which seem to be universal.
8138 windex(char * s, char c)
8140 windex(s,c) char *s, c;
8141 #endif /* CK_ANSIC */
8143 while (*s != NUL && *s != c) s++;
8144 if (*s == c) return(s); else return(NULL);
8151 Returns the next token. If token is a NUMBER, sets tokval appropriately.
8155 char tbuf[80] /* ,*tp */ ; /* Buffer to accumulate number */
8157 while (isspace(*cp)) /* Skip past leading spaces */
8160 debug(F110,"GETTOK",cp,0);
8165 case '-': /* Subtract or Negate */
8166 case '@': /* Greatest Common Divisor */
8167 case '*': /* Multiply */
8168 case '/': /* Divide */
8169 case '%': /* Modulus */
8170 case '<': /* Left shift */
8171 case '>': /* Right shift */
8174 case '#': /* Exclusive Or */
8176 case '^': /* Exponent */
8177 case '!': /* Factorial */
8178 case '(': /* Parens for grouping */
8179 case ')': return(*cp++); /* operator, just return it */
8181 case '\0': return(N_EOT); /* End of line, return that */
8184 /* This is the original code, which allows only integer numbers. */
8186 if (isxdigit(*cp)) { /* Digit, must be a number */
8187 int radix = 10; /* Default radix */
8188 for (tp = tbuf; isxdigit(*cp); cp++)
8189 *tp++ = (char) (isupper(*cp) ? tolower(*cp) : *cp);
8190 *tp = '\0'; /* End number */
8191 switch(isupper(*cp) ? tolower(*cp) : *cp) { /* Examine break char */
8193 case 'x': radix = 16; cp++; break; /* if radix signifier... */
8195 case 'q': radix = 8; cp++; break;
8196 case 't': radix = 2; cp++; break;
8198 for (tp = tbuf, tokval = 0; *tp != '\0'; tp++) {
8200 dig = *tp - '0'; /* Convert number */
8201 if (dig > 10) dig -= 'a'-'0'-10;
8203 if (cmdlvl == 0 && !x_ifnum && !xerror)
8204 printf("?Invalid digit '%c' in number\n",*tp);
8208 tokval = radix*tokval + dig;
8212 if (cmdlvl == 0 && !x_ifnum && !xerror)
8213 printf("Invalid character '%c' in input\n",*cp);
8218 /* This code allows non-numbers to be treated as macro names */
8224 for (i = 0; i < 80; i++) {
8225 /* Look ahead to next break character */
8226 /* pretty much anything that is not in the switch() above. */
8227 if (isalpha(*cp) || isdigit(*cp) ||
8228 *cp == '_' || *cp == ':' || *cp == '.' ||
8229 *cp == '[' || *cp == ']' ||
8230 *cp == '{' || *cp == '}'
8237 printf("Too long - \"%s\"\n", cp1);
8242 if (xerror) return(NUMBER);
8246 if (!isdigit(tbuf[0])) {
8248 x = mxlook(mactab,tbuf,nmac);
8249 debug(F111,"gettok mxlook",tbuf,x);
8251 if (cmdlvl == 0 && !x_ifnum && !xerror)
8252 printf("Bad number - \"%s\"\n",tbuf);
8257 s2 = mactab[x].mval;
8265 #endif /* CKFLOAT */
8267 tokval = ckatofs(s);
8269 if (cmdlvl == 0 && !x_ifnum && !xerror)
8270 printf("Bad number - \"%s\"\n",tbuf);
8277 #endif /* COMMENT */
8282 expon(CK_OFF_T x, CK_OFF_T y)
8284 expon(x,y) CK_OFF_T x,y;
8285 #endif /* CK_ANSIC */
8287 CK_OFF_T result = 1;
8289 if (y < 0) return(0);
8292 if (y & 1) sign = -1;
8295 if (y & 1) result *= x;
8299 return(result * sign);
8303 * factor ::= simple | simple ^ factor
8310 if (curtok == '^') {
8314 expval = expon(oldval,expval);
8319 * termp ::= NULL | {*,/,%,&} factor termp
8324 while (curtok == '*' || curtok == '/' || curtok == '%' || curtok == '&') {
8328 curtok = gettok(); /* skip past operator */
8332 case '*': expval = oldval * expval; break;
8337 printf("?Divide by zero\n");
8342 expval = (op == '/') ? (oldval / expval) : (oldval % expval);
8345 expval = oldval & expval; break;
8355 #endif /* CK_ANSIC */
8356 /* fact */ { /* factorial */
8357 CK_OFF_T result = 1;
8364 * term ::= factor termp
8375 gcd(CK_OFF_T x, CK_OFF_T y)
8377 gcd(x,y) CK_OFF_T x,y;
8378 #endif /* CK_ANSIC */
8379 /* gcd */ { /* Greatest Common Divisor */
8382 if (y < 0) y = -y; /* validate arguments */
8383 if (x == 0 || y == 0) return(x + y); /* this is bogus */
8385 while (!((x & 1) | (y & 1))) { /* get rid of powers of 2 */
8390 while (x != 1 && y != 1 && x != 0 && y != 0) {
8391 while (!(x & 1)) x >>= 1; /* eliminate unnecessary */
8392 while (!(y & 1)) y >>= 1; /* powers of 2 */
8393 if (x < y) { /* force x to be larger */
8401 if (x == 0 || y == 0) return((x + y) << nshift); /* gcd is non-zero one */
8402 else return((CK_OFF_T) 1 << nshift); /* else gcd is 1 */
8406 * exprp ::= NULL | {+,-,|,...} term exprp
8411 while (windex("+-|<>#@",curtok) != NULL) {
8415 curtok = gettok(); /* skip past operator */
8419 case '+' : expval = oldval + expval; break;
8420 case '-' : expval = oldval - expval; break;
8421 case '|' : expval = oldval | expval; break;
8422 case '#' : expval = oldval ^ expval; break;
8423 case '@' : expval = gcd(oldval,expval); break;
8424 case '<' : expval = oldval << expval; break;
8425 case '>' : expval = oldval >> expval; break;
8431 * expr ::= term exprp
8445 if (curtok == '$') {
8447 if (curtok != NUMBER) {
8448 if (cmdlvl == 0 && !x_ifnum)
8449 printf("?Illegal radix\n");
8455 #endif /* COMMENT */
8456 if (curtok != N_EOT) {
8457 if (cmdlvl == 0 && !x_ifnum && !xerror)
8458 printf("?Extra characters after expression\n");
8464 char * /* Silent front end for evala() */
8477 CK_OFF_T v; /* Numeric value */
8479 xerror = 0; /* Start out with no error */
8481 cp = s; /* Make the argument global */
8482 v = xparse(); /* Parse the string */
8483 return(xerror ? "" : ckfstoa(v)); /* Return empty string on error */
8487 * simplest ::= NUMBER | ( expr )
8494 if (curtok == NUMBER)
8496 else if (curtok == '(') {
8497 curtok = gettok(); /* skip over paren */
8499 if (curtok != ')') {
8500 if (cmdlvl == 0 && !x_ifnum && !xerror)
8501 printf("?Missing right parenthesis\n");
8504 debug(F110,"GETTOK SIMPLEST ()",p,0);
8507 if (cmdlvl == 0 && !x_ifnum && !xerror)
8508 printf("?Operator unexpected\n");
8515 * simpler ::= simplest | simplest !
8521 if (curtok == '!') {
8523 expval = fact(expval);
8528 * simple ::= {-,~,!} simpler | simpler
8534 if (curtok == '-' || curtok == '~' || curtok == '!' || curtok == '+') {
8536 curtok = gettok(); /* skip over - sign */
8537 simpler(); /* parse the factor again */
8539 expval = (op == '-') ? -expval : ((op == '!') ? !expval : ~expval);
8543 /* D C L A R R A Y -- Declare an array */
8546 char a = single character designator for the array, e.g. "a".
8547 int n = size of array. -1 means to undeclare the array.
8549 0 or greater on success, having created the requested array with
8550 with n+1 elements, 0..n. If an array of the same name existed
8551 previously, it is destroyed. The new array has all its elements
8552 initialized to NULL pointers. When an array is successfully created,
8553 the return value is its index (0 = 'a', 1 = 'b', and so on.)
8554 -1 on failure (because 'a' out of range or malloc failure).
8558 dclarray(char a, int n)
8560 dclarray(a,n) char a; int n;
8561 #endif /* CK_ANSIC */
8563 char c, **p; int i, n2, rc;
8565 if (a > 63 && a < 91) a += 32; /* Convert letters to lowercase */
8566 if (a < ARRAYBASE || a > 122) /* Verify name */
8569 if (n < 0) /* Check arg */
8571 if (n+1 < 0) /* MAXINT+1 wraps around */
8575 a -= ARRAYBASE; /* Convert name to number */
8576 rc = a; /* Array index will be return code */
8577 if ((p = a_ptr[a]) != NULL) { /* Delete old array of same name */
8578 if (a_link[a] > -1) { /* Is it a link? */
8579 if (n == 0) { /* If we're just deleting it */
8580 a_ptr[a] = (char **) NULL; /* clear all the info. */
8584 } /* Not deleting */
8585 a = a_link[a]; /* Switch to linked-to array */
8587 n2 = a_dim[a]; /* Real array */
8588 for (i = 0; i <= n2; i++) { /* First delete its elements */
8594 free((char *)a_ptr[a]); /* Then the element list */
8595 if (n == 0) { /* If undeclaring this array... */
8596 for (i = 0; i < 122 - ARRAYBASE; i++) { /* Any linked arrays? */
8597 if (i != a && a_link[i] == a) { /* Find them */
8598 a_ptr[i] = (char **) NULL; /* and remove them */
8604 a_ptr[a] = (char **) NULL; /* Remove pointer to element list */
8605 a_dim[a] = 0; /* Set dimension at zero. */
8606 a_link[a] = -1; /* Unset link word */
8608 if (n < 0) /* If only undeclaring, */
8609 return(0); /* we're done. */
8610 p = (char **) malloc((n+1) * sizeof(char **)); /* Allocate for new array */
8611 if (p == NULL) return(-1); /* Check */
8612 a_ptr[a] = p; /* Save pointer to member list */
8613 a_dim[a] = n; /* Save dimension */
8614 for (i = 0; i <= n; i++) /* Initialize members to null */
8616 for (i = 0; i < (int) 'z' - ARRAYBASE; i++) { /* Any linked arrays? */
8617 if (i != a && a_link[i] == a) { /* Find and update them */
8625 /* X A R R A Y -- Convert array name to array index */
8628 xarray(s) char * s; {
8634 debug(F110,"xarray",s,0);
8642 buf[3] = (x > 0) ? s[1] : NUL;
8643 buf[4] = (x > 1) ? s[2] : NUL;
8644 buf[5] = (x > 2) ? s[3] : NUL;
8646 debug(F110,"xarray buf[3]",&buf[3],0);
8651 } else if (*s != CMDQ) {
8656 debug(F110,"xarray s",s,0);
8662 x = (int)c - ARRAYBASE;
8668 if (x > ('z' - ARRAYBASE)) {
8669 debug(F101,"xarray x out of range","",x);
8673 debug(F110,"xarray syntax",s,0);
8680 boundspair() -- parses blah[n:m]
8682 For use with array segment specifiers and compact substring notation.
8683 Ignores the "blah" part, gets the values of n and m, which can be
8684 numbers, variables, or arithmetic expressions; anything that resolves
8689 sep - array of permissible bounds separator chars
8690 lo - pointer to low-bound result (or -1)
8691 hi - pointer to hi-bound result (or -1)
8692 zz - pointer to separator char that was encountered (or NUL)
8700 boundspair(char *s, char *sep, int *lo, int *hi, char *zz)
8702 boundspair(s,sep,lo,hi,zz) char *s, *sep, *zz; int *lo, *hi;
8703 #endif /* CK_ANSIC */
8705 int i, x, y, range[2], bc = 0;
8706 char c = NUL, *s2 = NULL, buf[256], *p, *q, *r, *e[2], *tmp = NULL;
8708 debug(F110,"boundspair s",s,0);
8709 debug(F110,"boundspair sep",sep,0);
8711 *lo = -1; /* Default bounds */
8713 *zz = 0; /* Default bounds separator */
8715 range[0] = -1; /* It's OK -- get contents */
8716 range[1] = -1; /* of subscript brackets */
8720 makestr(&tmp,s); /* Make a pokeable copy */
8724 for (p = s; *p; p++) { /* Get the two elements */
8727 if (bc == 1 && !q) q = p+1;
8728 } else if (*p == ']') {
8730 if (bc == 0 && q) *p = NUL;
8731 } else if (bc == 1) { /* Check for separator */
8732 s2 = ckstrchr(sep,*p);
8734 debug(F000,"boundspair *s2","",*s2);
8736 debug(F000,"boundspair","Too many separators",*s2);
8746 if (bc == 0 && !q) {
8747 /* This allows such constructions as "show array a" */
8748 debug(F110,"boundspair","no brackets",0);
8752 if (bc != 0 || !q) {
8753 debug(F110,"boundspair","unbalanced or missing brackets",0);
8763 debug(F000,"boundspair c","",c);
8764 debug(F110,"boundspair q",q,0);
8765 debug(F110,"boundspair r",r,0);
8767 for (i = 0; i < 2 && e[i]; i++) {
8768 y = 255; /* Expand variables, etc. */
8770 zzstring(e[i],&s,&y);
8771 s = evalx(buf); /* Evaluate it arithmetically */
8773 ckstrncpy(buf,s,256);
8774 if (!chknum(buf)) { /* Did we get a number? */
8775 debug(F110,"boundspair element not numeric",buf,0);
8776 makestr(&tmp,NULL); /* No, fail. */
8779 range[i] = atoi(buf);
8781 makestr(&tmp,NULL); /* Free temporary poked string */
8782 *lo = range[0]; /* Return what we got */
8785 debug(F101,"boundspair lo","",*lo);
8786 debug(F101,"boundspair hi","",*hi);
8790 /* A R R A Y B O U N D S -- Parse array segment notation \&a[n:m] */
8793 Call with s = array reference, plus two pointers to ints.
8794 Returns -1 on error, or array index, with the two ints set as follows:
8798 The array need not be declared -- this routine is just for parsing.
8801 arraybounds(s,lo,hi) char * s; int * lo, * hi; {
8802 int i, x, y, range[2];
8803 char zz, buf[256], * p, * q;
8806 *lo = -1; /* Default bounds */
8809 if (!s) s = ""; /* Defense de null args */
8813 x = xarray(s); /* Check basic structure */
8814 debug(F111,"arraybounds xarray",s,x);
8815 if (x < 0) /* Not OK, fail. */
8817 y = boundspair(s,":",lo,hi,&zz);
8818 debug(F111,"arraybounds boundspair",s,y);
8819 debug(F101,"arraybounds lo","",*lo);
8820 debug(F101,"arraybounds hi","",*hi);
8821 if (y < 0) /* Get bounds */
8826 /* A R R A Y N A M -- Parse an array name */
8829 Call with pointer to string that starts with the array reference.
8830 String may begin with either \& or just &.
8832 Returns letter ID (always lowercase) in argument c,
8833 which can also be accent grave (` = 96; '@' is converted to grave);
8834 Dimension or subscript in argument n;
8835 IMPORTANT: These arguments must be provided by the caller as addresses
8836 of ints (not chars), for example:
8839 On failure, returns a negative number, with args n and c set to zero.
8842 arraynam(ss,c,n) char *ss; int *c; int *n; {
8845 char *s, *p, *sx, *vnp;
8846 /* On stack to allow for recursive calls... */
8847 char vnbuf[ARRAYREFLEN+1]; /* Entire array reference */
8848 char ssbuf[ARRAYREFLEN+1]; /* Subscript in "plain text" */
8849 char sxbuf[16]; /* Evaluated subscript */
8851 *c = *n = 0; /* Initialize return values */
8853 for (pp = 0,i = 0; i < len; i++) { /* Check length */
8856 } else if (ss[i] == ']') {
8861 if (i > ARRAYREFLEN) {
8862 printf("?Array reference too long - %s\n",ss);
8865 ckstrncpy(vnbuf,ss,ARRAYREFLEN);
8867 if (vnbuf[0] == CMDQ && vnbuf[1] == '&') vnp++;
8869 printf("?Not an array - %s\n",vnbuf);
8872 x = *(vnp + 1); /* Fold case of array name */
8874 /* We don't use isupper & tolower here on purpose because these */
8875 /* would produce undesired effects with accented letters. */
8876 if (x > 63 && x < 91) x = *(vnp + 1) = (char) (x + 32);
8877 if ((x < ARRAYBASE) || (x > 122) || (*(vnp+2) != '[')) {
8879 printf("?Invalid format for array name - %s\n",vnbuf);
8884 *c = x; /* Return the array name */
8885 s = vnp+3; /* Get dimension */
8887 pp = 1; /* Bracket counter */
8888 for (i = 0; i < ARRAYREFLEN && *s != NUL; i++) { /* Copy up to ] */
8889 if (*s == '[') pp++;
8890 if (*s == ']' && --pp == 0) break;
8894 printf("?No closing bracket on array dimension - %s\n",vnbuf);
8897 p--; /* Trim whitespace from end */
8898 while (*p == SP || *p == HT)
8901 *p = NUL; /* Terminate subscript with null */
8902 p = ssbuf; /* Point to beginning of subscript */
8903 while (*p == SP || *p == HT) /* Trim whitespace from beginning */
8905 sx = sxbuf; /* Where to put expanded subscript */
8908 /* Even if VARIABLE-EVALUATION SIMPLE use RECURSIVE for subscripts */
8909 /* NOTE: This is vulnerable to SIGINT and whatnot... */
8910 int tmp = vareval; /* Save VARIABLE-EVALUATION setting */
8911 vareval = 1; /* Force it to RECURSIVE */
8912 zzstring(p,&sx,&y); /* Convert variables, etc. */
8913 vareval = tmp; /* Restore VARIABLE-EVALUATION */
8916 while (*sx == SP) sx++;
8917 /* debug(F110,"arraynam sx","",sx); */
8918 if (!*sx) { /* Empty brackets... */
8919 *n = -17; /* (Secret code :-) */
8922 p = evala(sx); /* Run it thru \fneval()... */
8923 if (p) if (*p) ckstrncpy(sxbuf,p,16); /* We know it has to be a number. */
8925 if (!chknum(sxbuf)) { /* Make sure it's all digits */
8927 printf("?Array dimension or subscript missing or not numeric\n");
8932 if ((y = atoi(sxbuf)) < 0) {
8933 if (cmflgs == 0) printf("\n");
8935 printf("?Array dimension or subscript not positive or zero\n");
8940 *n = y; /* Return the subscript or dimension */
8944 /* chkarray returns 0 or greater if array exists, negative otherwise */
8947 chkarray(a,i) int a, i; { /* Check if array is declared */
8948 int x; /* and if subscript is in range */
8949 if (a == 64) a = 96; /* Convert atsign to grave accent */
8950 x = a - ARRAYBASE; /* Values must be in range 95-122 */
8952 if (x == 0 && maclvl < 0) /* Macro arg vector but no macro */
8954 #endif /* COMMENT */
8955 if (x < 0 || x > 'z' - ARRAYBASE) /* Not in range */
8957 if (a_ptr[x] == NULL) return(-1); /* Not declared */
8958 if (i > a_dim[x]) return(-2); /* Declared but out of range. */
8959 return(a_dim[x]); /* All ok, return dimension */
8962 #ifdef COMMENT /* This isn't used. */
8964 arrayval(a,i) int a, i; { /* Return value of \&a[i] */
8965 int x; char **p; /* (possibly NULL) */
8966 if (a == 64) a = 96; /* Convert atsign to grave accent */
8967 x = a - ARRAYBASE; /* Values must be in range 95-122 */
8968 if (x < 0 || x > 27) return(NULL); /* Not in range */
8969 if ((x > 0) && (p = a_ptr[x]) == NULL) /* Array not declared */
8971 if (i > a_dim[x]) /* Subscript out of range. */
8973 return(p[i]); /* All ok, return pointer to value. */
8975 #endif /* COMMENT */
8978 pusharray() is called when an array name is included in a LOCAL statement.
8979 It moves the pointers from the global definition to the stack, and removes
8980 the global definition. Later, if the same array is declared in the local
8981 context, it occupies the global definition in the normal way. But when
8982 popclvl() is called, it replaces the global definition with the one saved
8983 here. The "secret code" is used to indicate to popclv() that it should
8984 remove the global array when popping through this level -- otherwise if a
8985 local array were declared that had no counterpart at any higher level, it
8986 would never be deleted. This allows Algol-like inheritance to work both
8987 on the way down and on the way back up.
8990 pusharray(x,z) int x, z; {
8992 debug(F000,"pusharray x","",x);
8993 debug(F101,"pusharray z","",z);
8995 debug(F101,"pusharray y","",y);
8996 x -= ARRAYBASE; /* Convert name letter to index. */
8997 if (x < 0 || x > 27)
9000 aa_ptr[cmdlvl][x] = (char **) NULL;
9001 aa_dim[cmdlvl][x] = -23; /* Secret code (see popclvl()) */
9003 aa_ptr[cmdlvl][x] = a_ptr[x];
9004 aa_dim[cmdlvl][x] = y;
9006 a_ptr[x] = (char **) NULL;
9011 /* P A R S E V A R -- Parse a variable name or array reference. */
9014 s = pointer to candidate variable name or array reference.
9015 *c = address of integer in which to return variable ID.
9016 *i = address of integer in which to return array subscript.
9018 -2: syntax error in variable name or array reference.
9019 1: successful parse of a simple variable, with ID in c.
9020 2: successful parse of an array reference, w/ID in c and subscript in i.
9023 parsevar(s,c,i) char *s; int *c, *i; {
9028 if (*s == CMDQ) s++; /* Point after backslash */
9030 if (*s != '%' && *s != '&') { /* Make sure it's % or & */
9031 printf("?Not a variable name - %s\n",p);
9034 if ((int)strlen(s) < 2) {
9035 printf("?Incomplete variable name - %s\n",p);
9038 if (*s == '%' && *(s+2) != '\0') {
9039 printf("?Only one character after '%%' in variable name, please\n");
9042 if (*s == '&' && *(s+2) != '[') {
9043 printf("?Array subscript expected - %s\n",p);
9046 if (*s == '%') { /* Simple variable. */
9047 y = *(s+1); /* Get variable ID letter/char */
9048 if (isupper(y)) y -= ('a'-'A'); /* Convert upper to lower case */
9049 *c = y; /* Set the return values. */
9050 *i = -1; /* No array subscript. */
9051 return(1); /* Return 1 = simple variable */
9053 if (*s == '&') { /* Array reference. */
9054 y = arraynam(s,&x,&z); /* Go parse it. */
9055 debug(F101,"parsevar arraynam","",y);
9058 return(pusharray(x,z));
9060 printf("?Invalid array reference - %s\n",p);
9063 if (chkarray(x,z) < 0) { /* Check if declared, etc. */
9064 printf("?Array not declared or subscript out of range\n");
9067 *c = x; /* Return array letter */
9068 *i = z; /* and subscript. */
9071 return(-2); /* None of the above. */
9077 /* Get the numeric value of a variable */
9079 Call with pointer to variable name, pointer to int for return value.
9081 0 on success with second arg containing the value.
9082 -1 on failure (bad variable syntax, variable not defined or not numeric).
9085 varval(s,v) char *s; CK_OFF_T *v; {
9086 char valbuf[VALN+1]; /* s is pointer to variable name */
9091 if (*s != CMDQ) { /* Handle macro names too */
9092 ckmakmsg(name,256,"\\m(",s,")",NULL);
9095 p = valbuf; /* Expand variable into valbuf. */
9097 if (zzstring(s,&p,&y) < 0) return(-1);
9098 p = valbuf; /* Make sure value is numeric */
9099 if (!*p) { /* Be nice -- let an undefined */
9100 valbuf[0] = '0'; /* variable be treated as 0. */
9103 if (chknum(p)) { /* Convert numeric string to int */
9104 *v = ckatofs(p); /* OK */
9105 } else { /* Not OK */
9106 p = evala(p); /* Maybe it's an expression */
9107 if (!chknum(p)) /* Did it evaluate? */
9108 return(-1); /* No, failure. */
9110 *v = ckatofs(p); /* success */
9115 /* Increment or decrement a variable */
9116 /* Returns -1 on failure, 0 on success */
9119 incvar(s,x,z) char *s; CK_OFF_T x; int z; { /* Increment a numeric variable */
9120 CK_OFF_T n; /* s is pointer to variable name */
9121 /* x is amount to increment by */
9122 /* z != 0 means add */
9123 /* z = 0 means subtract */
9124 if (varval(s,&n) < 0) /* Convert numeric string to int */
9126 if (z) /* Increment it by the given amount */
9128 else /* or decrement as requested. */
9130 addmac(s,ckfstoa(n)); /* Replace old variable */
9134 /* D O D O -- Do a macro */
9137 Call with x = macro table index, s = pointer to arguments.
9138 Returns 0 on failure, 1 on success.
9142 dodo(x,s,flags) int x; char *s; int flags; {
9144 extern int tra_asg, tra_cmd; int tra_tmp;
9148 int term_io_sav = term_io;
9150 #endif /* NOLOCAL */
9152 if (x < 0) /* It can happen! */
9157 if (++maclvl >= MACLEVEL) { /* Make sure we have storage */
9158 debug(F101,"dodo maclvl too deep","",maclvl);
9160 printf("Macros nested too deeply\n");
9163 macp[maclvl] = mactab[x].mval; /* Point to the macro body */
9164 macx[maclvl] = mactab[x].mval; /* Remember where the beginning is */
9167 makestr(&(m_line[maclvl]),s); /* Entire arg string for "\%*" */
9168 #endif /* COMMENT */
9170 cmdlvl++; /* Entering a new command level */
9171 if (cmdlvl >= CMDSTKL) { /* Too many macros + TAKE files? */
9172 debug(F101,"dodo cmdlvl too deep","",cmdlvl);
9174 printf("?TAKE files and DO commands nested too deeply\n");
9179 debug(F111,"CMD +M",mactab[x].kwd,cmdlvl);
9180 debug(F010,"CMD ->",s,0);
9185 conres(); /* So Ctrl-C, etc, will work. */
9189 term_io = 0; /* Disable terminal emulator I/O */
9191 #endif /* NOLOCAL */
9194 count[cmdlvl] = count[cmdlvl-1]; /* Inherit COUNT from previous level */
9195 intime[cmdlvl] = intime[cmdlvl-1]; /* Inherit previous INPUT TIMEOUT */
9196 inpcas[cmdlvl] = inpcas[cmdlvl-1]; /* and INPUT CASE */
9197 takerr[cmdlvl] = takerr[cmdlvl-1]; /* and TAKE ERROR */
9198 merror[cmdlvl] = merror[cmdlvl-1]; /* and MACRO ERROR */
9199 xquiet[cmdlvl] = quiet;
9200 xvarev[cmdlvl] = vareval;
9202 cmdstk[cmdlvl].src = CMD_MD; /* Say we're in a macro */
9203 cmdstk[cmdlvl].lvl = maclvl; /* and remember the macro level */
9204 cmdstk[cmdlvl].ccflgs = flags & ~CF_IMAC; /* Set flags */
9206 /* Initialize return value except in FOR, WHILE, IF, and SWITCH macros */
9208 if (!(flags & CF_IMAC) && mrval[maclvl]) {
9209 free(mrval[maclvl]);
9210 mrval[maclvl] = NULL;
9213 /* Clear old %0..%9 arguments */
9215 addmac("%0",mactab[x].kwd); /* Define %0 = name of macro */
9216 makestr(&(m_xarg[maclvl][0]),mactab[x].kwd);
9220 for (y = 1; y < 10; y++) { /* Clear args %1..%9 */
9221 if (m_arg[maclvl][y]) { /* Don't call delmac() unless */
9222 varnam[1] = (char) (y + '0'); /* we have to... */
9228 /* Assign the new args one word per arg, allowing braces to group words */
9230 xwords(s,MAXARGLIST,NULL,0);
9234 term_io = term_io_sav;
9236 #endif /* NOLOCAL */
9238 printf("[%d] +M: \"%s\"\n",cmdlvl,mactab[x].kwd);
9242 /* Insert "literal" quote around each comma-separated command to prevent */
9243 /* its premature expansion. Only do this if object command is surrounded */
9246 static char* flit = "\\flit(";
9249 litcmd(src,dest,n) char **src, **dest; int n; {
9251 char c, *s, *lp, *ss;
9256 debug(F010,"litcmd",s,0);
9258 while (*s == SP) s++; /* Strip extra leading spaces */
9260 if (*s == '{') { /* Starts with brace */
9261 pp = 0; /* Paren counter */
9262 bc = 1; /* Count leading brace */
9263 *lp++ = *s++; /* Copy it */
9264 if (--n < 1) return(-1); /* Check space */
9265 while (*s == SP) s++; /* Strip interior leading spaces */
9266 ss = flit; /* Point to "\flit(" */
9267 while ((*lp++ = *ss++)) /* Copy it */
9268 if (--n < 1) /* and check space */
9270 lp--; /* Back up over null */
9272 while (*s) { /* Go thru rest of text */
9274 if (c == '{') bc++; /* Count brackets */
9275 if (c == '(') pp++; /* and parens */
9276 if (c == ')') { /* Right parenthesis. */
9277 pp--; /* Count it. */
9278 if (pp < 0) { /* An unbalanced right paren... */
9281 The problem here is that "\{" appears to be a quoted brace and therefore
9282 isn't counted; then the "}" matches an earlier opening brace, causing
9283 (e.g.) truncation of macros by getncm().
9285 if (n < 5) /* Out of space in dest buffer? */
9286 return(-1); /* If so, give up. */
9287 *lp++ = CMDQ; /* Must be quoted to prevent */
9288 *lp++ = '}'; /* premature termination of */
9289 *lp++ = '4'; /* \flit(...) */
9294 /* Here we rely on the fact the \nnn never takes more than 3 digits */
9295 if (n < 4) /* Out of space in dest buffer? */
9296 return(-1); /* If so, give up. */
9297 *lp++ = CMDQ; /* Must be quoted to prevent */
9298 *lp++ = '0'; /* premature termination of */
9299 *lp++ = '4'; /* \flit(...) */
9302 #endif /* COMMENT */
9303 pp++; /* Uncount it. */
9308 if (c == '}') { /* Closing brace. */
9309 if (--bc == 0) { /* Final one? */
9310 *lp++ = ')'; /* Add closing paren for "\flit()" */
9311 if (--n < 1) return(-1);
9313 if (--n < 1) return(-1);
9318 *lp++ = c; /* General case */
9319 if (--n < 1) return(-1);
9323 } else { /* No brackets around, */
9324 while ((*lp++ = *s++)) /* just copy. */
9329 *src = s; /* Return updated source */
9330 *dest = lp; /* and destination pointers */
9331 if (bc) /* Fail if braces unbalanced */
9333 else /* Otherwise succeed. */
9338 /* Functions moved here from ckuusr.c to even out the module sizes... */
9341 Breaks up string s -- IN PLACE! -- into a list of up to max words.
9342 Pointers to each word go into the array list[].
9343 max is the maximum number of words (pointers).
9344 If list is NULL, then they are added to the macro table.
9345 flag = 0 means the last field is to be one word, like all the other fields,
9346 so anything after it is discarded.
9347 flag = 1 means the last field extends to the end of the string, even if
9348 there are lots of words left, so the last field contains the
9349 remainder of the string.
9352 xwords(s,max,list,flag) char *s; int max; char *list[]; int flag; {
9354 int b, i, k, q, y, z;
9357 macro = (list == NULL);
9358 debug(F010,"xwords",s,0);
9362 printf("XWORDS string=%s\n",s);
9363 printf("XWORDS max=%d\n",max);
9364 #endif /* XWORDSDEBUG */
9365 p = s; /* Pointer to beginning of string */
9366 q = 0; /* Flag for doublequote removal */
9367 b = 0; /* Flag for outer brace removal */
9368 k = 0; /* Flag for in-word */
9369 y = 0; /* Brace nesting level */
9370 z = 0; /* "Word" counter, 0 thru max */
9373 for (i = 0; i <= max; i++) /* Initialize pointers */
9378 while (1) { /* Go thru word list */
9379 if (!s || (*s == '\0')) { /* No more characters? */
9380 if (k != 0) { /* Was I in a word? */
9381 if (z == max) break; /* Yes, only go up to max. */
9382 z++; /* Count this word. */
9384 printf("1 z++ = %d\n", z);
9385 #endif /* XWORDSDEBUG */
9387 if (macro) { /* Doing macro args */
9389 varnam[1] = (char) (z + '0'); /* Assign last arg */
9397 #endif /* COMMENT */
9398 makestr(&(m_xarg[maclvl][z]),p);
9400 } else { /* Not doing macro args */
9402 list[z] = p; /* Assign pointer. */
9404 printf("[1]LIST[%d]=\"%s\"\n",z,list[z]);
9405 #endif /* XWORDSDEBUG */
9409 break; /* And get out. */
9410 } else break; /* Was not in a word */
9412 if (k == 0 && (*s == SP || *s == HT)) { /* Eat leading blanks */
9415 } else if (q == 0 && *s == '{') { /* An opening brace */
9416 if (k == 0 && y == 0) { /* If leading brace */
9417 p = s+1; /* point past it */
9418 b = 1; /* and flag that we did this */
9420 k = 1; /* Flag that we're in a word */
9421 y++; /* Count the brace. */
9422 } else if (q == 0 && *s == '}') { /* A closing brace. */
9423 y--; /* Count it. */
9424 if (y <= 0 && b != 0) { /* If it matches the leading brace */
9427 if (!c || c == SP || c == HT) { /* at EOL or followed by SP */
9428 *s = SP; /* change it to a space */
9429 b = 0; /* and we're not in braces any more */
9432 #ifdef DOUBLEQUOTING
9433 /* Opening doublequote */
9434 } else if (k == 0 && b == 0 && *s == '"' && dblquo) {
9436 p = s+1; /* point past it */
9437 q = 1; /* and flag that we did this */
9438 k = 1; /* Flag that we're in a word */
9439 /* Closing double quote */
9440 } else if (q > 0 && k > 0 && b == 0 && *s == '"' && dblquo) {
9443 if (!c || c == SP || c == HT) { /* at EOL or followed by SP */
9445 *s = SP; /* change it to a space */
9446 q = 0; /* and we're not in quotes any more */
9448 #endif /* DOUBLEQUOTING */
9450 } else if (*s != SP && *s != HT) { /* Nonspace means we're in a word */
9451 if (k == 0) { /* If we weren't in a word before, */
9452 p = s; /* Mark the beginning */
9453 if (flag && z == max) { /* Want last word to be remainder? */
9456 printf("1 z++ = %d\n", z);
9457 #endif /* XWORDSDEBUG */
9458 list[z] = p; /* Yes, point to it */
9460 printf("[4]LIST[%d]=\"%s\"\n",z,list[z]);
9461 #endif /* XWORDSDEBUG */
9462 break; /* and quit */
9464 k = 1; /* Set in-word flag */
9467 /* If we're not inside a braced quantity, and we are in a word, and */
9468 /* we have hit whitespace, then we have a word. */
9469 if ((y < 1) && (k != 0) && (*s == SP || *s == HT) && !b) {
9470 if (!flag || z < max) /* if we don't want to keep rest */
9471 *s = '\0'; /* terminate the arg with null */
9472 k = 0; /* say we're not in a word any more */
9473 y = 0; /* start braces off clean again */
9474 if (z == max) break; /* Only go up to max. */
9475 z++; /* count this arg */
9477 printf("1 z++ = %d\n", z);
9478 #endif /* XWORDSDEBUG */
9483 varnam[1] = (char) (z + '0'); /* compute its name */
9484 addmac(varnam,p); /* add it to the macro table */
9491 #endif /* COMMENT */
9492 makestr(&(m_xarg[maclvl][z]),p);
9498 printf("[2]LIST[%d]=\"%s\"\n",z,list[z]);
9499 #endif /* XWORDSDEBUG */
9505 s++; /* Point past this character */
9507 if ((z == 0) && (y > 1)) { /* Extra closing brace(s) at end */
9512 varnam[1] = z + '0'; /* compute its name */
9513 addmac(varnam,p); /* Add rest of line to last arg */
9520 #endif /* COMMENT */
9521 makestr(&(m_xarg[maclvl][z]),p);
9527 printf("[3]LIST[%d]=\"%s\"\n",z,list[z]);
9528 #endif /* XWORDSDEBUG */
9534 if (macro) { /* Macro */
9536 a_dim[0] = z; /* Array dimension is one less */
9537 topargc = z + 1; /* than \v(argc) */
9538 debug(F111,"a_dim[0]","D",a_dim[0]);
9540 macargc[maclvl] = z + 1; /* Set \v(argc) variable */
9541 n_xarg[maclvl] = z + 1; /* This is the actual number */
9542 a_ptr[0] = m_xarg[maclvl]; /* Point \&_[] at the args */
9543 a_dim[0] = z; /* And give it this dimension */
9544 debug(F111,"a_dim[0]","E",a_dim[0]);
9553 /* D O S H I F T -- Do the SHIFT Command; shift macro args left by n */
9555 /* Note: at some point let's consolidate m_arg[][] and m_xarg[][]. */
9558 doshift(n) int n; { /* n = shift count */
9560 char /* *s, *m, */ buf[6]; /* Buffer to build scalar names */
9564 debug(F101,"SHIFT count","",n);
9565 debug(F101,"SHIFT topargc","",topargc);
9567 if (n < 1) /* Stay in range */
9568 return(n == 0 ? 1 : 0);
9571 top = (level < 0) ? topargc : macargc[level];
9578 debug(F101,"SHIFT count 2","",n);
9579 debug(F101,"SHIFT level","",level);
9581 debug(F101,"SHIFT macargc[level]","",macargc[level]);
9585 buf[0] = '\\'; /* Initialize name template */
9590 for (i = 1; i <= n; i++) { /* Free shifted-over args */
9592 makestr(&(toparg[i]),NULL);
9594 makestr(&(m_xarg[level][i]),NULL);
9596 if (i < 10) { /* Is this necessary? */
9597 buf[2] = (char)(i+'0');
9601 for (i = 1; i <= top-n; i++) { /* Shift remaining args */
9604 toparg[i] = toparg[i+n]; /* Full vector */
9606 makestr(&(toparg[i]),toparg[i+n]); /* Full vector */
9607 #endif /* COMMENT */
9608 if (i < 10) /* Scalars... */
9609 makestr(&(g_var[i+'0']),toparg[i+n]);
9612 m_xarg[level][i] = m_xarg[level][i+n];
9614 makestr(&(m_xarg[level][i]),m_xarg[level][i+n]);
9615 #endif /* COMMENT */
9617 buf[2] = (char)(i+'0');
9618 debug(F010,"SHIFT buf",buf,0);
9619 addmac(buf,m_xarg[level][i+n]);
9623 for (i = top-n; i <= top; i++) { /* Clear n args from the end */
9628 makestr(&(toparg[i]),NULL);
9629 #endif /* COMMENt */
9631 makestr(&(g_var[i+'0']),NULL);
9634 m_xarg[level][i] = NULL;
9636 makestr(&(m_xarg[level][i]),NULL);
9637 #endif /* COMMENt */
9639 buf[2] = (char)(i+'0');
9644 if (level > -1) { /* Macro args */
9645 macargc[level] -= n; /* Adjust count */
9646 n_xarg[maclvl] = macargc[level]; /* Here too */
9647 a_dim[0] = macargc[level] - 1; /* Adjust array dimension */
9648 debug(F111,"a_dim[0]","F",a_dim[0]);
9649 zzstring("\\fjoin(&_[],{ },1)",&sx,&nx); /* Handle \%* */
9651 makestr(&(m_line[level]),tmpbuf);
9652 #endif /* COMMENT */
9653 } else { /* Ditto for top level */
9655 a_dim[0] = topargc - 1;
9656 debug(F111,"a_dim[0]","G",a_dim[0]);
9657 zzstring("\\fjoin(&_[],{ },1)",&sx,&nx);
9659 makestr(&topline,tmpbuf);
9660 #endif /* COMMENT */
9667 docd(cx) int cx; { /* Do the CD command */
9669 extern int server, srvcdmsg, cdactive;
9670 extern char * cdmsgfile[], * ckcdpath;
9677 #endif /* IKSDCONF */
9681 if ((x = cmcfm()) < 0)
9685 if (!zchdir(prevdir)) {
9689 makestr(&prevdir,s);
9694 #endif /* NOFRILLS */
9704 #endif /* datageneral */
9706 ckstrncpy(line,s,LINBUFSIZ);
9710 if (cx == XXKCD) { /* Symbolic (Kermit) CD */
9713 x = cmkey(kcdtab,nkcdtab,"Symbolic directory name","home",xxstring);
9716 x = lookup(kcdtab,atmbuf,nkcdtab,&k); /* Get complete keyword */
9718 printf("?Lookup error\n"); /* shouldn't happen */
9721 if ((x = cmcfm()) < 0)
9723 if (k == VN_HOME) { /* HOME: allow SET HOME to override */
9724 ckstrncpy(line,homepath(),LINBUFSIZ);
9725 } else { /* Other symbolic name */
9726 /* Convert to variable syntax */
9727 ckmakmsg(tmpbuf,TMPBUFSIZ,"\\v(",kcdtab[k].kwd,")",NULL);
9728 p = line; /* Expand the variable */
9730 zzstring(tmpbuf,&p,&n);
9731 if (!line[0]) { /* Fail if variable not defined */
9732 printf("?%s - not defined\n",tmpbuf);
9733 return(success = 0);
9736 s = line; /* All OK, go try to CD... */
9743 if ((x = cmdir("Name of local directory, or carriage return",
9752 if ((x = cmdirp("Name of PC disk and/or directory,\n\
9753 or press the Enter key for the default",
9756 ckcdpath ? ckcdpath : getenv("CDPATH"),
9763 x = ckstrncpy(temp,homepath(),32);
9764 if (x > 0) if (temp[x-1] != ':') { temp[x] = ':'; temp[x+1] = NUL; }
9765 if ((x = cmtxt("Name of Macintosh volume and/or folder,\n\
9766 or press the Return key for the desktop on the boot disk",
9767 temp,&s, xxstring)) < 0 )
9770 if ((x = cmdirp("Carriage return for home directory,\n\
9771 or name of directory on this computer",
9773 "SYS$LOGIN", /* With no colon */
9775 homepath(), /* In VMS this is "SYS$LOGIN:" */
9778 ckcdpath ? ckcdpath : getenv("CDPATH"),
9785 ckstrncpy(line,s,LINBUFSIZ); /* Make a safe copy */
9788 if (ckmatch("*.DIR;1$",s,0,0))
9789 if (cvtdir(s,tmpbuf,TMPBUFSIZ) > 0)
9792 debug(F110,"docd",s,0);
9794 if ((x = cmcfm()) < 0) /* Get confirmation */
9801 x = strlen(line); /* homdir ends in colon, */
9802 if (x > 1 && line[x-1] == ':') /* and "dir" doesn't like that... */
9804 #endif /* datageneral */
9810 if (*s != ':') { /* If it failed, */
9811 char *p; /* supply leading colon */
9812 int len = (int)strlen(s) + 2;
9813 p = malloc(len); /* and try again... */
9815 strcpy(p,":"); /* safe */
9816 strcat(p,s); /* safe */
9832 printf("?Off limits: \"%s\"\n",s);
9841 makestr(&prevdir,p);
9842 debug(F111,"docd","srvcdmsg",srvcdmsg);
9845 && !(inserver && !iksdcf)
9846 #endif /* IKSDCONF */
9849 for (i = 0; i < 8; i++) {
9850 debug(F111,"docd cdmsgfile[i]",cdmsgfile[i],i);
9851 if (zchki(cdmsgfile[i]) > -1) {
9853 dotype(cdmsgfile[i],xaskmore,0,0,NULL,0,NULL,0,0,NULL,0);
9860 if (!x && srvcdmsg && !server
9862 && !(inserver && !iksdcf)
9863 #endif /* IKSDCONF */
9864 && !quiet && !xcmdsrc)
9865 printf("%s\n", zgtdir());
9870 static int on_ctrlc = 0;
9873 fixcmd() { /* Fix command parser after interruption */
9876 if (nmac) { /* Any macros defined? */
9878 char * s = "on_ctrlc"; /* Name of Ctrl-C handling macro */
9879 k = mlook(mactab,s,nmac); /* Look it up. */
9880 if (k >= 0) { /* If found, */
9881 if (on_ctrlc++ == 0) { /* if not already executing, */
9882 if (dodo(k,"",0) > -1) /* set it up, */
9883 parser(1); /* execute it, */
9885 delmac(s,1); /* and undefine it. */
9889 #endif /* NOONCTRLC */
9891 dostop(); /* Back to top level (also calls conint()). */
9892 bgchk(); /* Check background status */
9893 if (*psave) { /* If old prompt saved, */
9894 cmsetp(psave); /* restore it. */
9897 success = 0; /* Tell parser last command failed */
9900 #ifndef NOSHOW /* SHOW FEATURES */
9902 Note, presently optlist[] index overflow is not checked.
9903 There is plenty of room (less than 360 entries for 1000 slots).
9904 When space starts to get tight, check for noptlist >= NOPTLIST
9905 every time noptlist is incremented.
9907 #define NOPTLIST 1024
9908 static int noptlist = 0;
9909 static char * optlist[NOPTLIST+1];
9910 static int hpos = 0;
9913 prtopt(lines,s) int * lines; char *s; { /* Print an option */
9914 int y, i; /* Does word wrap. */
9917 if (!*s) { /* Empty argument */
9918 if (hpos > 0) { /* means to end this line. */
9919 printf("\n"); /* Not needed if already at */
9920 if (++i > (cmd_rows - 3)) { /* beginning of new line. */
9927 printf("\n"); /* And then make a blank line */
9928 if (++i > (cmd_rows - 3)) {
9938 y = (int)strlen(s) + 1;
9940 debug(F101,"prtopt hpos","",hpos);
9941 debug(F101,"prtopt cmd_cols","",cmd_cols);
9945 hpos > ((cmd_cols > 40) ? (cmd_cols - 1) : 79)
9947 hpos > ((tt_cols > 40) ? (tt_cols - 1) : 79)
9951 if (++i > (cmd_rows - 3)) {
9970 for (i = 0; i < NOPTLIST; i++)
9975 makestr(&(optlist[noptlist++]),"MPW");
9981 makestr(&(optlist[noptlist++]),"THINK_C");
9982 #endif /* THINK_C */
9986 makestr(&(optlist[noptlist++]),"__386__");
9987 #endif /* __386__ */
9989 /* Memory models... */
9992 makestr(&(optlist[noptlist++]),"__FLAT__");
9993 #endif /* __FLAT__ */
9995 makestr(&(optlist[noptlist++]),"__SMALL__");
9996 #endif /* __SMALL__ */
9998 makestr(&(optlist[noptlist++]),"__MEDIUM__");
9999 #endif /* __MEDIUM__ */
10001 makestr(&(optlist[noptlist++]),"__COMPACT__");
10002 #endif /* __COMPACT__ */
10004 makestr(&(optlist[noptlist++]),"__LARGE__");
10005 #endif /* __LARGE__ */
10009 makestr(&(optlist[noptlist++]),"IFDEBUG");
10011 makestr(&(optlist[noptlist++]),"DEBUG");
10012 #endif /* IFDEBUG */
10015 makestr(&(optlist[noptlist++]),"TLOG");
10018 makestr(&(optlist[noptlist++]),"BIGBUFOK");
10019 #endif /* BIGBUFOK */
10021 sprintf(line,"INPBUFSIZ=%d",INPBUFSIZ); /* SAFE */
10022 makestr(&(optlist[noptlist++]),line);
10023 #endif /* INPBUFSIZE */
10025 sprintf(line,"LINBUFSIZ=%d",LINBUFSIZ); /* SAFE */
10026 makestr(&(optlist[noptlist++]),line);
10027 #endif /* LINBUFSIZE */
10029 sprintf(line,"INBUFSIZE=%d",INBUFSIZE); /* SAFE */
10030 makestr(&(optlist[noptlist++]),line);
10031 #endif /* INBUFSIZE */
10033 sprintf(line,"OBUFSIZE=%d",OBUFSIZE); /* SAFE */
10034 makestr(&(optlist[noptlist++]),line);
10035 #endif /* OBUFSIZE */
10037 sprintf(line,"FD_SETSIZE=%d",FD_SETSIZE); /* SAFE */
10038 makestr(&(optlist[noptlist++]),line);
10039 #endif /* FD_SETSIZE */
10041 makestr(&(optlist[noptlist++]),"XFRCAN");
10042 #endif /* XFRCAN */
10044 makestr(&(optlist[noptlist++]),"XPRINT");
10045 #endif /* XPRINT */
10047 makestr(&(optlist[noptlist++]),"PIPESEND");
10048 #endif /* PIPESEND */
10050 makestr(&(optlist[noptlist++]),"CK_SPEED");
10051 #endif /* CK_SPEED */
10053 makestr(&(optlist[noptlist++]),"CK_FAST");
10054 #endif /* CK_FAST */
10056 makestr(&(optlist[noptlist++]),"CK_APC");
10057 #endif /* CK_APC */
10059 makestr(&(optlist[noptlist++]),"CK_AUTODL");
10060 #endif /* CK_AUTODL */
10062 makestr(&(optlist[noptlist++]),"CK_MKDIR");
10063 #endif /* CK_MKDIR */
10065 makestr(&(optlist[noptlist++]),"NOMKDIR");
10066 #endif /* NOMKDIR */
10068 makestr(&(optlist[noptlist++]),"CK_LABELED");
10069 #endif /* CK_LABELED */
10071 makestr(&(optlist[noptlist++]),"NODIAL");
10072 #endif /* NODIAL */
10074 makestr(&(optlist[noptlist++]),"MINIDIAL");
10075 #endif /* MINIDIAL */
10077 makestr(&(optlist[noptlist++]),"WHATAMI");
10078 #endif /* WHATAMI */
10080 makestr(&(optlist[noptlist++]),"DYNAMIC");
10081 #endif /* DYNAMIC */
10083 sprintf(line,"CMDDEP=%d",CMDDEP); /* SAFE */
10084 makestr(&(optlist[noptlist++]),line);
10088 sprintf(line,"MAXPATHLEN=%d",MAXPATHLEN); /* SAFE */
10089 makestr(&(optlist[noptlist++]),line);
10090 #endif /* MAXPATHLEN */
10093 sprintf(line,"DEVNAMLEN=%d",DEVNAMLEN); /* SAFE */
10094 makestr(&(optlist[noptlist++]),line);
10095 #endif /* DEVNAMLEN */
10098 makestr(&(optlist[noptlist++]),"NO_PARAM_H");
10099 #endif /* NO_PARAM_H */
10101 #ifdef INCL_PARAM_H
10102 makestr(&(optlist[noptlist++]),"INCL_PARAM_H");
10103 #endif /* INCL_PARAM_H */
10105 sprintf(line,"CKMAXPATH=%d",CKMAXPATH); /* SAFE */
10106 makestr(&(optlist[noptlist++]),line);
10108 sprintf(line,"CKMAXOPEN=%d",CKMAXOPEN); /* SAFE */
10109 makestr(&(optlist[noptlist++]),line);
10111 sprintf(line,"Z_MAXCHAN=%d",Z_MAXCHAN); /* SAFE */
10112 makestr(&(optlist[noptlist++]),line);
10115 sprintf(line,"OPEN_MAX=%d",OPEN_MAX); /* SAFE */
10116 makestr(&(optlist[noptlist++]),line);
10117 #endif /* OPEN_MAX */
10119 #ifdef _POSIX_OPEN_MAX
10120 sprintf(line,"_POSIX_OPEN_MAX=%d",_POSIX_OPEN_MAX); /* SAFE */
10121 makestr(&(optlist[noptlist++]),line);
10122 #endif /* _POSIX_OPEN_MAX */
10126 extern int z_maxchan;
10128 extern int ckmaxfiles;
10129 sprintf(line,"ckmaxfiles=%d",ckmaxfiles); /* SAFE */
10130 makestr(&(optlist[noptlist++]),line);
10132 sprintf(line,"z_maxchan=%d",z_maxchan); /* SAFE */
10133 makestr(&(optlist[noptlist++]),line);
10135 #endif /* CKCHANNELIO */
10138 sprintf(line,"FOPEN_MAX=%d",FOPEN_MAX); /* SAFE */
10139 makestr(&(optlist[noptlist++]),line);
10140 #endif /* FOPEN_MAX */
10143 sprintf(line,"MAXGETPATH=%d",MAXGETPATH); /* SAFE */
10144 makestr(&(optlist[noptlist++]),line);
10145 #endif /* MAXGETPATH */
10148 sprintf(line,"CMDBL=%d",CMDBL); /* SAFE */
10149 makestr(&(optlist[noptlist++]),line);
10153 sprintf(line,"VNAML=%d",VNAML); /* SAFE */
10154 makestr(&(optlist[noptlist++]),line);
10158 sprintf(line,"ARRAYREFLEN=%d",ARRAYREFLEN); /* SAFE */
10159 makestr(&(optlist[noptlist++]),line);
10160 #endif /* ARRAYREFLEN */
10163 sprintf(line,"UIDBUFLEN=%d",UIDBUFLEN); /* SAFE */
10164 makestr(&(optlist[noptlist++]),line);
10165 #endif /* UIDBUFLEN */
10168 sprintf(line,"FORDEPTH=%d",FORDEPTH); /* SAFE */
10169 makestr(&(optlist[noptlist++]),line);
10170 #endif /* FORDEPTH */
10173 sprintf(line,"MAXTAKE=%d",MAXTAKE); /* SAFE */
10174 makestr(&(optlist[noptlist++]),line);
10175 #endif /* MAXTAKE */
10178 sprintf(line,"MACLEVEL=%d",MACLEVEL); /* SAFE */
10179 makestr(&(optlist[noptlist++]),line);
10180 #endif /* MACLEVEL */
10183 sprintf(line,"MAC_MAX=%d",MAC_MAX); /* SAFE */
10184 makestr(&(optlist[noptlist++]),line);
10185 #endif /* MAC_MAX */
10187 #ifdef _LARGEFILE_SOURCE
10188 makestr(&(optlist[noptlist++]),"_LARGEFILE_SOURCE");
10189 #endif /* _LARGEFILE_SOURCE */
10191 #ifdef _FILE_OFFSET_BITS
10192 sprintf(line,"_FILE_OFFSET_BITS=%d",_FILE_OFFSET_BITS); /* SAFE */
10193 makestr(&(optlist[noptlist++]),line);
10194 #endif /* _FILE_OFFSET_BITS */
10196 #ifdef __USE_FILE_OFFSET64
10197 makestr(&(optlist[noptlist++]),"__USE_FILE_OFFSET64");
10198 #endif /* __USE_FILE_OFFSET64 */
10200 #ifdef __USE_LARGEFILE64
10201 makestr(&(optlist[noptlist++]),"__USE_LARGEFILE64");
10202 #endif /* __USE_LARGEFILE64 */
10206 sprintf(line,"CHAR_MAX=%llx",CHAR_MAX); /* SAFE */
10207 makestr(&(optlist[noptlist++]),line);
10208 #endif /* CHAR_MAX */
10210 sprintf(line,"UCHAR_MAX=%llx",UCHAR_MAX); /* SAFE */
10211 makestr(&(optlist[noptlist++]),line);
10212 #endif /* UCHAR_MAX */
10214 sprintf(line,"SHRT_MAX=%llx",SHRT_MAX); /* SAFE */
10215 makestr(&(optlist[noptlist++]),line);
10216 #endif /* SHRT_MAX */
10218 sprintf(line,"USHRT_MAX=%llx",USHRT_MAX); /* SAFE */
10219 makestr(&(optlist[noptlist++]),line);
10220 #endif /* USHRT_MAX */
10222 sprintf(line,"INT_MAX=%llx",INT_MAX); /* SAFE */
10223 makestr(&(optlist[noptlist++]),line);
10224 #endif /* INT_MAX */
10226 sprintf(line,"UINT_MAX=%llx",UINT_MAX); /* SAFE */
10227 makestr(&(optlist[noptlist++]),line);
10228 #endif /* UINT_MAX */
10230 sprintf(line,"MAX_LONG=%llx",MAX_LONG); /* SAFE */
10231 makestr(&(optlist[noptlist++]),line);
10232 #endif /* MAX_LONG */
10234 sprintf(line,"LONG_MAX=%llx",LONG_MAX); /* SAFE */
10235 makestr(&(optlist[noptlist++]),line);
10236 #endif /* LONG_MAX */
10238 sprintf(line,"ULONG_MAX=%llx",ULONG_MAX); /* SAFE */
10239 makestr(&(optlist[noptlist++]),line);
10240 #endif /* ULONG_MAX */
10242 sprintf(line,"MAXINT=%llx",MAXINT); /* SAFE */
10243 makestr(&(optlist[noptlist++]),line);
10244 #endif /* MAXINT */
10246 sprintf(line,"MAXLONG=%llx",MAXLONG); /* SAFE */
10247 makestr(&(optlist[noptlist++]),line);
10248 #endif /* MAXLONG */
10251 sprintf(line,"LLONG_MAX=%I64x",LLONG_MAX); /* SAFE */
10252 makestr(&(optlist[noptlist++]),line);
10253 #endif /* LLONG_MAX */
10255 sprintf(line,"ULLONG_MAX=%I64x",ULLONG_MAX); /* SAFE */
10256 makestr(&(optlist[noptlist++]),line);
10257 #endif /* ULLONG_MAX */
10259 sprintf(line,"MAXLONGLONG=%I64x",MAXLONGLONG); /* SAFE */
10260 makestr(&(optlist[noptlist++]),line);
10261 #endif /* MAXLONGLONG */
10264 sprintf(line,"LLONG_MAX=%llx",LLONG_MAX); /* SAFE */
10265 makestr(&(optlist[noptlist++]),line);
10266 #endif /* LLONG_MAX */
10268 sprintf(line,"ULLONG_MAX=%llx",ULLONG_MAX); /* SAFE */
10269 makestr(&(optlist[noptlist++]),line);
10270 #endif /* ULLONG_MAX */
10272 sprintf(line,"MAXLONGLONG=%llx",MAXLONGLONG); /* SAFE */
10273 makestr(&(optlist[noptlist++]),line);
10274 #endif /* MAXLONGLONG */
10276 #ifdef _INTEGRAL_MAX_BITS
10277 sprintf(line,"_INTEGRAL_MAX_BITS=%d",_INTEGRAL_MAX_BITS); /* SAFE */
10278 makestr(&(optlist[noptlist++]),line);
10279 #endif /* _INTEGRAL_MAX_BITS */
10280 #endif /* COMMENT */
10283 sprintf(line,"MINPUTMAX=%d",MINPUTMAX); /* SAFE */
10284 makestr(&(optlist[noptlist++]),line);
10285 #endif /* MINPUTMAX */
10288 sprintf(line,"MAXWLD=%d",MAXWLD); /* SAFE */
10289 makestr(&(optlist[noptlist++]),line);
10292 makestr(&(optlist[noptlist++]),"MAXWLD=unlimited");
10294 #endif /* MAXWLD */
10297 sprintf(line,"MSENDMAX=%d",MSENDMAX); /* SAFE */
10298 makestr(&(optlist[noptlist++]),line);
10299 #endif /* MSENDMAX */
10302 sprintf(line,"MAXDDIR=%d",MAXDDIR); /* SAFE */
10303 makestr(&(optlist[noptlist++]),line);
10304 #endif /* MAXDDIR */
10307 sprintf(line,"MAXDNUMS=%d",MAXDNUMS); /* SAFE */
10308 makestr(&(optlist[noptlist++]),line);
10309 #endif /* MAXDNUMS */
10312 makestr(&(optlist[noptlist++]),"UNIX");
10316 makestr(&(optlist[noptlist++]),"VMS");
10318 sprintf(line,"__VMS_VER=%d",__VMS_VER); /* SAFE */
10319 makestr(&(optlist[noptlist++]),line);
10320 #endif /* __VMS_VER */
10322 makestr(&(optlist[noptlist++]),"VMSV70");
10323 #endif /* VMSV70 */
10325 makestr(&(optlist[noptlist++]),"OLD_VMS");
10326 #endif /* OLD_VMS */
10328 makestr(&(optlist[noptlist++]),"vms");
10331 makestr(&(optlist[noptlist++]),"VMSV60");
10332 #endif /* VMSV60 */
10334 makestr(&(optlist[noptlist++]),"VMSV80");
10335 #endif /* VMSV80 */
10337 makestr(&(optlist[noptlist++]),"VMSSHARE");
10338 #endif /* VMSSHARE */
10340 makestr(&(optlist[noptlist++]),"NOVMSSHARE");
10341 #endif /* NOVMSSHARE */
10345 makestr(&(optlist[noptlist++]),"datageneral");
10346 #endif /* datageneral */
10348 makestr(&(optlist[noptlist++]),"apollo");
10349 #endif /* apollo */
10351 makestr(&(optlist[noptlist++]),"aegis");
10354 makestr(&(optlist[noptlist++]),"A986");
10357 makestr(&(optlist[noptlist++]),"AMIGA");
10360 makestr(&(optlist[noptlist++]),"CONVEX9");
10361 #endif /* CONVEX9 */
10363 makestr(&(optlist[noptlist++]),"CONVEX10");
10364 #endif /* CONVEX9 */
10366 makestr(&(optlist[noptlist++]),"MAC");
10369 makestr(&(optlist[noptlist++]),"AUX");
10373 makestr(&(optlist[noptlist++]),"OS2");
10375 makestr(&(optlist[noptlist++]),"NT");
10380 makestr(&(optlist[noptlist++]),"OS9");
10384 makestr(&(optlist[noptlist++]),"MSDOS");
10388 makestr(&(optlist[noptlist++]),"DIRENT");
10389 #endif /* DIRENT */
10392 makestr(&(optlist[noptlist++]),"SDIRENT");
10393 #endif /* SDIRENT */
10396 makestr(&(optlist[noptlist++]),"NDIR");
10400 makestr(&(optlist[noptlist++]),"XNDIR");
10404 makestr(&(optlist[noptlist++]),"SAVEDUID");
10405 #endif /* SAVEDUID */
10408 makestr(&(optlist[noptlist++]),"RENAME");
10409 #endif /* RENAME */
10412 makestr(&(optlist[noptlist++]),"CK_TMPDIR");
10413 #endif /* CK_TMPDIR */
10416 makestr(&(optlist[noptlist++]),"NOCCTRAP");
10417 #endif /* NOCCTRAP */
10420 makestr(&(optlist[noptlist++]),"NOCOTFMC");
10421 #endif /* NOCOTFMC */
10424 makestr(&(optlist[noptlist++]),"NOFRILLS");
10425 #endif /* NOFRILLS */
10428 makestr(&(optlist[noptlist++]),"PARSENSE");
10429 #endif /* PARSENSE */
10432 makestr(&(optlist[noptlist++]),"TIMEH");
10436 makestr(&(optlist[noptlist++]),"TIMEH");
10437 #endif /* NOTIMEH */
10440 makestr(&(optlist[noptlist++]),"SYSTIMEH");
10441 #endif /* SYSTIMEH */
10444 makestr(&(optlist[noptlist++]),"SYSTIMEH");
10445 #endif /* NOSYSTIMEH */
10448 makestr(&(optlist[noptlist++]),"SYSTIMEBH");
10449 #endif /* SYSTIMEBH */
10452 makestr(&(optlist[noptlist++]),"SYSTIMEBH");
10453 #endif /* NOSYSTIMEBH */
10456 makestr(&(optlist[noptlist++]),"UTIMEH");
10457 #endif /* UTIMEH */
10460 makestr(&(optlist[noptlist++]),"SYSUTIMEH");
10461 #endif /* SYSUTIMEH */
10464 makestr(&(optlist[noptlist++]),"CK_NEED_SIG");
10465 #endif /* CK_NEED_SIG */
10468 makestr(&(optlist[noptlist++]),"CK_TTYFD");
10469 #endif /* CK_TTYFD */
10472 makestr(&(optlist[noptlist++]),"NETCONN");
10473 #endif /* NETCONN */
10476 makestr(&(optlist[noptlist++]),"TCPSOCKET");
10478 makestr(&(optlist[noptlist++]),"NOTCPOPTS");
10479 #endif /* NOTCPOPTS */
10481 makestr(&(optlist[noptlist++]),"CK_DNS_SRV");
10482 #endif /* CK_DNS_SRV */
10484 makestr(&(optlist[noptlist++]),"NO_DNS_SRV");
10485 #endif /* NO_DNS_SRV */
10487 makestr(&(optlist[noptlist++]),"CKGHNLHOST");
10488 #endif /* CKGHNLHOST */
10490 makestr(&(optlist[noptlist++]),"NOLISTEN");
10491 #endif /* NOLISTEN */
10493 makestr(&(optlist[noptlist++]),"SOL_SOCKET");
10494 #endif /* SOL_SOCKET */
10495 #ifdef SO_OOBINLINE
10496 makestr(&(optlist[noptlist++]),"SO_OOBINLINE");
10497 #endif /* SO_OOBINLNE */
10498 #ifdef SO_DONTROUTE
10499 makestr(&(optlist[noptlist++]),"SO_DONTROUTE");
10500 #endif /* SO_DONTROUTE */
10501 #ifdef SO_KEEPALIVE
10502 makestr(&(optlist[noptlist++]),"SO_KEEPALIVE");
10503 #endif /* SO_KEEPALIVE */
10505 makestr(&(optlist[noptlist++]),"SO_LINGER");
10506 #endif /* SO_LINGER */
10508 makestr(&(optlist[noptlist++]),"TCP_NODELAY");
10509 #endif /* TCP_NODELAY */
10511 makestr(&(optlist[noptlist++]),"SO_SNDBUF");
10512 #endif /* SO_SNDBUF */
10514 makestr(&(optlist[noptlist++]),"SO_RCVBUF");
10515 #endif /* SO_RCVBUF */
10517 makestr(&(optlist[noptlist++]),"h_addr");
10518 #endif /* h_addr */
10520 makestr(&(optlist[noptlist++]),"HADDRLIST");
10521 #endif /* HADDRLIST */
10523 makestr(&(optlist[noptlist++]),"CK_SOCKS");
10525 makestr(&(optlist[noptlist++]),"CK_SOCKS5");
10526 #endif /* CK_SOCKS5 */
10528 makestr(&(optlist[noptlist++]),"CK_SOCKS_NS");
10529 #endif /* CK_SOCKS_NS */
10530 #endif /* CK_SOCKS */
10532 makestr(&(optlist[noptlist++]),"RLOGCODE");
10533 #endif /* RLOGCODE */
10535 makestr(&(optlist[noptlist++]),"NETCMD");
10536 #endif /* NETCMD */
10538 makestr(&(optlist[noptlist++]),"NONETCMD");
10539 #endif /* NONETCMD */
10541 makestr(&(optlist[noptlist++]),"NETPTY");
10542 #endif /* NETPTY */
10543 #ifdef CK_ENVIRONMENT
10544 makestr(&(optlist[noptlist++]),"CK_ENVIRONMENT");
10545 #endif /* CK_ENVIRONMENT */
10546 #endif /* TCPSOCKET */
10548 makestr(&(optlist[noptlist++]),"TNCODE");
10549 #endif /* TNCODE */
10550 #ifdef CK_FORWARD_X
10551 makestr(&(optlist[noptlist++]),"CK_FORWARD_X");
10552 #endif /* CK_FORWARD_X */
10554 makestr(&(optlist[noptlist++]),"TN_COMPORT");
10555 #endif /* TN_COMPORT */
10557 makestr(&(optlist[noptlist++]),"MULTINET");
10558 #endif /* MULTINET */
10560 makestr(&(optlist[noptlist++]),"DEC_TCPIP");
10561 #endif /* DEC_TCPIP */
10563 makestr(&(optlist[noptlist++]),"TCPWARE");
10564 #endif /* TCPWARE */
10566 makestr(&(optlist[noptlist++]),"UCX50");
10569 makestr(&(optlist[noptlist++]),"CMU_TCPIP");
10570 #endif /* CMU_TCPIP */
10572 makestr(&(optlist[noptlist++]),"TTLEBUF");
10573 #endif /* TTLEBUF */
10575 makestr(&(optlist[noptlist++]),"NETLEBUF");
10576 #endif /* NETLEBUF */
10578 makestr(&(optlist[noptlist++]),"IKS_OPTION");
10579 #endif /* IKS_OPTION */
10581 makestr(&(optlist[noptlist++]),"IKSDB");
10584 makestr(&(optlist[noptlist++]),"IKSDCONF");
10585 #endif /* IKSDCONF */
10587 makestr(&(optlist[noptlist++]),"CK_LOGIN");
10588 #endif /* CK_LOGIN */
10590 makestr(&(optlist[noptlist++]),"CK_PAM");
10591 #endif /* CK_PAM */
10593 makestr(&(optlist[noptlist++]),"CK_SHADOW");
10594 #endif /* CK_SHADOW */
10596 makestr(&(optlist[noptlist++]),"CONGSPD");
10597 #endif /* CONGSPD */
10599 makestr(&(optlist[noptlist++]),"SUNX25");
10600 #endif /* SUNX25 */
10602 makestr(&(optlist[noptlist++]),"IBMX25");
10603 #endif /* IBMX25 */
10605 makestr(&(optlist[noptlist++]),"HPX25");
10608 makestr(&(optlist[noptlist++]),"DECNET");
10609 #endif /* DECNET */
10611 makestr(&(optlist[noptlist++]),"SUPERLAT");
10612 #endif /* SUPERLAT */
10614 makestr(&(optlist[noptlist++]),"NPIPE");
10617 makestr(&(optlist[noptlist++]),"CK_NETBIOS");
10618 #endif /* CK_NETBIOS */
10620 makestr(&(optlist[noptlist++]),"ATT7300");
10621 #endif /* ATT7300 */
10623 makestr(&(optlist[noptlist++]),"ATT6300");
10624 #endif /* ATT6300 */
10626 makestr(&(optlist[noptlist++]),"HDBUUCP");
10627 #endif /* HDBUUCP */
10629 makestr(&(optlist[noptlist++]),"USETTYLOCK");
10630 #endif /* USETTYLOCK */
10632 makestr(&(optlist[noptlist++]),"USE_UU_LOCK");
10633 #endif /* USE_UU_LOCK */
10634 #ifdef HAVE_LOCKDEV
10635 makestr(&(optlist[noptlist++]),"HAVE_LOCKDEV");
10636 #endif /* HAVE_LOCKDEV */
10637 #ifdef HAVE_BAUDBOY
10638 makestr(&(optlist[noptlist++]),"HAVE_BAUDBOY");
10639 #endif /* HAVE_BAUDBOY */
10640 #ifdef HAVE_OPENPTY
10641 makestr(&(optlist[noptlist++]),"HAVE_OPENPTY");
10642 #endif /* HAVE_OPENPTY */
10644 makestr(&(optlist[noptlist++]),"TTPTYCMD");
10645 #endif /* TTPTYCMD */
10647 makestr(&(optlist[noptlist++]),"NOUUCP");
10648 #endif /* NOUUCP */
10650 makestr(&(optlist[noptlist++]),"LONGFN");
10651 #endif /* LONGFN */
10653 makestr(&(optlist[noptlist++]),"RDCHK");
10656 makestr(&(optlist[noptlist++]),"SELECT");
10657 #endif /* SELECT */
10659 makestr(&(optlist[noptlist++]),"USLEEP");
10660 #endif /* USLEEP */
10662 makestr(&(optlist[noptlist++]),"NAP");
10665 makestr(&(optlist[noptlist++]),"NAPHACK");
10666 #endif /* NAPHACK */
10668 makestr(&(optlist[noptlist++]),"CK_POLL");
10669 #endif /* CK_POLL */
10671 makestr(&(optlist[noptlist++]),"NOIEXTEN");
10672 #endif /* NOIEXTEN */
10674 makestr(&(optlist[noptlist++]),"EXCELAN");
10675 #endif /* EXCELAN */
10677 makestr(&(optlist[noptlist++]),"INTERLAN");
10678 #endif /* INTERLAN */
10680 makestr(&(optlist[noptlist++]),"NOFILEH");
10681 #endif /* NOFILEH */
10683 makestr(&(optlist[noptlist++]),"NOSYSIOCTLH");
10684 #endif /* NOSYSIOCTLH */
10686 makestr(&(optlist[noptlist++]),"DCLPOPEN");
10687 #endif /* DCLPOPEN */
10689 makestr(&(optlist[noptlist++]),"NOSETBUF");
10690 #endif /* NOSETBUF */
10692 makestr(&(optlist[noptlist++]),"NOXFER");
10693 #endif /* NOXFER */
10695 makestr(&(optlist[noptlist++]),"NOCURSES");
10696 #endif /* NOCURSES */
10698 makestr(&(optlist[noptlist++]),"NOSERVER");
10699 #endif /* NOSERVER */
10701 makestr(&(optlist[noptlist++]),"NOPATTERNS");
10704 makestr(&(optlist[noptlist++]),"PATTERNS");
10705 #endif /* PATTERNS */
10706 #endif /* NOPATTERNS */
10708 makestr(&(optlist[noptlist++]),"NOCKEXEC");
10711 makestr(&(optlist[noptlist++]),"CKEXEC");
10712 #endif /* CKEXEC */
10713 #endif /* NOCKEXEC */
10715 makestr(&(optlist[noptlist++]),"NOAUTODL");
10716 #endif /* NOAUTODL */
10718 makestr(&(optlist[noptlist++]),"NOMSEND");
10719 #endif /* NOMSEND */
10721 makestr(&(optlist[noptlist++]),"NOFDZERO");
10722 #endif /* NOFDZERO */
10724 makestr(&(optlist[noptlist++]),"NOPOPEN");
10725 #endif /* NOPOPEN */
10727 makestr(&(optlist[noptlist++]),"NOPARTIAL");
10728 #endif /* NOPARTIAL */
10730 makestr(&(optlist[noptlist++]),"NOKVERBS");
10731 #endif /* NOKVERBS */
10733 makestr(&(optlist[noptlist++]),"NOSETREU");
10734 #endif /* NOSETREU */
10736 makestr(&(optlist[noptlist++]),"LCKDIR");
10737 #endif /* LCKDIR */
10739 makestr(&(optlist[noptlist++]),"ACUCNTRL");
10740 #endif /* ACUCNTRL */
10742 makestr(&(optlist[noptlist++]),"BSD4");
10745 makestr(&(optlist[noptlist++]),"BSD44");
10748 makestr(&(optlist[noptlist++]),"BSD41");
10751 makestr(&(optlist[noptlist++]),"BSD43");
10754 makestr(&(optlist[noptlist++]),"BSD29");
10757 makestr(&(optlist[noptlist++]),"BSDI");
10760 makestr(&(optlist[noptlist++]),"__bsdi__");
10761 #endif /* __bsdi__ */
10763 makestr(&(optlist[noptlist++]),"__NetBSD__");
10764 #endif /* __NetBSD__ */
10766 makestr(&(optlist[noptlist++]),"__OpenBSD__");
10767 #endif /* __OpenBSD__ */
10769 makestr(&(optlist[noptlist++]),"__FreeBSD__");
10770 #endif /* __FreeBSD__ */
10772 makestr(&(optlist[noptlist++]),"__linux__");
10773 #endif /* __linux__ */
10774 #ifdef LINUX_HI_SPD
10775 makestr(&(optlist[noptlist++]),"LINUX_HI_SPD");
10776 #endif /* LINUX_HI_SPD */
10778 makestr(&(optlist[noptlist++]),"LYNXOS");
10779 #endif /* LYNXOS */
10781 makestr(&(optlist[noptlist++]),"V7");
10784 makestr(&(optlist[noptlist++]),"AIX370");
10785 #endif /* AIX370 */
10787 makestr(&(optlist[noptlist++]),"RTAIX");
10790 makestr(&(optlist[noptlist++]),"HPUX");
10793 makestr(&(optlist[noptlist++]),"HPUX9");
10796 makestr(&(optlist[noptlist++]),"HPUX10");
10797 #endif /* HPUX10 */
10799 makestr(&(optlist[noptlist++]),"HPUX1000");
10800 #endif /* HPUX1000 */
10802 makestr(&(optlist[noptlist++]),"HPUX1100");
10803 #endif /* HPUX1100 */
10805 makestr(&(optlist[noptlist++]),"HPUXPRE65");
10806 #endif /* HPUXPRE65 */
10808 makestr(&(optlist[noptlist++]),"DGUX");
10811 makestr(&(optlist[noptlist++]),"DGUX430");
10812 #endif /* DGUX430 */
10814 makestr(&(optlist[noptlist++]),"DGUX540");
10815 #endif /* DGUX540 */
10817 makestr(&(optlist[noptlist++]),"DGUX543");
10818 #endif /* DGUX543 */
10820 makestr(&(optlist[noptlist++]),"DGUX54410");
10821 #endif /* DGUX54410 */
10823 makestr(&(optlist[noptlist++]),"DGUX54411");
10824 #endif /* DGUX54411 */
10826 makestr(&(optlist[noptlist++]),"sony_news");
10827 #endif /* sony_news */
10829 makestr(&(optlist[noptlist++]),"CIE");
10832 makestr(&(optlist[noptlist++]),"XENIX");
10835 makestr(&(optlist[noptlist++]),"SCO_XENIX");
10836 #endif /* SCO_XENIX */
10838 makestr(&(optlist[noptlist++]),"ISIII");
10841 makestr(&(optlist[noptlist++]),"I386IX");
10842 #endif /* I386IX */
10844 makestr(&(optlist[noptlist++]),"RTU");
10847 makestr(&(optlist[noptlist++]),"PROVX1");
10848 #endif /* PROVX1 */
10850 makestr(&(optlist[noptlist++]),"PYRAMID");
10851 #endif /* PYRAMID */
10853 makestr(&(optlist[noptlist++]),"TOWER1");
10854 #endif /* TOWER1 */
10856 makestr(&(optlist[noptlist++]),"UTEK");
10859 makestr(&(optlist[noptlist++]),"ZILOG");
10862 makestr(&(optlist[noptlist++]),"TRS16");
10865 makestr(&(optlist[noptlist++]),"MINIX");
10868 makestr(&(optlist[noptlist++]),"MINIX2");
10869 #endif /* MINIX2 */
10871 makestr(&(optlist[noptlist++]),"MINIX3");
10872 #endif /* MINIX3 */
10874 makestr(&(optlist[noptlist++]),"MINIX315");
10875 #endif /* MINIX315 */
10877 makestr(&(optlist[noptlist++]),"C70");
10880 makestr(&(optlist[noptlist++]),"AIXPS2");
10881 #endif /* AIXPS2 */
10883 makestr(&(optlist[noptlist++]),"AIXRS");
10886 makestr(&(optlist[noptlist++]),"UTSV");
10889 makestr(&(optlist[noptlist++]),"ATTSV");
10892 makestr(&(optlist[noptlist++]),"SVR3");
10895 makestr(&(optlist[noptlist++]),"SVR4");
10898 makestr(&(optlist[noptlist++]),"DELL_SVR4");
10899 #endif /* DELL_SVR4 */
10901 makestr(&(optlist[noptlist++]),"ICL_SVR4");
10902 #endif /* ICL_SVR4 */
10904 makestr(&(optlist[noptlist++]),"OSF");
10907 makestr(&(optlist[noptlist++]),"OSF1");
10910 makestr(&(optlist[noptlist++]),"__OSF");
10913 makestr(&(optlist[noptlist++]),"__OSF__");
10914 #endif /* __OSF__ */
10916 makestr(&(optlist[noptlist++]),"__osf__");
10917 #endif /* __osf__ */
10919 makestr(&(optlist[noptlist++]),"__OSF1");
10920 #endif /* __OSF1 */
10922 makestr(&(optlist[noptlist++]),"__OSF1__");
10923 #endif /* __OSF1__ */
10925 makestr(&(optlist[noptlist++]),"PTX");
10928 makestr(&(optlist[noptlist++]),"POSIX");
10930 #ifdef BSD44ORPOSIX
10931 makestr(&(optlist[noptlist++]),"BSD44ORPOSIX");
10932 #endif /* BSD44ORPOSIX */
10934 makestr(&(optlist[noptlist++]),"SVORPOSIX");
10935 #endif /* SVORPOSIX */
10937 makestr(&(optlist[noptlist++]),"SVR4ORPOSIX");
10938 #endif /* SVR4ORPOSIX */
10940 makestr(&(optlist[noptlist++]),"OS2ORVMS");
10941 #endif /* OS2ORVMS */
10943 makestr(&(optlist[noptlist++]),"OS2ORUNIX");
10944 #endif /* OS2ORUNIX */
10946 makestr(&(optlist[noptlist++]),"VMSORUNIX");
10947 #endif /* VMSORUNIX */
10949 makestr(&(optlist[noptlist++]),"VMS64BIT"); /* VMS on Alpha or IA64 */
10950 #endif /* VMS64BIT */
10952 makestr(&(optlist[noptlist++]),"VMSI64"); /* VMS on IA64 */
10953 #endif /* VMSI64 */
10954 #ifdef _POSIX_SOURCE
10955 makestr(&(optlist[noptlist++]),"_POSIX_SOURCE");
10956 #endif /* _POSIX_SOURCE */
10957 #ifdef _XOPEN_SOURCE
10958 makestr(&(optlist[noptlist++]),"_XOPEN_SOURCE");
10961 makestr(&(optlist[noptlist++]),"_ALL_SOURCE");
10964 makestr(&(optlist[noptlist++]),"_SVID3");
10965 #endif /* _SVID3 */
10967 makestr(&(optlist[noptlist++]),"Plan9");
10970 makestr(&(optlist[noptlist++]),"SOLARIS");
10972 makestr(&(optlist[noptlist++]),"SOLARIS24");
10973 #endif /* SOLARIS24 */
10975 makestr(&(optlist[noptlist++]),"SOLARIS25");
10976 #endif /* SOLARIS25 */
10978 makestr(&(optlist[noptlist++]),"SOLARIS26");
10979 #endif /* SOLARIS26 */
10981 makestr(&(optlist[noptlist++]),"SOLARIS7");
10982 #endif /* SOLARIS7 */
10984 makestr(&(optlist[noptlist++]),"SOLARIS8");
10985 #endif /* SOLARIS8 */
10987 makestr(&(optlist[noptlist++]),"SOLARIS9");
10988 #endif /* SOLARIS9 */
10990 makestr(&(optlist[noptlist++]),"SOLARIS10");
10991 #endif /* SOLARIS10 */
10992 #endif /* SOLARIS */
10995 makestr(&(optlist[noptlist++]),"SUNOS4");
10996 #endif /* SUNOS4 */
10998 makestr(&(optlist[noptlist++]),"SUN4S5");
10999 #endif /* SUN4S5 */
11001 makestr(&(optlist[noptlist++]),"IRIX");
11004 makestr(&(optlist[noptlist++]),"ENCORE");
11005 #endif /* ENCORE */
11007 makestr(&(optlist[noptlist++]),"ultrix");
11010 makestr(&(optlist[noptlist++]),"sxaE50");
11013 makestr(&(optlist[noptlist++]),"mips");
11016 makestr(&(optlist[noptlist++]),"MIPS");
11019 makestr(&(optlist[noptlist++]),"vax");
11022 makestr(&(optlist[noptlist++]),"VAX");
11025 makestr(&(optlist[noptlist++]),"alpha");
11028 makestr(&(optlist[noptlist++]),"ALPHA");
11031 makestr(&(optlist[noptlist++]),"__ALPHA");
11034 makestr(&(optlist[noptlist++]),"__alpha");
11037 makestr(&(optlist[noptlist++]),"__AXP");
11040 makestr(&(optlist[noptlist++]),"AXP");
11043 makestr(&(optlist[noptlist++]),"axp");
11046 makestr(&(optlist[noptlist++]),"__ALPHA__");
11049 makestr(&(optlist[noptlist++]),"__alpha__");
11052 makestr(&(optlist[noptlist++]),"sun");
11055 makestr(&(optlist[noptlist++]),"sun3");
11058 makestr(&(optlist[noptlist++]),"sun386");
11061 makestr(&(optlist[noptlist++]),"_SUN");
11064 makestr(&(optlist[noptlist++]),"sun4");
11067 makestr(&(optlist[noptlist++]),"sparc");
11070 makestr(&(optlist[noptlist++]),"_CRAY");
11073 makestr(&(optlist[noptlist++]),"NEXT33");
11076 makestr(&(optlist[noptlist++]),"NEXT");
11079 makestr(&(optlist[noptlist++]),"NeXT");
11082 makestr(&(optlist[noptlist++]),"MACH");
11086 makestr(&(optlist[noptlist++]),"MACOSX");
11089 makestr(&(optlist[noptlist++]),"MACOSX10");
11092 makestr(&(optlist[noptlist++]),"MACOSX10e");
11097 makestr(&(optlist[noptlist++]),"MACOSX103");
11099 #endif /* COMMENT */
11102 makestr(&(optlist[noptlist++]),"sgi");
11105 makestr(&(optlist[noptlist++]),"M_SYS5");
11107 #ifdef __SYSTEM_FIVE
11108 makestr(&(optlist[noptlist++]),"__SYSTEM_FIVE");
11111 makestr(&(optlist[noptlist++]),"sysV");
11113 #ifdef M_XENIX /* SCO Xenix V and UNIX/386 */
11114 makestr(&(optlist[noptlist++]),"M_XENIX");
11116 #ifdef M_UNIX /* SCO UNIX */
11117 makestr(&(optlist[noptlist++]),"M_UNIX");
11119 #ifdef _M_UNIX /* SCO UNIX 3.2v4 = ODT 2.0 */
11120 makestr(&(optlist[noptlist++]),"_M_UNIX");
11123 makestr(&(optlist[noptlist++]),"CK_SCOV5");
11126 makestr(&(optlist[noptlist++]),"SCO_OSR504");
11129 makestr(&(optlist[noptlist++]),"M_IA64");
11132 makestr(&(optlist[noptlist++]),"_M_IA64");
11135 makestr(&(optlist[noptlist++]),"ia64");
11138 makestr(&(optlist[noptlist++]),"_ia64");
11141 makestr(&(optlist[noptlist++]),"_ia64_");
11144 makestr(&(optlist[noptlist++]),"__ia64");
11147 makestr(&(optlist[noptlist++]),"M_I686");
11150 makestr(&(optlist[noptlist++]),"_M_I686");
11153 makestr(&(optlist[noptlist++]),"i686");
11156 makestr(&(optlist[noptlist++]),"M_I586");
11159 makestr(&(optlist[noptlist++]),"_M_I586");
11162 makestr(&(optlist[noptlist++]),"i586");
11165 makestr(&(optlist[noptlist++]),"M_I486");
11168 makestr(&(optlist[noptlist++]),"_M_I486");
11171 makestr(&(optlist[noptlist++]),"i486");
11174 makestr(&(optlist[noptlist++]),"M_I386");
11177 makestr(&(optlist[noptlist++]),"_M_I386");
11180 makestr(&(optlist[noptlist++]),"i386");
11183 makestr(&(optlist[noptlist++]),"__i386");
11186 makestr(&(optlist[noptlist++]),"__x86");
11189 makestr(&(optlist[noptlist++]),"__amd64");
11192 makestr(&(optlist[noptlist++]),"_ILP32");
11195 makestr(&(optlist[noptlist++]),"_ILP64");
11198 makestr(&(optlist[noptlist++]),"_LP32");
11201 makestr(&(optlist[noptlist++]),"_LP64");
11204 makestr(&(optlist[noptlist++]),"__LP32__");
11207 makestr(&(optlist[noptlist++]),"__LP64__");
11210 makestr(&(optlist[noptlist++]),"_XGP4_2");
11213 makestr(&(optlist[noptlist++]),"__ppc__");
11216 makestr(&(optlist[noptlist++]),"__ppc32__");
11219 makestr(&(optlist[noptlist++]),"__ppc64__");
11222 makestr(&(optlist[noptlist++]),"CK_64BIT");
11225 makestr(&(optlist[noptlist++]),"i286");
11228 makestr(&(optlist[noptlist++]),"M_I286");
11231 makestr(&(optlist[noptlist++]),"__sparc");
11234 makestr(&(optlist[noptlist++]),"__sparcv8");
11237 makestr(&(optlist[noptlist++]),"__sparcv9");
11240 makestr(&(optlist[noptlist++]),"mc68000");
11243 makestr(&(optlist[noptlist++]),"mc68010");
11246 makestr(&(optlist[noptlist++]),"mc68020");
11249 makestr(&(optlist[noptlist++]),"mc68030");
11252 makestr(&(optlist[noptlist++]),"mc68040");
11255 makestr(&(optlist[noptlist++]),"M_68000");
11258 makestr(&(optlist[noptlist++]),"M_68010");
11261 makestr(&(optlist[noptlist++]),"M_68020");
11264 makestr(&(optlist[noptlist++]),"M_68030");
11267 makestr(&(optlist[noptlist++]),"M_68040");
11270 makestr(&(optlist[noptlist++]),"m68k");
11273 makestr(&(optlist[noptlist++]),"m88k");
11276 makestr(&(optlist[noptlist++]),"pdp11");
11279 makestr(&(optlist[noptlist++]),"iAPX");
11282 makestr(&(optlist[noptlist++]),"hpux");
11285 makestr(&(optlist[noptlist++]),"__hpux");
11287 #ifdef __hp9000s800
11288 makestr(&(optlist[noptlist++]),"__hp9000s800");
11290 #ifdef __hp9000s700
11291 makestr(&(optlist[noptlist++]),"__hp9000s700");
11293 #ifdef __hp9000s500
11294 makestr(&(optlist[noptlist++]),"__hp9000s500");
11296 #ifdef __hp9000s300
11297 makestr(&(optlist[noptlist++]),"__hp9000s300");
11299 #ifdef __hp9000s200
11300 makestr(&(optlist[noptlist++]),"__hp9000s200");
11303 makestr(&(optlist[noptlist++]),"AIX");
11306 makestr(&(optlist[noptlist++]),"_AIXFS");
11309 makestr(&(optlist[noptlist++]),"u370");
11312 makestr(&(optlist[noptlist++]),"u3b");
11315 makestr(&(optlist[noptlist++]),"u3b2");
11318 makestr(&(optlist[noptlist++]),"multimax");
11321 makestr(&(optlist[noptlist++]),"balance");
11324 makestr(&(optlist[noptlist++]),"ibmrt");
11327 makestr(&(optlist[noptlist++]),"_IBMRT");
11330 makestr(&(optlist[noptlist++]),"ibmrs6000");
11333 makestr(&(optlist[noptlist++]),"_AIX");
11336 makestr(&(optlist[noptlist++]),"_IBMR2");
11339 makestr(&(optlist[noptlist++]),"UNIXWARE");
11342 makestr(&(optlist[noptlist++]),"QNX");
11344 makestr(&(optlist[noptlist++]),"__QNX__");
11346 makestr(&(optlist[noptlist++]),"__16BIT__");
11349 makestr(&(optlist[noptlist++]),"CK_QNX16");
11352 makestr(&(optlist[noptlist++]),"__32BIT__");
11355 makestr(&(optlist[noptlist++]),"CK_QNX32");
11357 #endif /* __QNX__ */
11361 makestr(&(optlist[noptlist++]),"QNX6");
11365 makestr(&(optlist[noptlist++]),"NEUTRINO");
11366 #endif /* NEUTRINO */
11368 #ifdef __STRICT_BSD__
11369 makestr(&(optlist[noptlist++]),"__STRICT_BSD__");
11371 #ifdef __STRICT_ANSI__
11372 makestr(&(optlist[noptlist++]),"__STRICT_ANSI__");
11374 #ifdef _ANSI_C_SOURCE
11375 makestr(&(optlist[noptlist++]),"_ANSI_C_SOURCE");
11378 makestr(&(optlist[noptlist++]),"__STDC__");
11381 makestr(&(optlist[noptlist++]),"cplusplus");
11384 makestr(&(optlist[noptlist++]),"__DECC");
11386 sprintf(line,"__DECC_VER=%d",__DECC_VER); /* SAFE */
11387 makestr(&(optlist[noptlist++]),line);
11388 #endif /* __DECC_VER */
11389 #endif /* __DECC */
11391 sprintf(line,"__CRTL_VER=%d",__CRTL_VER); /* SAFE */
11392 makestr(&(optlist[noptlist++]),line);
11393 #endif /* __CRTL_VER */
11394 #ifdef __GNUC__ /* gcc in ansi mode */
11395 makestr(&(optlist[noptlist++]),"__GNUC__");
11397 #ifdef GNUC /* gcc in traditional mode */
11398 makestr(&(optlist[noptlist++]),"GNUC");
11400 #ifdef __EGCS__ /* egcs in ansi mode */
11401 makestr(&(optlist[noptlist++]),"__EGCS__");
11403 #ifdef __egcs__ /* egcs in ansi mode */
11404 makestr(&(optlist[noptlist++]),"__egcs__");
11407 makestr(&(optlist[noptlist++]),"__WATCOMC__");
11410 makestr(&(optlist[noptlist++]),"CK_ANSIC");
11413 makestr(&(optlist[noptlist++]),"CK_ANSILIBS");
11415 #ifdef CKCONINTB4CB
11416 makestr(&(optlist[noptlist++]),"CKCONINTB4CB");
11417 #endif /* CKCONINTB4CB */
11419 makestr(&(optlist[noptlist++]),"NOTERMCAP");
11420 #endif /* NOTERMCAP */
11422 makestr(&(optlist[noptlist++]),"__GLIBC__");
11424 #ifdef _SC_JOB_CONTROL
11425 makestr(&(optlist[noptlist++]),"_SC_JOB_CONTROL");
11427 #ifdef _POSIX_JOB_CONTROL
11428 makestr(&(optlist[noptlist++]),"_POSIX_JOB_CONTROL");
11431 makestr(&(optlist[noptlist++]),"SIG_I");
11434 makestr(&(optlist[noptlist++]),"SIG_V");
11436 #ifdef CK_POSIX_SIG
11437 makestr(&(optlist[noptlist++]),"CK_POSIX_SIG");
11440 makestr(&(optlist[noptlist++]),"SVR3JC");
11443 makestr(&(optlist[noptlist++]),"_386BSD");
11446 makestr(&(optlist[noptlist++]),"_BSD");
11449 makestr(&(optlist[noptlist++]),"USE_MEMCPY");
11450 #endif /* USE_MEMCPY */
11452 makestr(&(optlist[noptlist++]),"USE_LSTAT");
11453 #endif /* USE_LSTAT */
11455 makestr(&(optlist[noptlist++]),"TERMIOX");
11456 #endif /* TERMIOX */
11458 makestr(&(optlist[noptlist++]),"STERMIOX");
11459 #endif /* STERMIOX */
11461 makestr(&(optlist[noptlist++]),"CK_CURSES");
11462 #endif /* CK_CURSES */
11464 makestr(&(optlist[noptlist++]),"CK_NEWTERM");
11465 #endif /* CK_NEWTERM */
11467 makestr(&(optlist[noptlist++]),"CK_WREFRESH");
11468 #endif /* CK_WREFRESH */
11470 makestr(&(optlist[noptlist++]),"CK_PCT_BAR");
11471 #endif /* CK_PCT_BAR */
11473 makestr(&(optlist[noptlist++]),"CK_DTRCD");
11474 #endif /* CK_DTRCD */
11476 makestr(&(optlist[noptlist++]),"CK_DTRCTS");
11477 #endif /* CK_DTRCTS */
11479 makestr(&(optlist[noptlist++]),"CK_RTSCTS");
11480 #endif /* CK_RTSCTS */
11481 #ifdef POSIX_CRTSCTS
11482 makestr(&(optlist[noptlist++]),"POSIX_CRTSCTS");
11483 #endif /* POSIX_CRTSCTS */
11485 makestr(&(optlist[noptlist++]),"FIXCRTSCTS");
11486 #endif /* FIXCRTSCTS */
11488 makestr(&(optlist[noptlist++]),"HWPARITY");
11489 #endif /* HWPARITY */
11492 makestr(&(optlist[noptlist++]),"CK_INI_A");
11493 ckmakmsg(line,LINBUFSIZ,"CK_SYSINI=\"",CK_SYSINI,"\"",NULL);
11494 makestr(&(optlist[noptlist++]),line);
11497 makestr(&(optlist[noptlist++]),"CK_INI_B");
11498 ckmakmsg(line,LINBUFSIZ,"CK_SYSINI=\"",CK_SYSINI,"\"",NULL);
11499 makestr(&(optlist[noptlist++]),line);
11501 makestr(&(optlist[noptlist++]),"CK_SYSINI");
11502 #endif /* CK_INI_B */
11503 #endif /* CK_INI_A */
11504 #endif /* CK_DSYSINI */
11506 makestr(&(optlist[noptlist++]),"CK_DSYSINI");
11507 #endif /* CK_DSYSINI */
11509 makestr(&(optlist[noptlist++]),"CK_TTGWSIZ");
11510 #endif /* CK_TTGWSIZ */
11512 makestr(&(optlist[noptlist++]),"CK_NAWS");
11513 #endif /* CK_NAWS */
11515 makestr(&(optlist[noptlist++]),"MDMHUP");
11516 #endif /* MDMHUP */
11517 #ifdef HUP_CLOSE_POSIX
11518 makestr(&(optlist[noptlist++]),"HUP_CLOSE_POSIX");
11519 #endif /* HUP_CLOSE_POSIX */
11520 #ifdef NO_HUP_CLOSE_POSIX
11521 makestr(&(optlist[noptlist++]),"NO_HUP_CLOSE_POSIX");
11522 #endif /* NO_HUP_CLOSE_POSIX */
11524 makestr(&(optlist[noptlist++]),"DCMDBUF");
11525 #endif /* DCMDBUF */
11527 makestr(&(optlist[noptlist++]),"CK_RECALL");
11528 #endif /* CK_RECALL */
11530 makestr(&(optlist[noptlist++]),"BROWSER");
11531 #endif /* BROWSER */
11533 makestr(&(optlist[noptlist++]),"CLSOPN");
11534 #endif /* CLSOPN */
11536 makestr(&(optlist[noptlist++]),"STRATUS");
11537 #endif /* STRATUS */
11539 makestr(&(optlist[noptlist++]),"__VOS__");
11540 #endif /* __VOS__ */
11542 makestr(&(optlist[noptlist++]),"STRATUSX25");
11543 #endif /* STRATUSX25 */
11545 makestr(&(optlist[noptlist++]),"OS2MOUSE");
11546 #endif /* OS2MOUSE */
11548 makestr(&(optlist[noptlist++]),"CK_REXX");
11549 #endif /* CK_REXX */
11551 makestr(&(optlist[noptlist++]),"CK_TIMERS");
11552 #endif /* CK_TIMERS */
11554 makestr(&(optlist[noptlist++]),"TTSPDLIST");
11555 #endif /* TTSPDLIST */
11557 makestr(&(optlist[noptlist++]),"CK_PERMS");
11558 #endif /* CK_PERMS */
11560 makestr(&(optlist[noptlist++]),"CKTUNING");
11561 #endif /* CKTUNING */
11563 makestr(&(optlist[noptlist++]),"NEWFTP");
11564 #endif /* NEWFTP */
11566 makestr(&(optlist[noptlist++]),"SYSFTP");
11567 #endif /* SYSFTP */
11569 makestr(&(optlist[noptlist++]),"NOFTP");
11572 makestr(&(optlist[noptlist++]),"CKHTTP");
11573 #endif /* CKHTTP */
11575 makestr(&(optlist[noptlist++]),"NOHTTP");
11576 #endif /* NOHTTP */
11578 makestr(&(optlist[noptlist++]),"CKROOT");
11579 #endif /* CKROOT */
11581 makestr(&(optlist[noptlist++]),"CKREALPATH");
11582 #endif /* CKREALPATH */
11584 makestr(&(optlist[noptlist++]),"STREAMING");
11585 #endif /* STREAMING */
11586 #ifdef UNPREFIXZERO
11587 makestr(&(optlist[noptlist++]),"UNPREFIXZERO");
11588 #endif /* UNPREFIXZERO */
11590 makestr(&(optlist[noptlist++]),"CKREGEX");
11591 #endif /* CKREGEX */
11593 makestr(&(optlist[noptlist++]),"ZXREWIND");
11594 #endif /* ZXREWIND */
11596 makestr(&(optlist[noptlist++]),"CKSYSLOG");
11597 #endif /* CKSYSLOG */
11599 sprintf(line,"SYSLOGLEVEL=%d",SYSLOGLEVEL); /* SAFE */
11600 makestr(&(optlist[noptlist++]),line);
11601 #endif /* SYSLOGLEVEL */
11603 makestr(&(optlist[noptlist++]),"NOSEXP");
11604 #endif /* NOSEXP */
11606 makestr(&(optlist[noptlist++]),"CKLEARN");
11609 makestr(&(optlist[noptlist++]),"NOLOEARN");
11610 #endif /* NOLOEARN */
11611 #endif /* CKLEARN */
11614 makestr(&(optlist[noptlist++]),"NOFLOAT");
11617 makestr(&(optlist[noptlist++]),"FNFLOAT");
11618 #endif /* FNFLOAT */
11621 makestr(&(optlist[noptlist++]),"GFTIMER");
11622 #endif /* GFTIMER */
11624 ckmakmsg(line,LINBUFSIZ,"CKFLOAT=",CKFLOAT_S,NULL,NULL);
11625 makestr(&(optlist[noptlist++]),line);
11627 makestr(&(optlist[noptlist++]),"CKFLOAT");
11628 #endif /* CKFLOAT_S */
11629 #endif /* CKFLOAT */
11630 #endif /* NOFLOAT */
11633 makestr(&(optlist[noptlist++]),"SSH");
11636 makestr(&(optlist[noptlist++]),"NETDLL");
11637 #endif /* NETDLL */
11639 makestr(&(optlist[noptlist++]),"NETFILE");
11640 #endif /* NETFILE */
11642 makestr(&(optlist[noptlist++]),"CK_TAPI");
11643 #endif /* CK_TAPI */
11645 makestr(&(optlist[noptlist++]),"CK_SSL");
11646 #ifdef OPENSSL_VERSION_TEXT
11647 ckmakmsg(line,LINBUFSIZ,
11648 "OPENSSL_VERSION_TEXT=","\"",OPENSSL_VERSION_TEXT,"\"");
11649 makestr(&(optlist[noptlist++]),line);
11650 #endif /* OPENSSL_VERSION_TEXT */
11651 #endif /* CK_SSL */
11652 debug(F101,"initoptlist noptlist","",noptlist);
11653 sh_sort(optlist,NULL,noptlist,0,0,0);
11662 extern int fp_digits, fp_rounding;
11663 #endif /* FNFLOAT */
11664 extern int byteorder;
11665 printf("%s\n",versio);
11669 debug(F101,"shofea NOPTLIST","",NOPTLIST);
11671 debug(F101,"shofea noptlist","",noptlist);
11675 printf("Microsoft Windows Operating Systems for Alpha CPUs.\n");
11676 #else /* _M_ALPHA */
11678 printf("Microsoft Windows Operating Systems for PowerPC CPUs.\n");
11681 printf("Microsoft Windows Operating Systems for MIPS CPUs.\n");
11682 #else /* _M_MRX000 */
11684 printf("Microsoft Windows Operating Systems for 32-bit Intel CPUs.\n");
11685 #else /* _M_IX86 */
11686 UNKNOWN WINDOWS PLATFORM
11687 #endif /* _M_IX86 */
11688 #endif /* _M_MRX000 */
11689 #endif /* _M_PPC */
11690 #endif /* _M_ALPHA */
11693 printf("IBM OS/2 16-bit.\n");
11695 printf("IBM OS/2 32-bit.\n");
11696 #endif /* M_I286 */
11701 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11702 printf("Major optional features included:\n");
11703 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11705 if (sizeof(CK_OFF_T) == 8) {
11706 printf(" Large files and large integers (64 bits)\n");
11707 if (++lines > cmd_rows - 3) {
11708 if (!askmore()) return(1); else lines = 0;
11712 printf(" Network support (type SHOW NET for further info)\n");
11713 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11715 printf(" Telnet Kermit Option\n");
11716 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11717 #endif /* IKS_OPTION */
11718 #ifdef CK_AUTHENTICATION
11719 printf(" Telnet Authentication Option\n");
11720 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11724 printf(" Kerberos(TM) IV and Kerberos V authentication\n");
11725 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11727 printf(" Kerberos(TM) IV authentication\n");
11728 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11732 printf(" Kerberos(TM) V authentication\n");
11733 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11736 #endif /* CK_KERBEROS */
11738 printf(" SRP(TM) (Secure Remote Password) authentication\n");
11739 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11740 #endif /* CK_SRP */
11742 printf(" Secure Sockets Layer (SSL)\n");
11743 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11744 printf(" Transport Layer Security (TLS)\n");
11745 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11746 #endif /* CK_SSL */
11748 printf(" Secure Shell (SSH) [internal]\n");
11749 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11750 #endif /* SSHBUILTIN */
11752 printf(" Secure Shell (SSH) [external]\n");
11753 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11754 #endif /* SSHCMD */
11755 #ifdef CK_ENCRYPTION
11756 printf(" Telnet Encryption Option\n");
11757 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11759 printf(" Telnet DES Encryption\n");
11760 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11761 #endif /* CK_DES */
11763 printf(" Telnet CAST Encryption\n");
11764 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11765 #endif /* CK_CAST */
11769 #ifdef ALLOW_KRB_3DES_ENCRYPT
11770 printf(" Kerberos 3DES/AES Telnet Encryption\n");
11771 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11772 #endif /* ALLOW_KRB_3DES_ENCRYPT */
11774 #endif /* CK_KERBEROS */
11776 #endif /* CK_ENCRYPTION */
11777 #endif /* CK_AUTHENTICATION */
11778 #ifdef CK_FORWARD_X
11779 printf(" X Windows forwarding\n");
11780 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11781 #endif /* CK_FORWARD_X */
11783 printf(" Telnet Remote Com Port Control Option\n");
11784 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11785 #endif /* TN_COMPORT */
11788 printf(" SOCKS 5\n");
11789 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11790 #else /* CK_SOCKS5 */
11791 printf(" SOCKS 4\n");
11792 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11793 #endif /* CK_SOCKS5 */
11794 #endif /* CK_SOCKS */
11796 printf(" Built-in FTP client\n");
11797 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11798 #endif /* NEWFTP */
11800 printf(" Built-in HTTP client\n");
11801 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11802 #endif /* CKHTTP */
11803 #endif /* NETCONN */
11806 printf(" Hardware flow control\n");
11807 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11808 #endif /* CK_RTSCTS */
11811 #ifdef XYZ_INTERNAL
11812 printf(" Built-in XYZMODEM protocols\n");
11814 printf(" External XYZMODEM protocol support\n");
11815 #endif /* XYZ_INTERNAL */
11816 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11817 #endif /* CK_XYZ */
11820 printf(" Latin-1 (West European) character-set translation\n");
11821 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11823 printf(" Latin-2 (East European) character-set translation\n");
11824 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11825 #endif /* LATIN2 */
11827 printf(" Cyrillic (Russian, Ukrainian, etc) character-set translation\n");
11828 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11829 #endif /* CYRILLIC */
11831 printf(" Greek character-set translation\n");
11832 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11835 printf(" Hebrew character-set translation\n");
11836 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11837 #endif /* HEBREW */
11839 printf(" Japanese character-set translation\n");
11840 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11843 printf(" Unicode character-set translation\n");
11844 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11845 #endif /* UNICODE */
11848 printf(" Unicode support for ISO-2022 Terminal Emulation\n");
11850 printf(" Unicode translation for Terminal Character-Sets\n");
11851 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11852 #endif /* CKOUNI */
11853 #endif /* NOCSETS */
11856 printf(" Pseudoterminal control\n");
11857 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11858 #endif /* NETPTY */
11861 printf(" REDIRECT command\n");
11862 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11863 #endif /* CK_REDIR */
11866 printf(" RESEND command\n");
11867 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11868 #endif /* CK_RESEND */
11872 printf(" Fullscreen file transfer display\n");
11873 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11874 #endif /* CK_CURSES */
11875 #endif /* NOXFER */
11878 printf(" Control-character unprefixing\n");
11879 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11880 #endif /* CK_SPEED */
11883 printf(" Streaming\n");
11884 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11885 #endif /* STREAMING */
11888 printf(" Autodownload\n");
11889 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11890 #endif /* CK_AUTODL */
11893 printf(" Mouse support\n");
11894 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11895 #endif /* OS2MOUSE */
11898 printf(" REXX script language interface\n");
11899 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11900 #endif /* CK_REXX */
11904 printf(" Internet Kermit Service with user login support\n");
11905 #else /* CK_LOGIN */
11906 printf(" Internet Kermit Service without user login support\n");
11907 #endif /* CK_LOGIN */
11908 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11912 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11913 printf("Major optional features not included:\n");
11914 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11916 if (sizeof(CK_OFF_T) <= 4) {
11917 printf(" No large files or large integers\n");
11918 if (++lines > cmd_rows - 3) {
11919 if (!askmore()) return(1); else lines = 0;
11924 printf(" No file-transfer protocols\n");
11925 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11930 printf(" No fullscreen file transfer display\n");
11931 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11934 #endif /* CK_CURSES */
11937 printf(" No server mode\n");
11938 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11940 #endif /* NOSERVER */
11943 printf(" No control-character unprefixing\n");
11944 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11946 #endif /* CK_SPEED */
11949 printf(" No streaming\n");
11950 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11952 #endif /* STREAMING */
11955 printf(" No autodownload\n");
11956 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11958 #endif /* CK_AUTODL */
11961 printf(" No built-in XYZMODEM protocols\n");
11962 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11964 #endif /* CK_XYZ */
11967 printf(" No transaction log\n");
11968 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11970 #endif /* NOTLOG */
11971 #endif /* NOXFER */
11974 printf(" No debugging\n");
11975 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11977 #endif /* NODEBUG */
11980 printf(" No built-in help\n");
11981 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11983 #endif /* NOHELP */
11986 printf(" No making connections\n");
11987 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11991 printf(" No network support\n");
11992 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11994 #else /* NETCONN */
11996 printf(" No Telnet Kermit Option\n");
11997 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
11999 #endif /* IKS_OPTION */
12000 #endif /* NETCONN */
12003 printf(" No Secure Shell (SSH)\n");
12004 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12006 #ifndef CK_AUTHENTICATION
12007 printf(" No Kerberos(TM) authentication\n");
12008 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12009 printf(" No SRP(TM) (Secure Remote Password) protocol\n");
12010 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12011 printf(" No Secure Sockets Layer (SSL) protocol\n");
12012 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12013 printf(" No Transport Layer Security (TLS) protocol\n");
12014 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12015 printf(" No encryption\n");
12016 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12018 #else /* CK_AUTHENTICATION */
12019 #ifndef CK_KERBEROS
12020 printf(" No Kerberos(TM) authentication\n");
12021 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12023 #else /* CK_KERBEROS */
12025 printf(" No Kerberos(TM) IV authentication\n");
12026 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12030 printf(" No Kerberos(TM) V authentication\n");
12031 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12034 #endif /* CK_KERBEROS */
12036 printf(" No SRP(TM) (Secure Remote Password) authentication\n");
12037 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12039 #endif /* CK_SRP */
12041 printf(" No Secure Sockets Layer (SSL) protocol\n");
12042 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12043 printf(" No Transport Layer Security (TLS) protocol\n");
12044 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12046 #endif /* CK_SSL */
12047 #ifndef CK_ENCRYPTION
12048 printf(" No Telnet Encryption Option\n");
12049 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12051 #else /* CK_ENCRYPTION */
12054 printf(" No Telnet DES encryption\n");
12055 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12057 #endif /* CK_DES */
12059 printf(" No Telnet CAST encryption\n");
12060 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12062 #endif /* CK_CAST */
12067 #ifndef ALLOW_KRB_3DES_ENCRYPT
12068 printf(" No Kerberos 3DES/AES Telnet Encryption\n");
12069 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12070 #endif /* ALLOW_KRB_3DES_ENCRYPT */
12072 #endif /* CK_KERBEROS */
12073 #endif /* COMMENT */
12076 #endif /* CK_ENCRYPTION */
12077 #endif /* CK_AUTHENTICATION */
12078 #ifndef CK_FORWARD_X
12079 printf(" No X Windows forwarding\n");
12080 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12081 #endif /* CK_FORWARD_X */
12083 printf(" No Telnet Remote Com Port Control Option\n");
12084 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12085 #endif /* TN_COMPORT */
12087 printf(" No SOCKS\n");
12088 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12089 #endif /* CK_SOCKS */
12091 printf(" No built-in FTP client\n");
12092 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12093 #endif /* NEWFTP */
12095 printf(" No built-in HTTP client\n");
12096 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12097 #endif /* NOHTTP */
12100 printf(" No DIAL command\n");
12101 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12105 printf(" Support for most modem types excluded\n");
12106 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12108 #endif /* MINIDIAL */
12109 #endif /* NODIAL */
12110 #endif /* NOLOCAL */
12114 printf(" No hardware flow control\n");
12115 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12118 #endif /* CK_RTSCTS */
12121 printf(" No TRANSMIT command\n");
12122 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12124 #endif /* NOXMIT */
12127 printf(" No SCRIPT command\n");
12128 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12130 #endif /* NOSCRIPT */
12133 printf(" No script programming features\n");
12134 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12139 printf(" No character-set translation\n");
12140 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12145 printf(" No Latin-2 character-set translation\n");
12146 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12148 #endif /* LATIN2 */
12151 printf(" No Greek character-set translation\n");
12152 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12154 #endif /* NOGREEK */
12157 printf(" No Hebrew character-set translation\n");
12158 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12160 #endif /* NOHEBREW */
12163 printf(" No Unicode character-set translation\n");
12164 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12166 #endif /* NOUNICODE */
12169 printf(" No Cyrillic character-set translation\n");
12170 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12172 #endif /* NOCYRIL */
12175 printf(" No Kanji character-set translation\n");
12176 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12179 #endif /* NOCSETS */
12182 printf(" No command-line arguments\n");
12183 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12185 #endif /* NOCMDL */
12188 printf(" No escape to system\n");
12189 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12191 #endif /* NOPUSH */
12195 printf(" No UNIX job control\n");
12196 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12202 printf(" No SET KEY command\n");
12203 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12205 #endif /* NOSETKEY */
12208 printf(" No REDIRECT or PIPE command\n");
12209 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12211 #endif /* CK_REDIR */
12215 printf(" No pseudoterminal control\n");
12216 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12218 #endif /* NETPTY */
12222 printf(" No RESEND command\n");
12223 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12225 #endif /* CK_RESEND */
12230 printf(" No Mouse support\n");
12231 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12233 #endif /* __32BIT__ */
12235 #endif /* OS2MOUSE */
12240 printf(" No REXX script language interface\n");
12241 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12243 #endif /* CK_REXX */
12248 printf(" No Internet Kermit Service\n");
12249 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12255 if (++lines > cmd_rows - 3)
12256 { if (!askmore()) return(1); else lines = 0; }
12259 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12262 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12263 printf("Host info:\n");
12264 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12265 printf(" Machine: %s\n",unm_mch[0] ? unm_mch : "(unknown)");
12266 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12267 printf(" Model: %s\n",unm_mod[0] ? unm_mod : "(unknown)");
12268 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12269 printf(" OS: %s\n",unm_nam[0] ? unm_nam : "(unknown)");
12270 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12271 printf(" OS Release: %s\n",unm_rel[0] ? unm_rel : "(unknown)");
12272 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12273 printf(" OS Version: %s\n",unm_ver[0] ? unm_ver : "(unknown)");
12274 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12276 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12277 #endif /* CK_UTSNAME */
12280 Print compile-time (-D) options, as well as C preprocessor
12281 predefined symbols that might affect us...
12285 char * s; /* Makefile target */
12288 if (!*s) s = "(unknown)";
12290 if (++lines > cmd_rows - 3) {
12291 if (!askmore()) return(1); else lines = 0;
12293 printf("Target: %s\n", s);
12294 if (++lines > cmd_rows - 3) {
12295 if (!askmore()) return(1); else lines = 0;
12298 #endif /* KTARGET */
12302 printf("GCC version: %s\n", __VERSION__);
12304 printf("Compiler version: %s\n", __VERSION__);
12305 #endif /* __GNUC__ */
12306 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12307 #endif /* __VERSION__ */
12309 #ifdef __DATE__ /* GNU and other ANSI */
12311 printf("Compiled %s %s, options:\n", __DATE__, __TIME__);
12313 printf("Compiled %s, options:\n", __DATE__);
12314 #endif /* __TIME__ */
12315 #else /* !__DATE__ */
12316 printf("Compiler options:\n");
12317 #endif /* __DATE__ */
12318 if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
12320 for (i = 0; i < noptlist; i++) /* Print sorted option list */
12321 if (!prtopt(&lines,optlist[i]))
12324 if (!prtopt(&lines,"")) return(0); /* Start a new section */
12326 /* Sizes of data types */
12331 byteorder ? "little" : "big",
12335 if (!prtopt(&lines,line)) return(0);
12336 if (!prtopt(&lines,"")) return(0); /* Start a new section */
12337 sprintf(line,"sizeofs: int=%d",sizeof(int)); /* SAFE */
12338 if (!prtopt(&lines,line)) return(0);
12339 sprintf(line,"long=%d",sizeof(long)); /* SAFE */
12340 if (!prtopt(&lines,line)) return(0);
12344 sprintf(line,"long long=%d",sizeof(long long)); /* SAFE */
12345 if (!prtopt(&lines,line)) return(0);
12346 #endif /* CK_LONGLONG */
12347 #endif /* COMMENT */
12350 /* Windows doesn't have off_t */
12351 sprintf(line,"off_t=%d",sizeof(off_t)); /* SAFE */
12352 if (!prtopt(&lines,line)) return(0);
12355 sprintf(line,"CK_OFF_T=%d",sizeof(CK_OFF_T)); /* SAFE */
12356 if (!prtopt(&lines,line)) return(0);
12359 sprintf(line,"size_t=%d",sizeof(size_t)); /* SAFE */
12360 if (!prtopt(&lines,line)) return(0);
12361 #endif /* BIGBUFOK */
12363 sprintf(line,"short=%d",sizeof(short)); /* SAFE */
12364 if (!prtopt(&lines,line)) return(0);
12365 sprintf(line,"char=%d",sizeof(char)); /* SAFE */
12366 if (!prtopt(&lines,line)) return(0);
12367 sprintf(line,"char*=%d",sizeof(char *)); /* SAFE */
12368 if (!prtopt(&lines,line)) return(0);
12369 sprintf(line,"float=%d",sizeof(float)); /* SAFE */
12370 if (!prtopt(&lines,line)) return(0);
12371 sprintf(line,"double=%d",sizeof(double)); /* SAFE */
12372 if (!prtopt(&lines,line)) return(0);
12374 if (!prtopt(&lines,"")) return(0); /* Start a new section */
12375 if (!prtopt(&lines,"floating-point:")) return(0);
12376 sprintf(line,"precision=%d",fp_digits); /* SAFE */
12377 if (!prtopt(&lines,line)) return(0);
12378 sprintf(line,"rounding=%d",fp_rounding); /* SAFE */
12379 if (!prtopt(&lines,line)) return(0);
12380 #endif /* FNFLOAT */
12385 #endif /* NOSHOW */