1/* 2 * sh.decls.h External declarations from sh*.c 3 */ 4/*- 5 * Copyright (c) 1980, 1991 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of the University nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32#ifndef _h_sh_decls 33#define _h_sh_decls 34 35/* 36 * sh.c 37 */ 38extern Char *gethdir (const Char *); 39extern void dosource (Char **, struct command *); 40extern void exitstat (void); 41extern void goodbye (Char **, struct command *); 42extern void importpath (Char *); 43extern void initdesc (void); 44extern void pintr (void); 45extern void pintr1 (int); 46extern void phup (void); 47extern void process (int); 48extern void untty (void); 49#ifdef PROF 50extern void done (int) __attribute__((__noreturn__)); 51#else 52extern void xexit (int) __attribute__((__noreturn__)); 53#endif 54extern int grabpgrp (int, pid_t); 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 *); 80extern Char *randsuf (void); 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 *); 187extern int getYN (const char *); 188 189/* 190 * sh.glob.c 191 */ 192extern Char *globequal (Char *); 193extern Char **dobackp (Char *, int); 194extern Char *globone (Char *, int); 195extern int Gmatch (const Char *, const Char *); 196extern int Gnmatch (const Char *, const Char *, 197 const Char **); 198extern Char **globall (Char **, int); 199extern Char **glob_all_or_error(Char **); 200extern void rscan (Char **, void (*)(Char)); 201extern int tglob (Char **); 202extern void trim (Char **); 203 204#if !defined(WINNT_NATIVE) && defined(NLS_CATALOGS) 205extern char *xcatgets (nl_catd, int, int, const char *); 206#if defined(HAVE_ICONV) && defined(HAVE_NL_LANGINFO) 207extern char *iconv_catgets (nl_catd, int, int, const char *); 208#endif 209#endif 210extern void nlsinit (void); 211extern void nlsclose (void); 212extern int t_pmatch (const Char *, const Char *, 213 const Char **, int); 214 215/* 216 * sh.hist.c 217 */ 218extern void dohist (Char **, struct command *); 219extern struct Hist *enthist (int, struct wordent *, int, int, int); 220extern void savehist (struct wordent *, int); 221extern char *fmthist (int, ptr_t); 222extern void rechist (Char *, int); 223extern void loadhist (Char *, int); 224extern void displayHistStats(const char *); 225extern void sethistory (int); 226 227/* 228 * sh.init.c 229 */ 230extern void mesginit (void); 231 232/* 233 * sh.lex.c 234 */ 235extern void addla (Char *); 236extern void bseek (struct Ain *); 237extern void btell (struct Ain *); 238extern void btoeof (void); 239extern void copylex (struct wordent *, struct wordent *); 240extern Char *domod (Char *, Char); 241extern void initlex (struct wordent *); 242extern void freelex (struct wordent *); 243extern int lex (struct wordent *); 244extern void lex_cleanup (void *); 245extern void prlex (struct wordent *); 246extern eChar readc (int); 247extern void settell (void); 248extern void unreadc (Char); 249extern ssize_t wide_read (int, Char *, size_t, int); 250 251 252/* 253 * sh.misc.c 254 */ 255extern int any (const char *, Char); 256extern Char **blkcpy (Char **, Char **); 257extern void blkfree (Char **); 258extern void blk_cleanup (void *); 259extern void blk_indirect_cleanup(void *); 260extern int blklen (Char **); 261extern void blkpr (Char *const *); 262extern Char *blkexpand (Char *const *); 263extern Char **blkspl (Char **, Char **); 264extern void closem (void); 265#ifndef CLOSE_ON_EXEC 266extern void closech (void); 267#endif /* !CLOSE_ON_EXEC */ 268extern Char **copyblk (Char **); 269extern int dcopy (int, int); 270extern int dmove (int, int); 271extern void donefds (void); 272extern Char lastchr (Char *); 273extern void lshift (Char **, int); 274extern int number (Char *); 275extern int prefix (const Char *, const Char *); 276extern Char **saveblk (Char **); 277extern void setzero (void *, size_t); 278extern Char *strip (Char *); 279extern Char *quote (Char *); 280extern const Char *quote_meta (struct Strbuf *, const Char *); 281#ifndef SHORT_STRINGS 282extern char *strnsave (const char *, size_t); 283#endif 284extern char *strsave (const char *); 285extern void udvar (Char *) __attribute__((__noreturn__)); 286#ifndef POSIX 287extern char *strstr (const char *, const char *); 288#endif /* !POSIX */ 289extern char *strspl (const char *, const char *); 290extern char *strend (const char *); 291extern char *areadlink (const char *); 292extern void xclose (int); 293extern void xclosedir (DIR *); 294extern int xcreat (const char *, mode_t); 295extern struct group *xgetgrgid (gid_t); 296extern struct passwd *xgetpwnam (const char *); 297extern struct passwd *xgetpwuid (uid_t); 298extern int xopen (const char *, int, ...); 299extern ssize_t xread (int, void *, size_t); 300extern int xtcsetattr (int, int, const struct termios *); 301extern ssize_t xwrite (int, const void *, size_t); 302 303/* 304 * sh.parse.c 305 */ 306extern void alias (struct wordent *); 307extern void freesyn (struct command *); 308extern struct command *syntax (const struct wordent *, 309 const struct wordent *, int); 310extern void syntax_cleanup(void *); 311 312/* 313 * sh.print.c 314 */ 315extern void drainoline (void); 316extern void flush (void); 317#ifdef BSDTIMES 318extern void pcsecs (unsigned long); 319#else /* !BSDTIMES */ 320# ifdef POSIX 321extern void pcsecs (clock_t); 322# else /* !POSIX */ 323extern void pcsecs (time_t); 324# endif /* !POSIX */ 325#endif /* BSDTIMES */ 326#ifdef BSDLIMIT 327extern void psecs (unsigned long); 328#endif /* BSDLIMIT */ 329extern int putpure (int); 330extern int putraw (int); 331extern void xputchar (int); 332#ifdef WIDE_STRINGS 333extern void putwraw (Char); 334extern void xputwchar (Char); 335#else 336# define putwraw(C) putraw(C) 337# define xputwchar(C) xputchar(C) 338#endif 339extern void output_raw_restore(void *); 340 341 342/* 343 * sh.proc.c 344 */ 345extern void dobg (Char **, struct command *); 346extern void dobg1 (Char **, struct command *); 347extern void dofg (Char **, struct command *); 348extern void dofg1 (Char **, struct command *); 349extern void dojobs (Char **, struct command *); 350extern void dokill (Char **, struct command *); 351extern void donotify (Char **, struct command *); 352extern void dostop (Char **, struct command *); 353extern void dowait (Char **, struct command *); 354extern void palloc (pid_t, struct command *); 355extern void panystop (int); 356extern void pchild (void); 357extern void pendjob (void); 358extern pid_t pfork (struct command *, int); 359extern void pgetty (int, pid_t); 360extern void pjwait (struct process *); 361extern void pnote (void); 362extern void psavejob (void); 363extern void psavejob_cleanup(void *); 364extern int pstart (struct process *, int); 365extern void pwait (void); 366extern struct process *pfind (Char *); 367 368/* 369 * sh.sem.c 370 */ 371extern void execute (struct command *, volatile int, int *, 372 int *, int); 373extern void mypipe (int *); 374 375/* 376 * sh.set.c 377 */ 378extern struct varent *adrof1 (const Char *, struct varent *); 379extern void doset (Char **, struct command *); 380extern void dolet (Char **, struct command *); 381extern Char *putn (tcsh_number_t); 382extern tcsh_number_t getn (const Char *); 383extern Char *value1 (Char *, struct varent *); 384extern void setcopy (const Char *, const Char *, int); 385extern void setv (const Char *, Char *, int); 386extern void set1 (const Char *, Char **, 387 struct varent *, int); 388extern void setq (const Char *, Char **, 389 struct varent *, int); 390extern void unset (Char **, struct command *); 391extern void unset1 (Char *[], struct varent *); 392extern void unsetv (Char *); 393extern void setNS (const Char *); 394extern void shift (Char **, struct command *); 395extern void plist (struct varent *, int); 396extern Char *unparse (struct command *); 397#if defined(DSPMBYTE) 398extern void update_dspmbyte_vars (void); 399extern void autoset_dspmbyte (const Char *); 400#endif 401#if defined(AUTOSET_KANJI) 402extern void autoset_kanji (void); 403#endif 404extern void update_wordchars (void); 405 406/* 407 * sh.time.c 408 */ 409extern void donice (Char **, struct command *); 410extern void dotime (Char **, struct command *); 411#ifdef BSDTIMES 412extern void prusage (struct sysrusage *, 413 struct sysrusage *, 414 timeval_t *, timeval_t *); 415extern void ruadd (struct sysrusage *, 416 struct sysrusage *); 417#else /* BSDTIMES */ 418# ifdef _SEQUENT_ 419extern void prusage (struct process_stats *, 420 struct process_stats *, 421 timeval_t *, timeval_t *); 422extern void ruadd (struct process_stats *, 423 struct process_stats *); 424# else /* !_SEQUENT_ */ 425# ifdef POSIX 426extern void prusage (struct tms *, struct tms *, 427 clock_t, clock_t); 428# else /* !POSIX */ 429extern void prusage (struct tms *, struct tms *, 430 time_t, time_t); 431# endif /* !POSIX */ 432# endif /* !_SEQUENT_ */ 433#endif /* BSDTIMES */ 434extern void settimes (void); 435#if defined(BSDTIMES) || defined(_SEQUENT_) 436extern void tvsub (struct timeval *, 437 struct timeval *, 438 struct timeval *); 439#endif /* BSDTIMES || _SEQUENT_ */ 440 441/* 442 * tw.parse.c 443 */ 444extern void copyn (Char *, const Char *, size_t); 445extern void catn (Char *, const Char *, int); 446 447#endif /* _h_sh_decls */ 448