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