/contrib/tcsh/tc.decls.h

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 345 lines · 239 code · 38 blank · 68 comment · 4 complexity · 8125f67afa91bb41238efb89e1a42680 MD5 · raw file

  1. /* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.65 2010/02/09 20:26:13 christos Exp $ */
  2. /*
  3. * tc.decls.h: Function declarations from all the tcsh modules
  4. */
  5. /*-
  6. * Copyright (c) 1980, 1991 The Regents of the University of California.
  7. * All rights reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. Neither the name of the University nor the names of its contributors
  18. * may be used to endorse or promote products derived from this software
  19. * without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31. * SUCH DAMAGE.
  32. */
  33. #ifndef _h_tc_decls
  34. #define _h_tc_decls
  35. struct blk_buf;
  36. struct strbuf;
  37. struct Strbuf;
  38. /*
  39. * tc.alloc.c
  40. */
  41. #ifndef SYSMALLOC
  42. #ifndef WINNT_NATIVE
  43. #ifndef __linux__
  44. extern void free (ptr_t);
  45. extern memalign_t malloc (size_t);
  46. extern memalign_t realloc (ptr_t, size_t);
  47. extern memalign_t calloc (size_t, size_t);
  48. #endif
  49. #endif /* !WINNT_NATIVE */
  50. #else /* SYSMALLOC */
  51. extern void sfree (ptr_t);
  52. extern memalign_t smalloc (size_t);
  53. extern memalign_t srealloc (ptr_t, size_t);
  54. extern memalign_t scalloc (size_t, size_t);
  55. #endif /* SYSMALLOC */
  56. extern void showall (Char **, struct command *);
  57. /*
  58. * tc.bind.c
  59. */
  60. extern void dobindkey (Char **, struct command *);
  61. /*
  62. * tc.defs.c:
  63. */
  64. extern void getmachine (void);
  65. /*
  66. * tc.disc.c
  67. */
  68. extern int setdisc (int);
  69. extern int resetdisc (int);
  70. /*
  71. * tc.func.c
  72. */
  73. extern Char *expand_lex (const struct wordent *, int, int);
  74. extern Char *sprlex (const struct wordent *);
  75. extern Char *Itoa (int, size_t, Char);
  76. extern void dolist (Char **, struct command *);
  77. extern void dotermname (Char **, struct command *);
  78. extern void dotelltc (Char **, struct command *);
  79. extern void doechotc (Char **, struct command *);
  80. extern void dosettc (Char **, struct command *);
  81. extern int cmd_expand (Char *, Char **);
  82. extern void dowhich (Char **, struct command *);
  83. extern struct process *find_stop_ed (void);
  84. extern void fg_proc_entry (struct process *);
  85. extern void alrmcatch (void);
  86. extern void precmd (void);
  87. extern void postcmd (void);
  88. extern void cwd_cmd (void);
  89. extern void beep_cmd (void);
  90. extern void period_cmd (void);
  91. extern void job_cmd (Char *);
  92. extern void aliasrun (int, Char *, Char *);
  93. extern void setalarm (int);
  94. extern void rmstar (struct wordent *);
  95. extern void continue_jobs (struct wordent *);
  96. extern Char *gettilde (const Char *);
  97. extern Char *getusername (Char **);
  98. #ifdef OBSOLETE
  99. extern void doaliases (Char **, struct command *);
  100. #endif /* OBSOLETE */
  101. extern void shlvl (int);
  102. extern int fixio (int, int);
  103. extern int collate (const Char *, const Char *);
  104. #ifdef HASHBANG
  105. extern int hashbang (int, Char ***);
  106. #endif /* HASHBANG */
  107. #ifdef REMOTEHOST
  108. extern void remotehost (void);
  109. #endif /* REMOTEHOST */
  110. /*
  111. * tc.os.c
  112. */
  113. #ifdef MACH
  114. extern void dosetpath (Char **, struct command *);
  115. #endif /* MACH */
  116. #ifdef TCF
  117. extern void dogetxvers (Char **, struct command *);
  118. extern void dosetxvers (Char **, struct command *);
  119. extern void dogetspath (Char **, struct command *);
  120. extern void dosetspath (Char **, struct command *);
  121. extern char *sitename (pid_t);
  122. extern void domigrate (Char **, struct command *);
  123. #endif /* TCF */
  124. #ifdef WARP
  125. extern void dowarp (Char **, struct command *);
  126. #endif /* WARP */
  127. #if defined(_CRAY) && !defined(_CRAYMPP)
  128. extern void dodmmode (Char **, struct command *);
  129. #endif /* _CRAY && !_CRAYMPP */
  130. #if defined(masscomp) || defined(hcx)
  131. extern void douniverse (Char **, struct command *);
  132. #endif /* masscomp */
  133. #if defined(_OSD_POSIX) /* BS2000 */
  134. extern void dobs2cmd (Char **, struct command *);
  135. #endif /* _OSD_POSIX */
  136. #if defined(hcx)
  137. extern void doatt (Char **, struct command *);
  138. extern void doucb (Char **, struct command *);
  139. #endif /* hcx */
  140. #ifdef _SEQUENT_
  141. extern void pr_stat_sub (struct process_stats *,
  142. struct process_stats *,
  143. struct process_stats *);
  144. #endif /* _SEQUENT_ */
  145. #ifdef NEEDtcgetpgrp
  146. extern pid_t xtcgetpgrp (int);
  147. extern int xtcsetpgrp (int, int);
  148. # undef tcgetpgrp
  149. # define tcgetpgrp(a) xtcgetpgrp(a)
  150. # undef tcsetpgrp
  151. # define tcsetpgrp(a, b) xtcsetpgrp((a), (b))
  152. #endif /* NEEDtcgetpgrp */
  153. #ifdef YPBUGS
  154. extern void fix_yp_bugs (void);
  155. #endif /* YPBUGS */
  156. #ifdef STRCOLLBUG
  157. extern void fix_strcoll_bug (void);
  158. #endif /* STRCOLLBUG */
  159. extern void osinit (void);
  160. #ifndef HAVE_MEMMOVE
  161. extern void *xmemmove (void *, const void *, size_t);
  162. # define memmove(a, b, c) xmemmove(a, b, c)
  163. #endif /* !HAVE_MEMMOVE */
  164. #ifndef HAVE_MEMSET
  165. extern void *xmemset (void *, int, size_t);
  166. # define memset(a, b, c) xmemset(a, b, c)
  167. #endif /* !HAVE_MEMSET */
  168. #ifndef HAVE_GETCWD
  169. extern char *xgetcwd (char *, size_t);
  170. # undef getcwd
  171. # define getcwd(a, b) xgetcwd(a, b)
  172. #endif /* !HAVE_GETCWD */
  173. #ifndef HAVE_GETHOSTNAME
  174. extern int xgethostname (char *, int);
  175. # undef gethostname
  176. # define gethostname(a, b) xgethostname(a, b)
  177. #endif /* !HAVE_GETHOSTNAME */
  178. #ifndef HAVE_NICE
  179. extern int xnice (int);
  180. # undef nice
  181. # define nice(a) xnice(a)
  182. #endif /* !HAVE_NICE */
  183. #ifndef HAVE_STRERROR
  184. extern char *xstrerror (int);
  185. # undef strerror
  186. # define strerror(a) xstrerror(a)
  187. #endif /* !HAVE_STRERROR */
  188. #ifdef apollo
  189. extern void doinlib (Char **, struct command *);
  190. extern void dover (Char **, struct command *);
  191. extern void dorootnode (Char **, struct command *);
  192. extern int getv (Char *);
  193. #endif /* apollo */
  194. /*
  195. * tc.printf.h
  196. */
  197. #ifndef __GNUC__
  198. #define __attribute__(a)
  199. #endif
  200. extern pret_t xprintf (const char *, ...)
  201. __attribute__((__format__(__printf__, 1, 2)));
  202. extern pret_t xsnprintf (char *, size_t, const char *, ...)
  203. __attribute__((__format__(__printf__, 3, 4)));
  204. extern char *xasprintf (const char *, ...)
  205. __attribute__((__format__(__printf__, 1, 2)));
  206. extern pret_t xvprintf (const char *, va_list)
  207. __attribute__((__format__(__printf__, 1, 0)));
  208. extern pret_t xvsnprintf (char *, size_t, const char *, va_list)
  209. __attribute__((__format__(__printf__, 3, 0)));
  210. extern char *xvasprintf (const char *, va_list)
  211. __attribute__((__format__(__printf__, 1, 0)));
  212. /*
  213. * tc.prompt.c
  214. */
  215. extern void dateinit (void);
  216. extern void printprompt (int, const char *);
  217. extern int expdollar (struct Strbuf *, const Char **, Char);
  218. extern Char *tprintf (int, const Char *, const char *,
  219. time_t, ptr_t);
  220. /*
  221. * tc.sched.c
  222. */
  223. extern time_t sched_next (void);
  224. extern void dosched (Char **, struct command *);
  225. extern void sched_run (void);
  226. /*
  227. * tc.str.c:
  228. */
  229. #ifdef WIDE_STRINGS
  230. extern size_t one_mbtowc (Char *, const char *, size_t);
  231. extern size_t one_wctomb (char *, Char);
  232. extern int rt_mbtowc (Char *, const char *, size_t);
  233. #else
  234. #define one_mbtowc(PWC, S, N) \
  235. ((void)(N), *(PWC) = (unsigned char)*(S), (size_t)1)
  236. #define one_wctomb(S, WCHAR) (*(S) = (WCHAR), (size_t)1)
  237. #endif
  238. #ifdef SHORT_STRINGS
  239. extern Char *s_strchr (const Char *, int);
  240. extern Char *s_strrchr (const Char *, int);
  241. extern Char *s_strcat (Char *, const Char *);
  242. # ifdef NOTUSED
  243. extern Char *s_strncat (Char *, const Char *, size_t);
  244. # endif /* NOTUSED */
  245. extern Char *s_strcpy (Char *, const Char *);
  246. extern Char *s_strncpy (Char *, const Char *, size_t);
  247. extern Char *s_strspl (const Char *, const Char *);
  248. extern size_t s_strlen (const Char *);
  249. extern int s_strcmp (const Char *, const Char *);
  250. extern int s_strncmp (const Char *, const Char *, size_t);
  251. extern int s_strcasecmp (const Char *, const Char *);
  252. extern Char *s_strnsave (const Char *, size_t);
  253. extern Char *s_strsave (const Char *);
  254. extern Char *s_strend (const Char *);
  255. extern Char *s_strstr (const Char *, const Char *);
  256. extern Char *str2short (const char *);
  257. extern Char **blk2short (char **);
  258. extern char *short2str (const Char *);
  259. extern char **short2blk (Char **);
  260. #else /* !SHORT_STRINGS */
  261. extern char *caching_strip (const char *);
  262. #endif
  263. extern char *short2qstr (const Char *);
  264. extern struct blk_buf *bb_alloc (void);
  265. extern void bb_append (struct blk_buf *, Char *);
  266. extern void bb_cleanup (void *);
  267. extern Char **bb_finish (struct blk_buf *);
  268. extern void bb_free (void *);
  269. extern struct strbuf *strbuf_alloc(void);
  270. extern void strbuf_terminate(struct strbuf *);
  271. extern void strbuf_append1(struct strbuf *, char);
  272. extern void strbuf_appendn(struct strbuf *, const char *,
  273. size_t);
  274. extern void strbuf_append (struct strbuf *, const char *);
  275. extern char *strbuf_finish (struct strbuf *);
  276. extern void strbuf_cleanup(void *);
  277. extern void strbuf_free(void *);
  278. extern struct Strbuf *Strbuf_alloc(void);
  279. extern void Strbuf_terminate(struct Strbuf *);
  280. extern void Strbuf_append1(struct Strbuf *, Char);
  281. extern void Strbuf_appendn(struct Strbuf *, const Char *,
  282. size_t);
  283. extern void Strbuf_append (struct Strbuf *, const Char *);
  284. extern Char *Strbuf_finish (struct Strbuf *);
  285. extern void Strbuf_cleanup(void *);
  286. extern void Strbuf_free(void *);
  287. /*
  288. * tc.vers.c:
  289. */
  290. extern void fix_version (void);
  291. /*
  292. * tc.who.c
  293. */
  294. #if defined (HAVE_UTMP_H) || defined (HAVE_UTMPX_H) || defined (WINNT_NATIVE)
  295. extern void initwatch (void);
  296. extern void resetwatch (void);
  297. extern void watch_login (int);
  298. extern char *who_info (ptr_t, int);
  299. extern void dolog (Char **, struct command *);
  300. # ifdef HAVE_STRUCT_UTMP_UT_HOST
  301. extern char *utmphost (void);
  302. extern size_t utmphostsize (void);
  303. # endif /* HAVE_STRUCT_UTMP_UT_HOST */
  304. #else
  305. # define HAVENOUTMP
  306. #endif
  307. #endif /* _h_tc_decls */