/contrib/tcsh/sh.decls.h

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 442 lines · 326 code · 24 blank · 92 comment · 6 complexity · 3e2bae7b83ec5682d3659755fadde9d0 MD5 · raw file

  1. /* $Header: /p/tcsh/cvsroot/tcsh/sh.decls.h,v 3.62 2011/02/25 23:58:34 christos Exp $ */
  2. /*
  3. * sh.decls.h External declarations from sh*.c
  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_sh_decls
  34. #define _h_sh_decls
  35. /*
  36. * sh.c
  37. */
  38. extern Char *gethdir (const Char *);
  39. extern void dosource (Char **, struct command *);
  40. extern void exitstat (void);
  41. extern void goodbye (Char **, struct command *);
  42. extern void importpath (Char *);
  43. extern void initdesc (void);
  44. extern void pintr (void);
  45. extern void pintr1 (int);
  46. extern void phup (void);
  47. extern void process (int);
  48. extern void untty (void);
  49. #ifdef PROF
  50. extern void done (int) __attribute__((__noreturn__));
  51. #else
  52. extern void xexit (int) __attribute__((__noreturn__));
  53. #endif
  54. extern int grabpgrp (int, pid_t);
  55. /*
  56. * sh.dir.c
  57. */
  58. extern void dinit (Char *);
  59. extern void dodirs (Char **, struct command *);
  60. extern Char *dcanon (Char *, Char *);
  61. extern void dtildepr (Char *);
  62. extern void dtilde (void);
  63. extern void dochngd (Char **, struct command *);
  64. extern Char *dnormalize (const Char *, int);
  65. extern void dopushd (Char **, struct command *);
  66. extern void dopopd (Char **, struct command *);
  67. extern void dfree (struct directory *);
  68. extern void dsetstack (void);
  69. extern const Char *getstakd (int);
  70. extern void recdirs (Char *, int);
  71. extern void loaddirs (Char *);
  72. /*
  73. * sh.dol.c
  74. */
  75. extern void Dfix (struct command *);
  76. extern Char *Dfix1 (Char *);
  77. extern void heredoc (Char *);
  78. /*
  79. * sh.err.c
  80. */
  81. extern void reset (void) __attribute__((__noreturn__));
  82. extern void cleanup_push_internal(void *, void (*fn) (void *)
  83. #ifdef CLEANUP_DEBUG
  84. , const char *, size_t
  85. #define cleanup_push(v, f) cleanup_push_internal(v, f, __FILE__, __LINE__)
  86. #else
  87. #define cleanup_push(v, f) cleanup_push_internal(v, f)
  88. #endif
  89. );
  90. extern int cleanup_reset(void);
  91. extern void cleanup_ignore(void *);
  92. extern void cleanup_until(void *);
  93. extern void cleanup_until_mark(void);
  94. extern size_t cleanup_push_mark(void);
  95. extern void cleanup_pop_mark(size_t);
  96. extern void open_cleanup(void *);
  97. extern void opendir_cleanup(void *);
  98. extern void sigint_cleanup(void *);
  99. extern void sigprocmask_cleanup(void *);
  100. extern void xfree_indirect(void *);
  101. extern void errinit (void);
  102. extern void seterror (unsigned int, ...);
  103. extern void fixerror (void);
  104. extern void stderror (unsigned int, ...)
  105. __attribute__((__noreturn__));
  106. /*
  107. * sh.exec.c
  108. */
  109. extern void doexec (struct command *, int);
  110. extern void dohash (Char **, struct command *);
  111. extern void dounhash (Char **, struct command *);
  112. extern void execash (Char **, struct command *);
  113. extern void hashstat (Char **, struct command *);
  114. extern void xechoit (Char **);
  115. extern int executable (const Char *, const Char *, int);
  116. extern int tellmewhat (struct wordent *, Char **);
  117. extern void dowhere (Char **, struct command *);
  118. extern int find_cmd (Char *, int);
  119. /*
  120. * sh.exp.c
  121. */
  122. extern Char *filetest (Char *, Char ***, int);
  123. extern tcsh_number_t expr (Char ***);
  124. extern tcsh_number_t exp0 (Char ***, int);
  125. /*
  126. * sh.file.c
  127. */
  128. #if defined(FILEC) && defined(TIOCSTI)
  129. extern size_t tenex (Char *, size_t);
  130. #endif
  131. /*
  132. * sh.func.c
  133. */
  134. extern void tsetenv (const Char *, const Char *);
  135. extern void Unsetenv (Char *);
  136. extern void doalias (Char **, struct command *);
  137. extern void dobreak (Char **, struct command *);
  138. extern void docontin (Char **, struct command *);
  139. extern void doecho (Char **, struct command *);
  140. extern void doelse (Char **, struct command *);
  141. extern void doend (Char **, struct command *);
  142. extern void doeval (Char **, struct command *);
  143. extern void doexit (Char **, struct command *);
  144. extern void doforeach (Char **, struct command *);
  145. extern void doglob (Char **, struct command *);
  146. extern void dogoto (Char **, struct command *);
  147. extern void doif (Char **, struct command *);
  148. extern void dolimit (Char **, struct command *);
  149. extern void dologin (Char **, struct command *);
  150. extern void dologout (Char **, struct command *);
  151. #ifdef NEWGRP
  152. extern void donewgrp (Char **, struct command *);
  153. #endif
  154. extern void donohup (Char **, struct command *);
  155. extern void dohup (Char **, struct command *);
  156. extern void doonintr (Char **, struct command *);
  157. extern void doprintenv (Char **, struct command *);
  158. extern void dorepeat (Char **, struct command *);
  159. extern void dofiletest (Char **, struct command *);
  160. extern void dosetenv (Char **, struct command *);
  161. extern void dosuspend (Char **, struct command *);
  162. extern void doswbrk (Char **, struct command *);
  163. extern void doswitch (Char **, struct command *);
  164. extern void doumask (Char **, struct command *);
  165. extern void dounlimit (Char **, struct command *);
  166. extern void dounsetenv (Char **, struct command *);
  167. extern void dowhile (Char **, struct command *);
  168. extern void dozip (Char **, struct command *);
  169. extern void func (struct command *,
  170. const struct biltins *);
  171. extern void gotolab (Char *);
  172. extern const struct biltins *isbfunc (struct command *);
  173. extern void prvars (void);
  174. extern int srchx (Char *);
  175. extern void unalias (Char **, struct command *);
  176. extern void wfree (void);
  177. extern void dobuiltins (Char **, struct command *);
  178. extern void reexecute (struct command *);
  179. /*
  180. * sh.glob.c
  181. */
  182. extern Char *globequal (Char *);
  183. extern Char **dobackp (Char *, int);
  184. extern Char *globone (Char *, int);
  185. extern int Gmatch (const Char *, const Char *);
  186. extern int Gnmatch (const Char *, const Char *,
  187. const Char **);
  188. extern Char **globall (Char **, int);
  189. extern Char **glob_all_or_error(Char **);
  190. extern void rscan (Char **, void (*)(Char));
  191. extern int tglob (Char **);
  192. extern void trim (Char **);
  193. #if !defined(WINNT_NATIVE) && defined(NLS_CATALOGS)
  194. extern char *xcatgets (nl_catd, int, int, const char *);
  195. #if defined(HAVE_ICONV) && defined(HAVE_NL_LANGINFO)
  196. extern char *iconv_catgets (nl_catd, int, int, const char *);
  197. #endif
  198. #endif
  199. extern void nlsinit (void);
  200. extern void nlsclose (void);
  201. extern int t_pmatch (const Char *, const Char *,
  202. const Char **, int);
  203. /*
  204. * sh.hist.c
  205. */
  206. extern void dohist (Char **, struct command *);
  207. extern struct Hist *enthist (int, struct wordent *, int, int, int);
  208. extern void savehist (struct wordent *, int);
  209. extern char *fmthist (int, ptr_t);
  210. extern void rechist (Char *, int);
  211. extern void loadhist (Char *, int);
  212. extern void displayHistStats(const char *);
  213. /*
  214. * sh.init.c
  215. */
  216. extern void mesginit (void);
  217. /*
  218. * sh.lex.c
  219. */
  220. extern void addla (Char *);
  221. extern void bseek (struct Ain *);
  222. extern void btell (struct Ain *);
  223. extern void btoeof (void);
  224. extern void copylex (struct wordent *, struct wordent *);
  225. extern Char *domod (Char *, Char);
  226. extern void freelex (struct wordent *);
  227. extern int lex (struct wordent *);
  228. extern void lex_cleanup (void *);
  229. extern void prlex (struct wordent *);
  230. extern eChar readc (int);
  231. extern void settell (void);
  232. extern void unreadc (Char);
  233. /*
  234. * sh.misc.c
  235. */
  236. extern int any (const char *, Char);
  237. extern Char **blkcpy (Char **, Char **);
  238. extern void blkfree (Char **);
  239. extern void blk_cleanup (void *);
  240. extern void blk_indirect_cleanup(void *);
  241. extern int blklen (Char **);
  242. extern void blkpr (Char *const *);
  243. extern Char *blkexpand (Char *const *);
  244. extern Char **blkspl (Char **, Char **);
  245. extern void closem (void);
  246. #ifndef CLOSE_ON_EXEC
  247. extern void closech (void);
  248. #endif /* !CLOSE_ON_EXEC */
  249. extern Char **copyblk (Char **);
  250. extern int dcopy (int, int);
  251. extern int dmove (int, int);
  252. extern void donefds (void);
  253. extern Char lastchr (Char *);
  254. extern void lshift (Char **, int);
  255. extern int number (Char *);
  256. extern int prefix (const Char *, const Char *);
  257. extern Char **saveblk (Char **);
  258. extern void setzero (void *, size_t);
  259. extern Char *strip (Char *);
  260. extern Char *quote (Char *);
  261. extern const Char *quote_meta (struct Strbuf *, const Char *);
  262. #ifndef SHORT_STRINGS
  263. extern char *strnsave (const char *, size_t);
  264. #endif
  265. extern char *strsave (const char *);
  266. extern void udvar (Char *) __attribute__((__noreturn__));
  267. #ifndef POSIX
  268. extern char *strstr (const char *, const char *);
  269. #endif /* !POSIX */
  270. extern char *strspl (const char *, const char *);
  271. extern char *strend (const char *);
  272. extern char *areadlink (const char *);
  273. extern void xclose (int);
  274. extern void xclosedir (DIR *);
  275. extern int xcreat (const char *, mode_t);
  276. extern struct group *xgetgrgid (gid_t);
  277. extern struct passwd *xgetpwnam (const char *);
  278. extern struct passwd *xgetpwuid (uid_t);
  279. extern int xopen (const char *, int, ...);
  280. extern ssize_t xread (int, void *, size_t);
  281. extern int xtcsetattr (int, int, const struct termios *);
  282. extern ssize_t xwrite (int, const void *, size_t);
  283. /*
  284. * sh.parse.c
  285. */
  286. extern void alias (struct wordent *);
  287. extern void freesyn (struct command *);
  288. extern struct command *syntax (const struct wordent *,
  289. const struct wordent *, int);
  290. extern void syntax_cleanup(void *);
  291. /*
  292. * sh.print.c
  293. */
  294. extern void drainoline (void);
  295. extern void flush (void);
  296. #ifdef BSDTIMES
  297. extern void pcsecs (unsigned long);
  298. #else /* !BSDTIMES */
  299. # ifdef POSIX
  300. extern void pcsecs (clock_t);
  301. # else /* !POSIX */
  302. extern void pcsecs (time_t);
  303. # endif /* !POSIX */
  304. #endif /* BSDTIMES */
  305. #ifdef BSDLIMIT
  306. extern void psecs (unsigned long);
  307. #endif /* BSDLIMIT */
  308. extern int putpure (int);
  309. extern int putraw (int);
  310. extern void xputchar (int);
  311. #ifdef WIDE_STRINGS
  312. extern void putwraw (Char);
  313. extern void xputwchar (Char);
  314. #else
  315. # define putwraw(C) putraw(C)
  316. # define xputwchar(C) xputchar(C)
  317. #endif
  318. extern void output_raw_restore(void *);
  319. /*
  320. * sh.proc.c
  321. */
  322. extern void dobg (Char **, struct command *);
  323. extern void dobg1 (Char **, struct command *);
  324. extern void dofg (Char **, struct command *);
  325. extern void dofg1 (Char **, struct command *);
  326. extern void dojobs (Char **, struct command *);
  327. extern void dokill (Char **, struct command *);
  328. extern void donotify (Char **, struct command *);
  329. extern void dostop (Char **, struct command *);
  330. extern void dowait (Char **, struct command *);
  331. extern void palloc (pid_t, struct command *);
  332. extern void panystop (int);
  333. extern void pchild (void);
  334. extern void pendjob (void);
  335. extern pid_t pfork (struct command *, int);
  336. extern void pgetty (int, pid_t);
  337. extern void pjwait (struct process *);
  338. extern void pnote (void);
  339. extern void psavejob (void);
  340. extern void psavejob_cleanup(void *);
  341. extern int pstart (struct process *, int);
  342. extern void pwait (void);
  343. extern struct process *pfind (Char *);
  344. /*
  345. * sh.sem.c
  346. */
  347. extern void execute (struct command *, volatile int, int *,
  348. int *, int);
  349. extern void mypipe (int *);
  350. /*
  351. * sh.set.c
  352. */
  353. extern struct varent *adrof1 (const Char *, struct varent *);
  354. extern void doset (Char **, struct command *);
  355. extern void dolet (Char **, struct command *);
  356. extern Char *putn (tcsh_number_t);
  357. extern tcsh_number_t getn (const Char *);
  358. extern Char *value1 (Char *, struct varent *);
  359. extern void setcopy (const Char *, const Char *, int);
  360. extern void setv (const Char *, Char *, int);
  361. extern void set1 (const Char *, Char **,
  362. struct varent *, int);
  363. extern void setq (const Char *, Char **,
  364. struct varent *, int);
  365. extern void unset (Char **, struct command *);
  366. extern void unset1 (Char *[], struct varent *);
  367. extern void unsetv (Char *);
  368. extern void setNS (const Char *);
  369. extern void shift (Char **, struct command *);
  370. extern void plist (struct varent *, int);
  371. extern Char *unparse (struct command *);
  372. #if defined(DSPMBYTE)
  373. extern void update_dspmbyte_vars (void);
  374. extern void autoset_dspmbyte (const Char *);
  375. #endif
  376. #if defined(AUTOSET_KANJI)
  377. extern void autoset_kanji (void);
  378. #endif
  379. /*
  380. * sh.time.c
  381. */
  382. extern void donice (Char **, struct command *);
  383. extern void dotime (Char **, struct command *);
  384. #ifdef BSDTIMES
  385. extern void prusage (struct sysrusage *,
  386. struct sysrusage *,
  387. timeval_t *, timeval_t *);
  388. extern void ruadd (struct sysrusage *,
  389. struct sysrusage *);
  390. #else /* BSDTIMES */
  391. # ifdef _SEQUENT_
  392. extern void prusage (struct process_stats *,
  393. struct process_stats *,
  394. timeval_t *, timeval_t *);
  395. extern void ruadd (struct process_stats *,
  396. struct process_stats *);
  397. # else /* !_SEQUENT_ */
  398. # ifdef POSIX
  399. extern void prusage (struct tms *, struct tms *,
  400. clock_t, clock_t);
  401. # else /* !POSIX */
  402. extern void prusage (struct tms *, struct tms *,
  403. time_t, time_t);
  404. # endif /* !POSIX */
  405. # endif /* !_SEQUENT_ */
  406. #endif /* BSDTIMES */
  407. extern void settimes (void);
  408. #if defined(BSDTIMES) || defined(_SEQUENT_)
  409. extern void tvsub (struct timeval *,
  410. struct timeval *,
  411. struct timeval *);
  412. #endif /* BSDTIMES || _SEQUENT_ */
  413. /*
  414. * tw.parse.c
  415. */
  416. extern void copyn (Char *, const Char *, size_t);
  417. extern void catn (Char *, const Char *, int);
  418. #endif /* _h_sh_decls */