home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume26 / mytinfo / part01 / defs.h < prev    next >
C/C++ Source or Header  |  1992-12-26  |  4KB  |  197 lines

  1. /*
  2.  * defs.h
  3.  *
  4.  * By Ross Ridge
  5.  * Public Domain
  6.  * 92/06/04 11:37:02
  7.  *
  8.  * @(#) mytinfo defs.h 3.3 92/06/04 public domain, By Ross Ridge
  9.  */
  10.  
  11. #ifndef _DEFS_H_
  12. #define _DEFS_H_
  13.  
  14. #ifdef TEST
  15. #undef NOTLIB
  16. #define NOTLIB
  17. #endif
  18.  
  19. #include "config.h"
  20.  
  21. #ifdef NOTLIB
  22. #undef USE_FAKE_STDIO
  23. #endif
  24.  
  25. #ifdef USE_STDDEF
  26. #include <stddef.h>
  27. #else
  28. #include <sys/types.h>
  29. #endif
  30.  
  31. #ifdef USE_STDLIB
  32. #include <stdlib.h>
  33. #else
  34. #ifdef USE_PROTOTYPES
  35. anyptr malloc(mysize_t);
  36. anyptr realloc(anyptr, mysize_t);
  37. char *getenv(char const *);
  38. #else
  39. anyptr malloc();
  40. anyptr realloc();
  41. char *getenv();
  42. #endif
  43. #endif
  44.  
  45. #ifdef USE_STDARG
  46. #include <stdarg.h>
  47. #else
  48. #include <varargs.h>
  49. #endif
  50.  
  51. #ifndef _VA_LIST
  52. #define _VA_LIST
  53. #endif
  54.  
  55. #ifdef USE_FAKE_STDIO
  56. #include "fake_stdio.h"
  57. #define sprintf _fake_sprintf
  58. #ifdef USE_PROTOTYPES
  59. int sprintf(char *, char *, ...);
  60. #else
  61. int sprintf();
  62. #endif
  63. #else /* USE_FAKE_STDIO */
  64. #if 0
  65. #include <stdio.h>
  66. #else
  67. #undef NULL
  68. #include <stdio.h>
  69. #endif
  70. #endif /* !USE_FAKE_STDIO */
  71.  
  72. #ifdef USE_STRINGS
  73. #include <strings.h>
  74. #define strchr(s, c) index(s, c)
  75. #define strrchr(s, c) rindex(s, c)
  76. #ifndef USE_MYSTRTOK
  77. #ifdef USE_PROTOTYPES
  78. char *strtok(char *, char *);
  79. #else
  80. char *strtok();
  81. #endif
  82. #endif
  83. #else
  84. #include <string.h>
  85. #endif
  86.  
  87. #ifdef USE_MEMORY
  88. #include <memory.h>
  89. #else
  90. #define memcpy(b, a, n) bcopy(a, b, n)
  91. #endif
  92.  
  93. #include <errno.h>
  94.  
  95. #define MAX_BUF    4096
  96. #define MAX_LINE 640
  97. #define MAX_NAME 128
  98.  
  99. #define MAX_CHUNK MAX_LINE
  100.  
  101. #define MAX_DEPTH 32
  102.  
  103. #define MAX_VARNAME    32
  104. #define MAX_TINFONAME    5
  105. #define MAX_TCAPNAME    2
  106.  
  107. struct caplist {
  108.     char    type;
  109.     char    flag;
  110.     char    var[MAX_VARNAME + 1];
  111.     char    tinfo[MAX_TINFONAME + 1];
  112.     char    tcap[MAX_TCAPNAME + 1];
  113. };
  114.  
  115. struct term_path {
  116.     char *file;
  117.     int type;    /* 0 = file, 1 = TERMCAP env, 2 = TERMINFO env */
  118. };
  119.  
  120. struct _terminal;
  121.  
  122. #ifdef USE_PROTOTYPES
  123.  
  124. int _gettcap(char *, struct _terminal *, struct term_path *);
  125. int _gettinfo(char *, struct _terminal *, struct term_path *);
  126. int _fillterm(char *, struct term_path *, char *);
  127. int _findterm(char *, struct term_path *, char *);
  128. int _init_tty(void), _lit_output(void), _check_tty(void);
  129. void _figure_termcap(void);
  130. int _tmatch(char *, char *);
  131. void _norm_output(void);
  132. int readcaps(FILE *, struct caplist *, int);
  133. noreturn void quit(int, char *, ...);
  134. #ifdef lint
  135. extern void (*cleanup)();
  136. #else
  137. extern void (*cleanup)(int);
  138. #endif
  139. struct term_path *_buildpath(char *, int, ...);
  140. void _delpath(struct term_path *);
  141. char *_addstr(char *);
  142. struct strbuf *_endstr(void);
  143. void _del_strs(struct _terminal *);
  144. void _tcapconv(void);
  145. void _tcapdefault(void);
  146. int _getother(char *, struct term_path *, struct _terminal *);
  147. int _gettbin(char *, struct _terminal *);
  148. int _findboolcode(char *), _findnumcode(char *), _findstrcode(char *);
  149. int _findboolname(char *), _findnumname(char *), _findstrname(char *);
  150. int _findboolfname(char *), _findnumfname(char *), _findstrfname(char *);
  151.  
  152. #ifdef USE_ANSIC
  153. int _compar(void const *, void const *);
  154. typedef int (*compar_fn)(void const *, void const *);
  155. #else
  156. int _compar(anyptr, anyptr);
  157. typedef int (*compar_fn)(anyptr, anyptr);
  158. #endif
  159.  
  160. #else /* USE_PROTOTYPES */
  161.  
  162. int _gettcap(), _gettinfo(), _fillterm(), _findterm(), _init_tty();
  163. int _lit_output(), _check_tty();
  164. void _figure_termcap();
  165. int _tmatch();
  166. void _norm_output();
  167. int readcaps();
  168. noreturn void /* GOTO */ quit(/*FORMAT2*/);
  169. extern void (*cleanup)();
  170. struct term_path *_buildpath();
  171. void _delpath();
  172. char *_addstr();
  173. struct strbuf *_endstr();
  174. void _del_strs();
  175. void _tcapconv();
  176. void _tcapdefault();
  177. int _getother();
  178. int _gettbin();
  179. int _findboolcode(), _findnumcode(), _findstrcode();
  180. int _findboolname(), _findnumname(), _findstrname();
  181. int _findboolfname(), _findnumfname(), _findstrfname();
  182. int _compar();
  183. typedef int (*compar_fn)();
  184.  
  185. #endif /* USE_PROTOTYPES */
  186.  
  187. extern char _strflags[];
  188.  
  189. extern char _mytinfo_version[];
  190.  
  191. /* for quit.c */
  192. extern int sys_nerr;
  193. extern char *sys_errlist[];
  194. extern char *prg_name;
  195.  
  196. #endif /* _DEFS_H_ */
  197.