Annotation of coherent/e/bin/cku179/ckcdeb.h, revision 1.1

1.1     ! root        1: /*  C K C D E B . H  */
        !             2: 
        !             3: /*
        !             4:   This file is included by all C-Kermit modules, including the modules
        !             5:   that aren't specific to Kermit (like the command parser and the ck?tio and
        !             6:   ck?fio modules.  It specifies format codes for debug(), tlog(), and similar
        !             7:   functions, and includes any necessary definitions to be used by all C-Kermit
        !             8:   modules, and also includes some feature selection compile-time switches, and
        !             9:   also system- or compiler-dependent definitions, plus #includes and prototypes
        !            10:   required by all C-Kermit modules.
        !            11: */
        !            12: 
        !            13: /*
        !            14:   Copyright (C) 1985, 1992, Trustees of Columbia University in the City of New
        !            15:   York. Permission is granted to any individual or institution to use, copy,
        !            16:   or redistribute this software so long as it is not sold for profit, provided
        !            17:   this copyright notice is retained.
        !            18: */
        !            19: 
        !            20: /*
        !            21:   Etymology: The name of this file means "C-Kermit Common-C-Language Debugging
        !            22:   Header", because originally it contained only the formats (F000-F111) for
        !            23:   the debug() and tlog() functions.  See how it has grown...
        !            24: */
        !            25: 
        !            26: #ifndef CKCDEB_H                       /* Don't include me more than once. */
        !            27: #define CKCDEB_H
        !            28: 
        !            29: #include <stdio.h>                     /* Begin by including this. */
        !            30: #include <ctype.h>                     /* and this. */
        !            31: 
        !            32: #ifdef MAC
        !            33: /*
        !            34:  * The MAC doesn't use standard stdio routines.
        !            35:  */
        !            36: #undef getchar
        !            37: #undef putchar
        !            38: #endif /* MAC */
        !            39: 
        !            40: /* System-type compilation switches */
        !            41: 
        !            42: #ifdef FT21                            /* Fortune For:Pro 2.1 implies 1.8 */
        !            43: #ifndef FT18
        !            44: #define FT18
        !            45: #endif /* FT18 */
        !            46: #endif /* FT21 */
        !            47: 
        !            48: #ifdef AIXPS2                          /* AIXPS2 implies AIX370 */
        !            49: #ifndef AIX370
        !            50: #define AIX370
        !            51: #endif /* AIX370 */
        !            52: #endif /* AIXPS2 */
        !            53: 
        !            54: #ifdef AIX370                          /* AIX PS/2 or 370 implies BSD4 */
        !            55: #ifndef BSD4
        !            56: #define BSD4
        !            57: #endif /* BSD4 */
        !            58: #endif /* AIX370 */
        !            59: 
        !            60: #ifdef DGUX540                         /* DG UX 5.40 implies Sys V R 4 */
        !            61: #ifndef SVR4
        !            62: #define SVR4
        !            63: #endif /* SVR4 */
        !            64: #endif /* DGUX540 */
        !            65: 
        !            66: #ifdef SUNOS41                         /* SUNOS41 implies SUNOS4 */
        !            67: #ifndef SUNOS4
        !            68: #define SUNOS4
        !            69: #endif /* SUNOS4 */
        !            70: #endif /* SUNOS41 */
        !            71: 
        !            72: #ifdef SUN4S5                          /* Sun-4 System V environment */
        !            73: #ifndef SVR3                           /* implies System V R3 or later */
        !            74: #define SVR3
        !            75: #endif /* SVR3 */
        !            76: #endif /* SUN4S5 */
        !            77: 
        !            78: #ifdef MIPS                            /* MIPS System V environment */
        !            79: #ifndef SVR3                           /* implies System V R3 or later */
        !            80: #define SVR3
        !            81: #endif /* SVR3 */
        !            82: #endif /* MIPS */
        !            83: 
        !            84: #ifdef SVR3                            /* SVR3 implies ATTSV */
        !            85: #ifndef ATTSV
        !            86: #define ATTSV
        !            87: #endif /* ATTSV */
        !            88: #endif /* SVR3 */
        !            89: 
        !            90: #ifdef SVR4                            /* SVR4 implies ATTSV */
        !            91: #ifndef ATTSV
        !            92: #define ATTSV
        !            93: #endif /* ATTSV */
        !            94: #ifndef SVR3                           /* ...as well as SVR3 */
        !            95: #define SVR3
        !            96: #endif /* SVR3 */
        !            97: #endif /* SVR4 */
        !            98: 
        !            99: #ifdef UTSV                            /* UTSV implies ATTSV */
        !           100: #ifndef ATTSV
        !           101: #define ATTSV
        !           102: #endif /* ATTSV */
        !           103: #endif /* UTSV */
        !           104: 
        !           105: #ifdef XENIX                           /* XENIX implies ATTSV */
        !           106: #ifndef ATTSV
        !           107: #define ATTSV
        !           108: #endif /* ATTSV */
        !           109: #endif /* XENIX */
        !           110: 
        !           111: #ifdef AUX                             /* AUX implies ATTSV */
        !           112: #ifndef ATTSV
        !           113: #define ATTSV
        !           114: #endif /* ATTSV */
        !           115: #endif /* AUX */
        !           116: 
        !           117: #ifdef ATT7300                         /* ATT7300 implies ATTSV */
        !           118: #ifndef ATTSV
        !           119: #define ATTSV
        !           120: #endif /* ATTSV */
        !           121: #endif /* ATT7300 */
        !           122: 
        !           123: #ifdef ATT6300                         /* ATT6300 implies ATTSV */
        !           124: #ifndef ATTSV
        !           125: #define ATTSV
        !           126: #endif /* ATTSV */
        !           127: #endif /* ATT6300 */
        !           128: 
        !           129: #ifdef HPUX                            /* HPUX implies ATTSV */
        !           130: #ifndef ATTSV
        !           131: #define ATTSV
        !           132: #endif /* ATTSV */
        !           133: #endif /* HPUX */
        !           134: 
        !           135: #ifdef ISIII                           /* ISIII implies ATTSV */
        !           136: #ifndef ATTSV
        !           137: #define ATTSV
        !           138: #endif /* ATTSV */
        !           139: #endif /* ISIII */
        !           140: 
        !           141: #ifdef NEXT                            /* NEXT implies BSD4 */
        !           142: #ifndef BSD4
        !           143: #define BSD4
        !           144: #endif /* BSD4 */
        !           145: #endif /* NEXT */
        !           146: 
        !           147: #ifdef SUNOS4                          /* SUNOS4 implies BSD4 */
        !           148: #ifndef BSD4
        !           149: #define BSD4
        !           150: #endif /* BSD4 */
        !           151: #endif /* SUNOS4 */
        !           152: 
        !           153: #ifdef BSD41                           /* BSD41 implies BSD4 */
        !           154: #ifndef BSD4
        !           155: #define BSD4
        !           156: #endif /* BSD4 */
        !           157: #endif /* BSD41 */
        !           158: 
        !           159: #ifdef BSD43                           /* BSD43 implies BSD4 */
        !           160: #ifndef BSD4
        !           161: #define BSD4
        !           162: #endif /* BSD4 */
        !           163: #endif /* BSD43 */
        !           164: 
        !           165: #ifdef BSD4                            /* BSD4 implies ANYBSD */
        !           166: #ifndef ANYBSD
        !           167: #define ANYBSD
        !           168: #endif /* ANYBSD */
        !           169: #endif /* BSD4 */
        !           170: 
        !           171: #ifdef BSD29                           /* BSD29 implies ANYBSD */
        !           172: #ifndef ANYBSD
        !           173: #define ANYBSD
        !           174: #endif /* ANYBSD */
        !           175: #endif /* BSD29 */
        !           176: 
        !           177: #ifdef ATTSV                           /* ATTSV implies UNIX */
        !           178: #ifndef UNIX
        !           179: #define UNIX
        !           180: #endif /* UNIX */
        !           181: #endif /* ATTSV */
        !           182: 
        !           183: #ifdef ANYBSD                          /* ANYBSD implies UNIX */
        !           184: #ifndef UNIX
        !           185: #define UNIX
        !           186: #endif /* UNIX */
        !           187: #endif /* ANYBSD */
        !           188: 
        !           189: #ifdef POSIX                           /* POSIX implies UNIX */
        !           190: #ifndef UNIX
        !           191: #define UNIX
        !           192: #endif /* UNIX */
        !           193: #ifndef DIRENT                         /* and DIRENT, i.e. <dirent.h> */
        !           194: #ifndef SDIRENT
        !           195: #define DIRENT
        !           196: #endif /* SDIRENT */
        !           197: #endif /* DIRENT */
        !           198: #ifndef NOFILEH                                /* POSIX doesn't use <sys/file.h> */
        !           199: #define NOFILEH
        !           200: #endif /* NOFILEH */
        !           201: #endif /* POSIX */
        !           202: 
        !           203: #ifdef V7
        !           204: #ifndef UNIX
        !           205: #define UNIX
        !           206: #endif /* UNIX */
        !           207: #endif /* V7 */
        !           208: 
        !           209: #ifdef COHERENT
        !           210: #ifndef UNIX
        !           211: #define UNIX
        !           212: #endif /* UNIX */
        !           213: #endif /* COHERENT */
        !           214: 
        !           215: #ifdef MINIX
        !           216: #ifndef UNIX
        !           217: #define UNIX
        !           218: #endif /* UNIX */
        !           219: #endif /* MINIX */
        !           220: /*
        !           221:   The symbol SVORPOSIX is defined for both AT&T and POSIX compilations
        !           222:   to make it easier to select items that System V and POSIX have in common,
        !           223:   but which BSD, V7, etc, do not have.
        !           224: */
        !           225: #ifdef ATTSV
        !           226: #ifndef SVORPOSIX
        !           227: #define SVORPOSIX
        !           228: #endif /* SVORPOSIX */
        !           229: #endif /* ATTSV */
        !           230: 
        !           231: #ifdef POSIX
        !           232: #ifndef SVORPOSIX
        !           233: #define SVORPOSIX
        !           234: #endif /* SVORPOSIX */
        !           235: #endif /* POSIX */
        !           236: 
        !           237: /*
        !           238:   The symbol SVR4ORPOSIX is defined for both AT&T System V R4 and POSIX 
        !           239:   compilations to make it easier to select items that System V R4 and POSIX 
        !           240:   have in common, but which BSD, V7, and System V R3 and earlier, etc, do
        !           241:   not have.
        !           242: */
        !           243: #ifdef POSIX
        !           244: #ifndef SVR4ORPOSIX
        !           245: #define SVR4ORPOSIX
        !           246: #endif /* SVR4ORPOSIX */
        !           247: #endif /* POSIX */
        !           248: #ifdef SVR4
        !           249: #ifndef SVR4ORPOSIX
        !           250: #define SVR4ORPOSIX
        !           251: #endif /* SVR4ORPOSIX */
        !           252: #endif /* SVR4 */
        !           253: 
        !           254: #ifdef apollo                          /* May be ANSI-C, check further */
        !           255: #ifdef __STDCPP__
        !           256: #define CK_ANSIC                       /* Yes, this is real ANSI-C */
        !           257: #define SIG_V
        !           258: #else
        !           259: #define NOANSI                         /* Nope, not ANSI */
        !           260: #undef __STDC__                                /* Even though it say it is! */
        !           261: #define SIG_I
        !           262: #endif /* __STDCPP__ */
        !           263: #endif /* apollo */
        !           264: 
        !           265: #ifdef POSIX                           /* -DPOSIX on cc command line */
        !           266: #ifndef _POSIX_SOURCE                  /* Implies _POSIX_SOURCE */
        !           267: #define _POSIX_SOURCE
        !           268: #endif /* _POSIX_SOURCE */
        !           269: #endif /* POSIX */
        !           270: 
        !           271: /*
        !           272:   ANSI C?  That is, do we have function prototypes, new-style
        !           273:   function declarations, and parameter type checking and coercion?
        !           274: */
        !           275: #ifdef MAC                             /* MPW C is ANSI */
        !           276: #ifndef NOANSI
        !           277: #ifndef CK_ANSIC
        !           278: #define CK_ANSIC
        !           279: #endif /* CK_ANSIC */
        !           280: #endif /* NOANSI */
        !           281: #endif /* MAC */
        !           282: 
        !           283: #ifndef NOANSI
        !           284: #ifdef __STDC__                                /* __STDC__ means ANSI C */
        !           285: #ifndef CK_ANSIC
        !           286: #define CK_ANSIC
        !           287: #endif /* CK_ANSIC */
        !           288: #endif /* __STDC__ */
        !           289: #endif /* NOANSI */
        !           290: /*
        !           291:   _PROTOTYP() is used for forward declarations of functions so we can have
        !           292:   parameter and return value type checking if the compiler offers it.
        !           293:   __STDC__ should be defined by the compiler only if function prototypes are
        !           294:   allowed.  Otherwise, we get old-style forward declarations.  Our own private
        !           295:   CK_ANSIC symbol tells whether we use ANSI C prototypes.  To force use of
        !           296:   ANSI prototypes, include -DCK_ANSIC on the cc command line.  To disable the
        !           297:   use of ANSI prototypes, include -DNOANSI.
        !           298: */
        !           299: #ifdef CK_ANSIC
        !           300: #define _PROTOTYP( func, parms ) func parms
        !           301: #else /* Not ANSI C */
        !           302: #define _PROTOTYP( func, parms ) func()
        !           303: #endif /* CK_ANSIC */
        !           304: 
        !           305: /*
        !           306:   Altos-specific items: 486, 586, 986 models...
        !           307: */
        !           308: #ifdef A986
        !           309: #define M_VOID
        !           310: #define void int
        !           311: #define CHAR char
        !           312: #define SIG_I
        !           313: #endif /* A986 */
        !           314: 
        !           315: /* Void type */
        !           316: 
        !           317: #ifndef VOID                           /* Used throughout all C-Kermit */
        !           318: #ifdef CK_ANSIC                                /* modules... */
        !           319: #define VOID void
        !           320: #else
        !           321: #define VOID int
        !           322: #endif /* CK_ANSIC */
        !           323: #endif /* VOID */
        !           324: 
        !           325: /* Signal type */
        !           326: 
        !           327: #ifndef SIG_V                          /* signal() type, if not def'd yet */
        !           328: #ifndef SIG_I
        !           329: #ifdef POSIX
        !           330: #define SIG_V
        !           331: #else
        !           332: #ifdef SVR3                            /* System V R3 and later */
        !           333: #define SIG_V
        !           334: #else
        !           335: #ifdef SUNOS4                          /* SUNOS V 4.0 and later */
        !           336: #ifndef sun386
        !           337: #define SIG_V 
        !           338: #else
        !           339: #define SIG_I
        !           340: #endif /* sun386 */
        !           341: #else
        !           342: #ifdef NEXT                            /* NeXT */
        !           343: #define SIG_V
        !           344: #else
        !           345: #ifdef AIX370
        !           346: #define SIG_V
        !           347: #define SIGTYP __SIGVOID               /* AIX370 */
        !           348: #else
        !           349: #define SIG_I
        !           350: #endif /* AIX370 */
        !           351: #endif /* NEXT */
        !           352: #endif /* SUNOS4 */
        !           353: #endif /* SVR3 */
        !           354: #endif /* POSIX */
        !           355: #endif /* SIG_I */
        !           356: #endif /* SIG_V */
        !           357: 
        !           358: #ifdef SIG_I
        !           359: #define SIGRETURN return(0)
        !           360: #ifndef SIGTYP
        !           361: #define SIGTYP int
        !           362: #endif /* SIGTYP */
        !           363: #endif /* SIG_I */
        !           364: 
        !           365: #ifdef SIG_V
        !           366: #define SIGRETURN return
        !           367: #ifndef SIGTYP
        !           368: #define SIGTYP void
        !           369: #endif /* SIGTYP */
        !           370: #endif /* SIG_V */
        !           371: 
        !           372: #ifndef SIGTYP
        !           373: #define SIGTYP int
        !           374: #endif /* SIGTYP */
        !           375: 
        !           376: #ifndef SIGRETURN
        !           377: #define SIGRETURN return(0)
        !           378: #endif /* SIGRETURN */
        !           379: 
        !           380: /* We want all characters to be unsigned if the compiler supports it */
        !           381: 
        !           382: #ifdef PROVX1
        !           383: typedef char CHAR;
        !           384: /* typedef long LONG; */
        !           385: typedef int void;
        !           386: #else
        !           387: #ifdef MINIX
        !           388: typedef unsigned char CHAR;
        !           389: #else
        !           390: #ifdef V7
        !           391: typedef char CHAR;
        !           392: #else
        !           393: #ifdef C70
        !           394: typedef char CHAR;
        !           395: /* typedef long LONG; */
        !           396: #else
        !           397: #ifdef BSD29
        !           398: typedef char CHAR;
        !           399: /* typedef long LONG; */
        !           400: #else
        !           401: #ifdef CHAR
        !           402: #undef CHAR
        !           403: #endif /* CHAR */
        !           404: typedef unsigned char CHAR;
        !           405: #endif /* BSD29 */
        !           406: #endif /* C70 */
        !           407: #endif /* V7 */
        !           408: #endif /* MINIX */
        !           409: #endif /* PROVX1 */
        !           410: 
        !           411: /*
        !           412:  Debug and transaction logging is included automatically unless you define
        !           413:  NODEBUG or NOTLOG.  Do this if you want to save the space and overhead.
        !           414:  (Note, in version 4F these definitions changed from "{}" to the null string
        !           415:  to avoid problems with semicolons after braces, as in: "if (x) tlog(this);
        !           416:  else tlog(that);"
        !           417: */
        !           418: #ifndef NODEBUG
        !           419: #ifndef DEBUG
        !           420: #define DEBUG
        !           421: #endif /* DEBUG */
        !           422: #endif /* NODEBUG */
        !           423: 
        !           424: #ifndef NOTLOG
        !           425: #ifndef TLOG
        !           426: #define TLOG
        !           427: #endif /* TLOG */
        !           428: #endif /* NOTLOG */
        !           429: 
        !           430: /* debug() macro style selection. */
        !           431: 
        !           432: #ifdef MAC
        !           433: #ifndef IFDEBUG
        !           434: #define IFDEBUG
        !           435: #endif /* IFDEBUG */
        !           436: #endif /* MAC */
        !           437: 
        !           438: #ifndef DEBUG
        !           439: /* Compile all the debug() statements away.  Saves a lot of space and time. */
        !           440: #define debug(a,b,c,d)
        !           441: #else
        !           442: #ifndef CKCMAI
        !           443: /* Debugging included.  Declare debug log flag in main program only. */
        !           444: extern int deblog;
        !           445: #endif /* CKCMAI */
        !           446: /* Now define the debug() macro. */
        !           447: #ifdef IFDEBUG
        !           448: /* Use this form to avoid function calls: */
        !           449: #define debug(a,b,c,d) if (deblog) dodebug(a,b,(char *)c,(long)d)
        !           450: #else
        !           451: /* Use this form to save space: */
        !           452: #define debug(a,b,c,d) dodebug(a,b,(char *)c,(long)d)
        !           453: #endif /* MAC */
        !           454: _PROTOTYP(int dodebug,(int, char *, char *, long));
        !           455: #endif /* DEBUG */
        !           456: 
        !           457: #ifndef TLOG
        !           458: #define tlog(a,b,c,d)
        !           459: #else
        !           460: _PROTOTYP(VOID tlog,(int, char *, char *, long));
        !           461: #endif /* TLOG */
        !           462: 
        !           463: /* Formats for debug() and tlog() */
        !           464: 
        !           465: #define F000 0
        !           466: #define F001 1
        !           467: #define F010 2
        !           468: #define F011 3
        !           469: #define F100 4
        !           470: #define F101 5
        !           471: #define F110 6
        !           472: #define F111 7
        !           473: 
        !           474: /* Kermit feature selection */
        !           475: 
        !           476: #ifdef MAC                             /* For Macintosh, no escape */
        !           477: #define NOPUSH                         /* to operating system */
        !           478: #endif /* MAC */
        !           479: 
        !           480: #ifdef UNIX
        !           481: #ifndef NOPARSEN
        !           482: #define PARSENSE                       /* Automatic parity detection */
        !           483: #endif /* NOPARSEN */
        !           484: #endif /* UNIX */                      /* for Unix */
        !           485: 
        !           486: #ifdef VMS                             /* ... and VMS */
        !           487: #ifndef NOPARSEN
        !           488: #define PARSENSE
        !           489: #endif /* NOPARSEN */
        !           490: #endif /* VMS */
        !           491: 
        !           492: #ifdef VMS                             /* Use dynamic memory allocation */
        !           493: #define DYNAMIC                                /* in VMS version. */
        !           494: #endif /* VMS */
        !           495: 
        !           496: /* Carrier treatment */
        !           497: /* These are defined here because they are shared by the system dependent */
        !           498: /* and the system independent modules. */
        !           499: 
        !           500: #define  CAR_OFF 0     /* On: heed carrier always, except during DIAL. */
        !           501: #define  CAR_ON  1      /* Off: ignore carrier always. */
        !           502: #define  CAR_AUT 2      /* Auto: heed carrier, but only if line is declared */
        !           503:                        /* to be a modem line, and only during CONNECT. */
        !           504: 
        !           505: /*
        !           506:  Systems where we can expand tilde at the beginning of file or directory names
        !           507: */
        !           508: #ifdef POSIX
        !           509: #define DTILDE
        !           510: #endif
        !           511: #ifdef BSD4
        !           512: #define DTILDE
        !           513: #endif
        !           514: #ifdef ATTSV
        !           515: #define DTILDE
        !           516: #endif
        !           517: #ifdef OSK
        !           518: #define DTILDE
        !           519: #endif
        !           520: 
        !           521: /* Line delimiter for text files */
        !           522: 
        !           523: /*
        !           524:  If the system uses a single character for text file line delimitation,
        !           525:  define NLCHAR to the value of that character.  For text files, that
        !           526:  character will be converted to CRLF upon output, and CRLF will be converted
        !           527:  to that character on input during text-mode (default) packet operations.
        !           528: */
        !           529: #ifdef MAC                              /* Macintosh */
        !           530: #define NLCHAR 015
        !           531: #else
        !           532: #ifdef OSK                             /* OS-9/68K */
        !           533: #define NLCHAR 015
        !           534: #else                                   /* All Unix-like systems */
        !           535: #define NLCHAR 012
        !           536: #endif /* OSK */
        !           537: #endif /* MAC */
        !           538: 
        !           539: /*
        !           540:  At this point, if there's a system that uses ordinary CRLF line
        !           541:  delimitation AND the C compiler actually returns both the CR and
        !           542:  the LF when doing input from a file, then #undef NLCHAR.
        !           543: */
        !           544: #ifdef OS2                             /* OS/2 */
        !           545: #undef NLCHAR
        !           546: #endif /* OS2 */
        !           547: 
        !           548: #ifdef GEMDOS                          /* Atari ST */
        !           549: #undef NLCHAR
        !           550: #endif /* GEMDOS */
        !           551: 
        !           552: /*
        !           553:   VMS file formats are so complicated we need to do all the conversion 
        !           554:   work in the CKVFIO module, so we tell the rest of C-Kermit not to fiddle
        !           555:   with the bytes.
        !           556: */
        !           557: 
        !           558: #ifdef vms
        !           559: #undef NLCHAR
        !           560: #endif /* vms */
        !           561: 
        !           562: /* The device name of a job's controlling terminal */
        !           563: /* Special for VMS, same for all Unixes (?), not used by Macintosh */
        !           564: 
        !           565: #ifdef vms
        !           566: #define CTTNAM "TT:"
        !           567: #else
        !           568: #ifdef datageneral
        !           569: #define CTTNAM "@output"
        !           570: #else
        !           571: #ifdef OSK
        !           572: extern char myttystr[];
        !           573: #define CTTNAM myttystr
        !           574: #else
        !           575: #ifdef OS2
        !           576: #define CTTNAM "con"
        !           577: #else
        !           578: #ifdef UNIX
        !           579: #define CTTNAM "/dev/tty"
        !           580: #else
        !           581: #ifdef GEMDOS
        !           582: #define CTTNAM "aux:"
        !           583: #else /* Anyone else... */
        !           584: #define CTTNAM "stdout"                        /* This is a kludge used by Mac */
        !           585: #endif /* GEMDOS */
        !           586: #endif /* UNIX */
        !           587: #endif /* OS2 */
        !           588: #endif /* OSK */
        !           589: #endif /* datageneral */
        !           590: #endif /* vms */
        !           591: 
        !           592: #ifdef SUNS4S5
        !           593: #define tolower _tolower
        !           594: #define toupper _toupper
        !           595: #endif /* SUNS4S5 */
        !           596: 
        !           597: /* Error number */
        !           598: 
        !           599: #ifndef VMS
        !           600: #ifndef OS2
        !           601: /*
        !           602:   The following declaration causes problems for VMS and OS/2, in which
        !           603:   errno is an "extern volatile int noshare"...
        !           604: */
        !           605: extern int errno;                      /* Needed by most modules. */
        !           606: #endif /* OS2 */
        !           607: #endif /* VMS */
        !           608: 
        !           609: /* File System Defaults */
        !           610: 
        !           611: #ifdef VMS
        !           612: #define DBLKSIZ 512
        !           613: #define DLRECL 512
        !           614: #else
        !           615: #define DBLKSIZ 0
        !           616: #define DLRECL 0
        !           617: #endif
        !           618: 
        !           619: /* Program return codes for DECUS C and UNIX (VMS uses UNIX codes) */
        !           620: 
        !           621: #ifdef decus
        !           622: #define GOOD_EXIT   IO_NORMAL
        !           623: #define BAD_EXIT    IO_ERROR
        !           624: #else
        !           625: #define GOOD_EXIT   0
        !           626: #define BAD_EXIT    1
        !           627: #endif /* decus */
        !           628: 
        !           629: /* Special hack for Fortune, which doesn't have <sys/file.h>... */
        !           630: 
        !           631: #ifdef FT18
        !           632: #define FREAD 0x01
        !           633: #define FWRITE 0x10
        !           634: #endif /* FT18 */
        !           635: 
        !           636: /* special hack for os9/68k */
        !           637: #ifdef OSK
        !           638: #define SIGARB 31                      /* Only signals smaller than 32 */
        !           639: #define SIGALRM 30                     /* may always cancel i/o */
        !           640: SIGTYP (*signal())();
        !           641: #endif
        !           642: 
        !           643: #ifdef OS2
        !           644: #ifdef putchar                  /* MSC 5.1 simply uses a macro which causes */
        !           645: #undef putchar                  /* no problems. */
        !           646: #endif /* putchar */
        !           647: #endif /* OS2 */
        !           648: 
        !           649: #ifdef MINIX
        !           650: #ifdef putchar
        !           651: #undef putchar
        !           652: #endif /* putchar */
        !           653: #define putchar(c) {putc(c,stdout);fflush(stdout);}
        !           654: #endif /* MINIX */
        !           655: 
        !           656: /* Escape/quote character used by the command parser */
        !           657: 
        !           658: #define CMDQ '\\'
        !           659: 
        !           660: /* Symbols for RS-232 modem signals */
        !           661: 
        !           662: #define KM_FG    1                     /* Frame ground */
        !           663: #define KM_TXD   2                     /* Transmit */
        !           664: #define KM_RXD   3                     /* Receive */
        !           665: #define KM_RTS   4                     /* Request to Send */
        !           666: #define KM_CTS   5                     /* Clear to Send */
        !           667: #define KM_DSR   6                     /* Data Set Ready */
        !           668: #define KM_SG    7                     /* Signal ground */
        !           669: #define KM_DCD   8                     /* Carrier Detect */
        !           670: #define KM_DTR  20                     /* Data Terminal Ready */
        !           671: #define KM_RI   22                     /* Ring Indication */
        !           672: 
        !           673: /* Bit mask values for modem signals */
        !           674: 
        !           675: #define BM_CTS   0001                  /* Clear to send       (From DCE) */
        !           676: #define BM_DSR   0002                  /* Dataset ready       (From DCE) */
        !           677: #define BM_DCD   0004                  /* Carrier             (From DCE) */
        !           678: #define BM_RNG   0010                  /* Ring Indicator      (From DCE) */
        !           679: #define BM_DTR   0020                  /* Data Terminal Ready (From DTE) */
        !           680: #define BM_RTS   0040                  /* Request to Send     (From DTE) */
        !           681: 
        !           682: /* Codes for full duplex flow control */
        !           683: 
        !           684: #define FLO_NONE 0                     /* None */
        !           685: #define FLO_XONX 1                     /* Xon/Xoff (soft) */
        !           686: #define FLO_RTSC 2                     /* RTS/CTS (hard) */
        !           687: #define FLO_HARD FLO_RTSC              /* (synonym) */
        !           688: #define FLO_DTRC 3                     /* DTR/CD (hard) */
        !           689: #define FLO_ETXA 4                     /* ETX/ACK (soft) */
        !           690: #define FLO_STRG 5                     /* String-based (soft) */
        !           691: 
        !           692: /* And finally... */
        !           693: 
        !           694: #ifdef COMMENT                         /* Make sure this is NOT defined! */
        !           695: #undef COMMENT
        !           696: #endif /* COMMENT */
        !           697: 
        !           698: /* Structure definitions for Kermit file attributes */
        !           699: /* All strings come as pointer and length combinations */
        !           700: /* Empty string (or for numeric variables, -1) = unused attribute. */
        !           701: 
        !           702: struct zstr {             /* string format */
        !           703:     int len;             /* length */
        !           704:     char *val;            /* value */
        !           705: };
        !           706: struct zattr {            /* Kermit File Attribute structure */
        !           707:     long lengthk;         /* (!) file length in K */
        !           708:     struct zstr type;     /* (") file type (text or binary) */
        !           709:     struct zstr date;     /* (#) file creation date yyyymmdd[ hh:mm[:ss]] */
        !           710:     struct zstr creator;  /* ($) file creator id */
        !           711:     struct zstr account;  /* (%) file account */
        !           712:     struct zstr area;     /* (&) area (e.g. directory) for file */
        !           713:     struct zstr passwd;   /* (') password for area */
        !           714:     long blksize;         /* (() file blocksize */
        !           715:     struct zstr access;   /* ()) file access: new, supersede, append, warn */
        !           716:     struct zstr encoding; /* (*) encoding (transfer syntax) */
        !           717:     struct zstr disp;     /* (+) disposition (mail, message, print, etc) */
        !           718:     struct zstr lprotect; /* (,) protection (local syntax) */
        !           719:     struct zstr gprotect; /* (-) protection (generic syntax) */
        !           720:     struct zstr systemid; /* (.) ID for system of origin */
        !           721:     struct zstr recfm;    /* (/) record format */
        !           722:     struct zstr sysparam; /* (0) system-dependent parameter string */
        !           723:     long length;          /* (1) exact length on system of origin */
        !           724:     struct zstr charset;  /* (2) transfer syntax character set */
        !           725:     struct zstr reply;    /* This goes last, used for attribute reply */
        !           726: };
        !           727: 
        !           728: /* Kermit file information structure */
        !           729: 
        !           730: struct filinfo {
        !           731:   int bs;                              /* Blocksize */
        !           732:   int cs;                              /* Character set */
        !           733:   long rl;                             /* Record length */
        !           734:   int org;                             /* Organization */
        !           735:   int fmt;                             /* Record format */
        !           736:   int cc;                              /* Carriage control */
        !           737:   int typ;                             /* Type (text/binary) */
        !           738:   int dsp;                             /* Disposition */
        !           739:   char *os_specific;                   /* OS-specific attributes */
        !           740:   unsigned int lblopts;                        /* LABELED FILE options bitmask */
        !           741: };
        !           742: 
        !           743: /* VMS values for LABELED FILE options bitmask */
        !           744: 
        !           745: #ifdef VMS
        !           746: #define LBL_NAM  1                     /* Ignore incoming name if set */
        !           747: #define LBL_PTH  2                     /* Use complete path if set */
        !           748: #define LBL_ACL  4                     /* Preserve ACLs if set */
        !           749: #define LBL_BCK  8                     /* Preserve backup date if set */
        !           750: #define LBL_OWN 16                     /* Preserve ownership if set */
        !           751: #endif /* VMS */
        !           752: 
        !           753: /*
        !           754:   Data types.  First the header file for data types so we can pick up the
        !           755:   types used for pids, uids, and gids.  Override this section by putting
        !           756:   -DCKTYP_H=xxx on the command line to specify the header file where your
        !           757:   system defines these types.
        !           758: */
        !           759: #ifdef OSK                             /* OS-9 */
        !           760: #include <types.h>
        !           761: #else                                  /* General case, not OS-9 */
        !           762: #ifndef CKTYP_H
        !           763: #ifndef VMS
        !           764: #ifndef MAC
        !           765: #ifndef AMIGA
        !           766: #define CKTYP_H <sys/types.h>
        !           767: #endif /* AMIGA */
        !           768: #endif /* MAC */
        !           769: #endif /* VMS */
        !           770: #endif /* CKTYP_H */
        !           771: 
        !           772: #ifdef GEMDOS
        !           773: #undef CKTYP_H
        !           774: #include <types.h>
        !           775: #endif /* GEMDOS */
        !           776: 
        !           777: #ifdef CKTYP_H                         /* Include it. */
        !           778: #ifdef COHERENT                                /* Except for COHERENT */
        !           779: #include <sys/types.h>
        !           780: #else
        !           781: #include CKTYP_H
        !           782: #endif /* COHERENT */
        !           783: #endif /* CKTYP_H */
        !           784: 
        !           785: #endif /* OSK */                       /* End of types.h section */
        !           786: 
        !           787: /*
        !           788:   Data type for pids.  If your system uses a different type, put something
        !           789:   like -DPID_T=pid_t on command line, or override here.
        !           790: */
        !           791: #ifndef PID_T
        !           792: #define PID_T int
        !           793: #endif /* PID_T */
        !           794: /*
        !           795:   Data types for uids and gids.  Same deal as for pids.
        !           796:   Wouldn't be nice if there was a preprocessor test to find out if a
        !           797:   typedef existed?
        !           798: */
        !           799: #ifdef VMS
        !           800: /* Not used in VMS so who cares */
        !           801: #define UID_T int
        !           802: #define GID_T int
        !           803: #endif /* VMS */
        !           804: 
        !           805: #ifdef POSIX
        !           806: /* Or would it be better (or worse?) to use _POSIX_SOURCE here? */
        !           807: #ifndef UID_T
        !           808: #define UID_T uid_t
        !           809: #endif /* UID_T */
        !           810: #ifndef GID_T
        !           811: #define GID_T gid_t
        !           812: #endif /* GID_T */
        !           813: #else /* Not POSIX */
        !           814: #ifdef SVR4
        !           815: /* SVR4 and later have uid_t and gid_t. */
        !           816: /* SVR3 and earlier use int, or unsigned short, or.... */
        !           817: #ifndef UID_T
        !           818: #define UID_T uid_t
        !           819: #endif /* UID_T */
        !           820: #ifndef GID_T
        !           821: #define GID_T gid_t
        !           822: #endif /* GID_T */
        !           823: #else /* Not SVR4 */
        !           824: #ifdef BSD43
        !           825: #ifndef UID_T
        !           826: #define UID_T uid_t
        !           827: #endif /* UID_T */
        !           828: #ifndef GID_T
        !           829: #define GID_T gid_t
        !           830: #endif /* GID_T */
        !           831: #else /* Not BSD43 */
        !           832: /* Default these to int for older UNIX versions */
        !           833: #ifndef UID_T
        !           834: #define UID_T int
        !           835: #endif /* UID_T */
        !           836: #ifndef GID_T
        !           837: #define GID_T int
        !           838: #endif /* GID_T */
        !           839: #endif /* BSD43 */
        !           840: #endif /* SVR4  */
        !           841: #endif /* POSIX */
        !           842: 
        !           843: /* 
        !           844:   getpwuid() arg type, which is not necessarily the same as UID_T,
        !           845:   e.g. in SCO UNIX SVR3, it's int.
        !           846: */
        !           847: #ifndef PWID_T
        !           848: #define PWID_T UID_T
        !           849: #endif /* PWID_T */
        !           850: 
        !           851: #ifdef NEXT                            /* Argument for wait() */
        !           852: #include <sys/wait.h>
        !           853: typedef union wait WAIT_T;
        !           854: #else
        !           855: #ifdef POSIX
        !           856: #include <sys/wait.h>
        !           857: #define WAIT_T pid_t
        !           858: #else
        !           859: typedef int WAIT_T;
        !           860: #endif /* POSIX */
        !           861: #endif /* NEXT */
        !           862: 
        !           863: /* Forward declarations of system-dependent functions callable from all */
        !           864: /* C-Kermit modules. */
        !           865: 
        !           866: /* File-related functions from system-dependent file i/o module */
        !           867: 
        !           868: _PROTOTYP( int zkself, (void) );
        !           869: _PROTOTYP( int zopeni, (int, char *) );
        !           870: _PROTOTYP( int zopeno, (int, char *, struct zattr *, struct filinfo *) );
        !           871: _PROTOTYP( int zclose, (int) );
        !           872: #ifndef MAC
        !           873: _PROTOTYP( int zchin, (int, int *) );
        !           874: #endif /* MAC */
        !           875: _PROTOTYP( int zsinl, (int, char *, int) );
        !           876: _PROTOTYP( int zinfill, (void) );
        !           877: _PROTOTYP( int zsout, (int, char*) );
        !           878: _PROTOTYP( int zsoutl, (int, char*) );
        !           879: _PROTOTYP( int zsoutx, (int, char*, int) );
        !           880: _PROTOTYP( int zchout, (int, char) );
        !           881: _PROTOTYP( int zoutdump, (void) );
        !           882: _PROTOTYP( int zsyscmd, (char *) );
        !           883: _PROTOTYP( int zshcmd, (char *) );
        !           884: _PROTOTYP( int chkfn, (int) );
        !           885: _PROTOTYP( long zchki, (char *) );
        !           886: _PROTOTYP( int iswild, (char *) );
        !           887: _PROTOTYP( int zchko, (char *) );
        !           888: _PROTOTYP( int zdelet, (char *) );
        !           889: _PROTOTYP( VOID zrtol, (char *,char *) );
        !           890: _PROTOTYP( VOID zltor, (char *,char *) );
        !           891: _PROTOTYP( VOID zstrip, (char *,char **) );
        !           892: _PROTOTYP( int zchdir, (char *) );
        !           893: _PROTOTYP( char * zhome, (void) );
        !           894: _PROTOTYP( char * zgtdir, (void) );
        !           895: _PROTOTYP( int zxcmd, (int, char *) );
        !           896: #ifndef MAC
        !           897: _PROTOTYP( int zclosf, (int) );
        !           898: #endif /* MAC */
        !           899: _PROTOTYP( int zxpand, (char *) );
        !           900: _PROTOTYP( int znext, (char *) );
        !           901: _PROTOTYP( int zchkspa, (char *, long) );
        !           902: _PROTOTYP( VOID znewn, (char *, char **) );
        !           903: _PROTOTYP( int zrename, (char *, char *) );
        !           904: _PROTOTYP( int zsattr, (struct zattr *) );
        !           905: _PROTOTYP( int zfree, (char *) );
        !           906: _PROTOTYP( char * zfcdat, (char *) );
        !           907: _PROTOTYP( int zstime, (char *, struct zattr *, int) );
        !           908: _PROTOTYP( int zmail, (char *, char *) ); 
        !           909: _PROTOTYP( int zprint, (char *, char *) ); 
        !           910: _PROTOTYP( char * tilde_expand, (char *) ); 
        !           911: 
        !           912: /* Functions from system-dependent terminal i/o module */
        !           913: 
        !           914: _PROTOTYP( int ttopen, (char *, int *, int, int) );  /* tty functions */
        !           915: #ifndef MAC
        !           916: _PROTOTYP( int ttclos, (int) );
        !           917: #endif /* MAC */
        !           918: _PROTOTYP( int tthang, (void) );
        !           919: _PROTOTYP( int ttres, (void) );
        !           920: _PROTOTYP( int ttpkt, (long, int, int) );
        !           921: #ifndef MAC
        !           922: _PROTOTYP( int ttvt, (long, int) );
        !           923: #endif /* MAC */
        !           924: _PROTOTYP( int ttsspd, (int) );
        !           925: _PROTOTYP( long ttgspd, (void) );
        !           926: _PROTOTYP( int ttflui, (void) );
        !           927: _PROTOTYP( int ttfluo, (void) );
        !           928: _PROTOTYP( int ttchk, (void) );
        !           929: _PROTOTYP( int ttxin, (int, CHAR *) );
        !           930: _PROTOTYP( int ttol, (CHAR *, int) );
        !           931: _PROTOTYP( int ttoc, (char) );
        !           932: _PROTOTYP( int ttinc, (int) );
        !           933: _PROTOTYP( int ttscarr, (int) );
        !           934: _PROTOTYP( int ttgmdm, (void) );
        !           935: _PROTOTYP( int ttsndb, (void) );
        !           936: _PROTOTYP( int ttsndlb, (void) );
        !           937: #ifdef PARSENSE
        !           938: _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
        !           939: #else
        !           940: _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR) );
        !           941: #endif /* PARSENSE */
        !           942: 
        !           943: /* Console functions */
        !           944: 
        !           945: _PROTOTYP( int congm, (void) );
        !           946: #ifdef COMMENT
        !           947: _PROTOTYP( VOID conint, (SIGTYP (*)(int, int), SIGTYP (*)(int, int)) );
        !           948: #else
        !           949: _PROTOTYP( VOID conint, (SIGTYP (*)(int), SIGTYP (*)(int)) );
        !           950: #endif
        !           951: _PROTOTYP( VOID connoi, (void) );
        !           952: _PROTOTYP( int concb, (char) );
        !           953: _PROTOTYP( int conbin, (char) );
        !           954: _PROTOTYP( int conres, (void) );
        !           955: _PROTOTYP( int conoc, (char) );
        !           956: _PROTOTYP( int conxo, (int, char *) );
        !           957: _PROTOTYP( int conol, (char *) );
        !           958: _PROTOTYP( int conola, (char **) );
        !           959: _PROTOTYP( int conoll, (char *) );
        !           960: _PROTOTYP( int conchk, (void) );
        !           961: _PROTOTYP( int coninc, (int) );
        !           962: _PROTOTYP( int psuspend, (int) );
        !           963: _PROTOTYP( int priv_ini, (void) );
        !           964: _PROTOTYP( int priv_on, (void) );
        !           965: _PROTOTYP( int priv_off, (void) );
        !           966: _PROTOTYP( int priv_can, (void) );
        !           967: _PROTOTYP( int priv_chk, (void) );
        !           968: _PROTOTYP( int priv_opn, (char *, int) );
        !           969: 
        !           970: _PROTOTYP( int sysinit, (void) );      /* Misc Kermit functions */
        !           971: _PROTOTYP( int syscleanup, (void) );
        !           972: _PROTOTYP( int msleep, (int) );
        !           973: _PROTOTYP( VOID rtimer, (void) );
        !           974: _PROTOTYP( int gtimer, (void) );
        !           975: _PROTOTYP( VOID ttimoff, (void) );
        !           976: _PROTOTYP( VOID ztime, (char **) );
        !           977: _PROTOTYP( int parchk, (CHAR *, CHAR, int) );
        !           978: _PROTOTYP( VOID doexit, (int, int) );
        !           979: _PROTOTYP( int askmore, (void) );
        !           980: _PROTOTYP( VOID fatal, (char *) );
        !           981: 
        !           982: /* Key mapping support */
        !           983: 
        !           984: #ifdef NOICP
        !           985: #ifndef NOSETKEY
        !           986: #define NOSETKEY
        !           987: #endif /* NOSETKEY */
        !           988: #endif /* NOICP */
        !           989: 
        !           990: _PROTOTYP( int congks, (int) );
        !           991: #ifndef NOSETKEY
        !           992: #ifdef OS2
        !           993: #define KMSIZE 768
        !           994: typedef int KEY;
        !           995: typedef CHAR *MACRO;
        !           996: extern int wideresult;
        !           997: #else /* Not OS2 */
        !           998: /*
        !           999:   Catch-all for systems where we don't know how to read keyboard scan
        !          1000:   codes > 255.  Note: CHAR (i.e. unsigned char) is very important here.
        !          1001: */
        !          1002: #define KMSIZE 256
        !          1003: typedef CHAR KEY;
        !          1004: typedef CHAR * MACRO;
        !          1005: #define congks coninc
        !          1006: #endif /* OS2 */
        !          1007: #endif /* NOSETKEY */
        !          1008: 
        !          1009: /*
        !          1010:   Function prototypes for system and library functions.
        !          1011: */
        !          1012: #ifdef _POSIX_SOURCE
        !          1013: #ifndef VMS
        !          1014: #ifndef MAC
        !          1015: #define CK_ANSILIBS
        !          1016: #endif /* MAC */
        !          1017: #endif /* VMS */
        !          1018: #endif /* _POSIX_SOURCE */
        !          1019: 
        !          1020: #ifdef NEXT
        !          1021: #define CK_ANSILIBS
        !          1022: #endif /* NEXT */
        !          1023: 
        !          1024: #ifdef SVR4
        !          1025: #define CK_ANSILIBS
        !          1026: #endif /* SVR4 */
        !          1027: 
        !          1028: #ifdef OS2
        !          1029: #define CK_ANSILIBS
        !          1030: #include <direct.h>
        !          1031: #include <io.h>
        !          1032: _PROTOTYP( int sleep, (int) );
        !          1033: _PROTOTYP( unsigned alarm, (unsigned) );
        !          1034: _PROTOTYP( int zchdsk, (char) );
        !          1035: _PROTOTYP( int conincraw, (int) );
        !          1036: _PROTOTYP( ttiscom, (int f) );
        !          1037: #define SIGALRM SIGUSR1
        !          1038: #endif /* OS2 */
        !          1039: 
        !          1040: #ifdef CK_ANSILIBS
        !          1041: /*
        !          1042:   String library functions.
        !          1043:   For ANSI C, get prototypes from <string.h>.
        !          1044:   Otherwise, skip the prototypes.
        !          1045: */
        !          1046: #include <string.h>
        !          1047: 
        !          1048: /*
        !          1049:   Prototypes for other commonly used library functions, such as
        !          1050:   malloc, free, getenv, atol, atoi, and exit.  Otherwise, no prototypes.
        !          1051: */
        !          1052: #include <stdlib.h>
        !          1053: #ifdef DIAB /* DIAB DS90 splits <stdlib.h> into two separate files... */
        !          1054: #include <commonC.h>
        !          1055: #include <sys/wait.h>
        !          1056: extern void exit(int status);
        !          1057: extern void _exit(int status);
        !          1058: extern int uname(struct utsname *name);
        !          1059: extern int chmod(char *path, int mode);
        !          1060: extern int ioctl(int fildes, int request, ...);
        !          1061: extern int rdchk(int ttyfd);
        !          1062: extern int nap(int m);
        !          1063: extern int getppid(void);
        !          1064: extern int _filbuf(FILE *stream);
        !          1065: extern int _flsbuf(char c,FILE *stream);
        !          1066: #endif /* DIAB */
        !          1067: 
        !          1068: /*
        !          1069:   Prototypes for UNIX functions like access, alarm, chdir, sleep, fork,
        !          1070:   and pause.  Otherwise, no prototypes.
        !          1071: */
        !          1072: #ifdef NEXT
        !          1073: #include <libc.h>
        !          1074: #else
        !          1075: #ifndef AMIGA
        !          1076: #ifndef OS2
        !          1077: #include <unistd.h>
        !          1078: #endif /* OS2 */
        !          1079: #endif /* AMIGA */
        !          1080: #endif /* NEXT */
        !          1081: 
        !          1082: #else /* Not ANSI libs... */
        !          1083: 
        !          1084: #ifdef MAC
        !          1085: #include <String.h>
        !          1086: #include <StdLib.h>
        !          1087: #endif /* MAC */
        !          1088: 
        !          1089: #ifdef SUNOS41
        !          1090: #include <unistd.h>
        !          1091: #include <stdlib.h>
        !          1092: #else
        !          1093: /*
        !          1094:   It is essential that these are declared correctly!
        !          1095: */
        !          1096: _PROTOTYP( char * malloc, (unsigned int) );
        !          1097: _PROTOTYP( char * getenv, (char *) );
        !          1098: _PROTOTYP( long atol, (char *) );
        !          1099: #endif /* SUNOS4 */
        !          1100: #endif /* CK_ANSILIBS */
        !          1101: 
        !          1102: #ifndef NULL                           /* In case NULL is still not defined */
        !          1103: #define NULL 0L
        !          1104: /* or #define NULL 0 */
        !          1105: /* or #define NULL ((char *) 0) */
        !          1106: /* or #define NULL ((void *) 0) */
        !          1107: #endif /* NULL */
        !          1108: 
        !          1109: /* Funny names for library functions department... */
        !          1110: 
        !          1111: #ifdef ZILOG
        !          1112: #define setjmp setret
        !          1113: #define longjmp longret
        !          1114: #define jmp_buf ret_buf
        !          1115: #define getcwd curdir
        !          1116: #endif /* ZILOG */
        !          1117: 
        !          1118: #endif /* CKCDEB_H */
        !          1119: 
        !          1120: /* End of ckcdeb.h */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.