PageRenderTime 72ms CodeModel.GetById 16ms app.highlight 52ms RepoModel.GetById 1ms app.codeStats 0ms

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