home *** CD-ROM | disk | FTP | other *** search
/ synchro.net / synchro.net.tar / synchro.net / main / SBBS_ARC / XSDK_301.ZIP / SDK / XSDK.H < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-02  |  8.4 KB  |  285 lines

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