Annotation of sbbs/sbbs2/sdk/xsdk.h, revision 1.1

1.1     ! root        1: /* XSDK.H */
        !             2: 
        !             3: #ifndef _XSDK_H
        !             4: #define _XSDK_H
        !             5: 
        !             6: /****************************************************************************/
        !             7: /*                     Synchronet External Program Software Development Kit                    */
        !             8: /*                                                     1993 Digital Dynamics                                                   */
        !             9: /****************************************************************************/
        !            10: 
        !            11: /****************************************************************************/
        !            12: /* This source code file is public domain and may be modified, compiled        */
        !            13: /* distributed, or used in any way, in part or whole for any purposes          */
        !            14: /* without the consent or notification of Digital Dynamics.                            */
        !            15: /*                                                                                                                                                     */
        !            16: /* We only request that you display to the user, at some point, in your        */
        !            17: /* program the character "XSDK" and the version number.                     */
        !            18: /* example: bprintf("XSDK v%s",xsdk_ver);                                   */
        !            19: /****************************************************************************/
        !            20: 
        !            21: /****************************************************************************/
        !            22: /* The source code for two external programs developed by Digital Dynamics     */
        !            23: /* using XSDK (Synchronet Blackjack [SBJ] and Synchronet BBS List [SBL])       */
        !            24: /* are available to the public domain as examples of how to implement the      */
        !            25: /* functions and variables included in this software development kit.          */
        !            26: /****************************************************************************/
        !            27: 
        !            28: 
        !            29: /****************************************************/
        !            30: /* For use with Borland/Turbo C and C++ compilers.     */
        !            31: /* Tabstop set to 4.                                                           */
        !            32: /****************************************************/
        !            33: 
        !            34: /*********************************************/
        !            35: /* Standard Borland/Turbo C/C++ Header Files */
        !            36: /*********************************************/
        !            37: #include <io.h>
        !            38: #include <dos.h>
        !            39: #include <bios.h>
        !            40: #include <time.h>
        !            41: #include <ctype.h>
        !            42: #include <stdio.h>
        !            43: #include <share.h>
        !            44: #include <conio.h>
        !            45: #include <errno.h>
        !            46: #include <fcntl.h>
        !            47: #include <string.h>
        !            48: #include <stdlib.h>
        !            49: #include <stdarg.h>
        !            50: #include <malloc.h>
        !            51: #include <sys/stat.h>
        !            52: #include <sys/types.h>
        !            53: 
        !            54: #ifdef __TURBOC__
        !            55:     #include <dir.h>
        !            56: #endif
        !            57: 
        !            58: #ifdef __WATCOMC__
        !            59:        #include <graph.h>
        !            60: #endif
        !            61: 
        !            62: #define GLOBAL extern  /* turns XSDKVAR.C into a header file */
        !            63: #include "xsdkvars.c"
        !            64: 
        !            65: #ifdef __cplusplus
        !            66:        extern "C" {
        !            67: #endif
        !            68: 
        !            69: extern char *xsdk_ver; /* XSDK version number */
        !            70: extern int mswtyp;             /* MSwait type */
        !            71: 
        !            72: /***********************/
        !            73: /* Function Prototypes */
        !            74: /***********************/
        !            75: 
        !            76: /* Initialize Data
        !            77:        - Reads XTRN.DAT and initializes variables */
        !            78: void initdata(void);
        !            79: 
        !            80: /* Get Terminal Type
        !            81:        - Detects RIP and WIP terminal compatibility */
        !            82: void get_term(void);
        !            83: 
        !            84: /* BBS Print String
        !            85:        - Displays a string locally and remotely (with Ctrl-A codes) */
        !            86: void bputs(char *str);
        !            87: 
        !            88: /* Raw Print String
        !            89:        - Oututs a string locally and remotely (verbatim) */
        !            90: void rputs(char *str);
        !            91: 
        !            92: /* BBS Print Formatted
        !            93:        - Displays a formatted string locally and remotely (with Ctrl-A codes)
        !            94:        - printf() equivalent */
        !            95: int  bprintf(char *fmt, ...);
        !            96: 
        !            97: /* Raw Print Formated
        !            98:        - Displays a formatted string locally and remotely (verbatim)
        !            99:        - printf() equivalent */
        !           100: int  rprintf(char *fmt, ...);
        !           101: 
        !           102: /* BBS String Length
        !           103:        - Returns length of string, excluding Ctrl-A codes */
        !           104: int  bstrlen(uchar *str);
        !           105: 
        !           106: /* Output character
        !           107:        - Displays a single character */
        !           108: void outchar(char ch);
        !           109: 
        !           110: /* Mnemonics
        !           111:        - Display a string expanding ~letter combinations to command keys
        !           112:        - Automatically colorizes mnemonic letters or places them in parenthesis
        !           113:          for non-ANSI users */
        !           114: void mnemonics(char *str);
        !           115: 
        !           116: /* Pause prompt
        !           117:        - Displays [Hit a key] and waits for the user to hit a key */
        !           118: void pause(void);
        !           119: 
        !           120: /* Yes/no Question
        !           121:        - Displays a string with (Y/n) ? appended and waits for the user to hit
        !           122:          'Y', 'N' or enter
        !           123:        - Returns 1 if the user hit 'Y' or enter
        !           124:        - Automatic colorization */
        !           125: char yesno(char *str);
        !           126: 
        !           127: /* No/yes Question
        !           128:        - Displays a string with (y/N) ? appended and waits for the user to hit
        !           129:          'Y', 'N' or enter
        !           130:        - Returns 1 if the user hit 'N' or enter */
        !           131: char noyes(char *str);
        !           132: 
        !           133: /* Inbound Keystroke
        !           134:        - If the local or remote user has struck a key, this function returns the
        !           135:          key, otherwise it returns 0
        !           136:        - Does not wait for a keystroke */
        !           137: char inkey(int mode);
        !           138: 
        !           139: /* Get a Key
        !           140:        - Waits for the local or remote user to hit a valid key
        !           141:        - See K_* constants in XSDKDEFS.H for possible values of mode */
        !           142: char getkey(int mode);
        !           143: 
        !           144: /* Get One of these Keys or a Number
        !           145:        - Waits for the user to hit a valid key or if max is non-zero, then enter
        !           146:          a number not greater than max
        !           147:        - Hot-keyed input, automatically displays the struck key (in upper case)
        !           148:          followed by CRLF
        !           149:        - If the user entered a number, the number is ORed with 0x8000 and returned
        !           150:          you must XOR (or not) this bit to get the correct number */
        !           151: int  getkeys(char *str, int max);
        !           152: 
        !           153: /* Get a Number
        !           154:        - Waits for the user to enter a number from 0 to max, 'Q' or ENTER
        !           155:        - Returns -1 if the user hit 'Q' or Ctrl-C
        !           156:        - Returns 0 if the user just hit ENTER */
        !           157: int  getnum(int max);
        !           158: 
        !           159: /* Change Attribute
        !           160:        - Sends ANSI escape sequences (if user supports ANSI) to change color
        !           161:        - Valid color bits are defined in INCLUDE\CONIO.H */
        !           162: void attr(char atr);
        !           163: 
        !           164: /* Clear Screen
        !           165:        - Clears local and remote screen (using ANSI if appropriate)
        !           166:        - Automatically pauses before clearing if lncntr is >1 */
        !           167: void cls(void);
        !           168: 
        !           169: /* Process Ctrl-A Code
        !           170:        - Changes color or performs special Ctrl-A function */
        !           171: void ctrl_a(char x);
        !           172: 
        !           173: /* Network Open
        !           174:        - Opens a file in DENYNONE or DENYWRITE mode, automatically retrying */
        !           175: int  nopen(char *str, int access);
        !           176: 
        !           177: /* Truncate Space
        !           178:        - Removes white space characters from the end of a string */
        !           179: void truncsp(uchar *str);
        !           180: 
        !           181: /* Adds Backslash
        !           182:        - Adds backslash to end of string if it doesn't exist */
        !           183: void backslash(char *str);
        !           184: 
        !           185: /* Check Time Left
        !           186:        - Checks the amount of time the user has left and sets the timeleft
        !           187:          variable
        !           188:        - Automatically exits if user runs out of time */
        !           189: void checktimeleft(void);
        !           190: 
        !           191: /* Print File
        !           192:        - Displays contents of file (expanding Ctrl-A characters if appropriate) */
        !           193: void printfile(char *str);
        !           194: 
        !           195: /* Get String
        !           196:        - Waits for the user to enter a string
        !           197:        - maxlen is the maximum length of the string
        !           198:        - See K_* constants in XSDKDEFS.H for possible values of mode */
        !           199: int  getstr(char *str, int maxlen, int mode);
        !           200: 
        !           201: /* Redraw String
        !           202:        - Redisplays a string, mainly called by getstr() */
        !           203: void redrwstr(char *strin, int i, int l, char mode);
        !           204: 
        !           205: /* Strip Invalid Ctrl-A codes */
        !           206: char stripattr(char *strin);
        !           207: 
        !           208: /* Returns the name of the user number passed */
        !           209: char *username(uint usernumber);
        !           210: 
        !           211: /* Returns the number of the user name passed */
        !           212: uint usernumber(char *username);
        !           213: 
        !           214: /* Returns 1 if the file exists, 0 otherwise */
        !           215: char fexist(char *filespec);
        !           216: 
        !           217: /* Returns the length of the file */
        !           218: long flength(char *filespec);
        !           219: 
        !           220: /* Convert unsigned long to an ASCII string with commas */
        !           221: char *ultoac(ulong l, char *string);
        !           222: 
        !           223: /* Convert an ASCII string of hex digits into an unsigned long */
        !           224: ulong ahtoul(char *str);
        !           225: 
        !           226: /* Display status of node */
        !           227: void printnodedat(uchar number, node_t node);
        !           228: 
        !           229: /* Checks to see if this node has been interrupted or any messages waiting */
        !           230: void nodesync(void);
        !           231: 
        !           232: /* Writes the node information to disk */
        !           233: void putnodedat(uchar number, node_t node);
        !           234: 
        !           235: /* Reads the node information from disk */
        !           236: void getnodedat(uchar number, node_t *node, char lockit);
        !           237: 
        !           238: /* Writes a short message (telegram) for specified user number */
        !           239: void putsmsg(int usernumber, char *strin);
        !           240: 
        !           241: /* Reads and displays short message for specified user number */
        !           242: void getsmsg(int usernumber);
        !           243: 
        !           244: /* Writes a node message for specified node */
        !           245: void putnmsg(int num, char *strin);
        !           246: 
        !           247: /* Reads and displays node message for current node */
        !           248: void getnmsg(void);
        !           249: 
        !           250: /* Displays users online */
        !           251: int whos_online(char listself);
        !           252: 
        !           253: /* Send a node-message (ctrl-P) */
        !           254: void nodemsg(void);
        !           255: 
        !           256: /* Put a key into the keyboard buffer */
        !           257: void ungetkey(char ch);
        !           258: 
        !           259: /* Check to see if the user has hung-up */
        !           260: void checkline(void);
        !           261: 
        !           262: /* Wait a specific number of milliseconds */
        !           263: void mswait(int ms);
        !           264: 
        !           265: /* Display a line (with ctrl-A codes) centered on the screen */
        !           266: void center(char *str);
        !           267: 
        !           268: #ifdef __cplusplus
        !           269:        }
        !           270: #endif
        !           271: 
        !           272: 
        !           273: #endif /* Don't add anything after this #endif */

unix.superglobalmegacorp.com

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