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