1/* $OpenBSD: extern.h,v 1.32 2024/05/21 05:00:47 jsg Exp $ */ 2/* $NetBSD: extern.h,v 1.8 1996/10/31 23:50:54 christos Exp $ */ 3 4/*- 5 * Copyright (c) 1991, 1993 6 * The Regents of the University of California. 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 * @(#)extern.h 8.1 (Berkeley) 5/31/93 33 */ 34 35/* 36 * csh.c 37 */ 38int gethdir(Char *, int); 39void dosource(Char **, struct command *); 40void exitstat(void); 41void goodbye(void); 42void importpath(Char *); 43void initdesc(void); 44void pintr(int); 45void pintr1(bool); 46void printprompt(void); 47void process(bool); 48void rechist(void); 49void untty(void); 50int vis_fputc(int, FILE *); 51void xexit(int); 52 53/* 54 * dir.c 55 */ 56void dinit(Char *); 57void dodirs(Char **, struct command *); 58Char *dcanon(Char *, Char *); 59void dtildepr(Char *, Char *); 60void dtilde(void); 61void dochngd(Char **, struct command *); 62Char *dnormalize(Char *); 63void dopushd(Char **, struct command *); 64void dopopd(Char **, struct command *); 65struct directory; 66void dfree(struct directory *); 67 68/* 69 * dol.c 70 */ 71void Dfix(struct command *); 72Char *Dfix1(Char *); 73void heredoc(Char *); 74 75/* 76 * err.c 77 */ 78void seterror(int, ...); 79void stderror(int, ...); 80 81/* 82 * exec.c 83 */ 84void doexec(Char **, struct command *); 85void dohash(Char **, struct command *); 86void dounhash(Char **, struct command *); 87void dowhich(Char **, struct command *); 88void execash(Char **, struct command *); 89void hashstat(Char **, struct command *); 90void xechoit(Char **); 91 92/* 93 * exp.c 94 */ 95int expr(Char ***); 96int exp0(Char ***, bool); 97 98/* 99 * file.c 100 */ 101int tenex(Char *, int); 102 103/* 104 * func.c 105 */ 106void Setenv(Char *, Char *); 107void doalias(Char **, struct command *); 108void dobreak(Char **, struct command *); 109void docontin(Char **, struct command *); 110void doecho(Char **, struct command *); 111void doelse(Char **, struct command *); 112void doend(Char **, struct command *); 113void doeval(Char **, struct command *); 114void doexit(Char **, struct command *); 115void doforeach(Char **, struct command *); 116void doglob(Char **, struct command *); 117void dogoto(Char **, struct command *); 118void doif(Char **, struct command *); 119void dolimit(Char **, struct command *); 120void dologin(Char **, struct command *); 121void dologout(Char **, struct command *); 122void donohup(Char **, struct command *); 123void doonintr(Char **, struct command *); 124void dorepeat(Char **, struct command *); 125void dosetenv(Char **, struct command *); 126void dosuspend(Char **, struct command *); 127void doswbrk(Char **, struct command *); 128void doswitch(Char **, struct command *); 129void doumask(Char **, struct command *); 130void dounlimit(Char **, struct command *); 131void dounsetenv(Char **, struct command *); 132void dowhile(Char **, struct command *); 133void dozip(Char **, struct command *); 134void func(struct command *, struct biltins *); 135struct biltins * 136 isbfunc(struct command *); 137void prvars(void); 138void gotolab(Char *); 139int srchx(Char *); 140void unalias(Char **, struct command *); 141void wfree(void); 142 143/* 144 * glob.c 145 */ 146Char **dobackp(Char *, bool); 147void Gcat(Char *, Char *); 148Char *globone(Char *, int); 149int Gmatch(Char *, Char *); 150void ginit(void); 151Char **globall(Char **); 152void rscan(Char **, void (*)(int)); 153void tglob(Char **); 154void trim(Char **); 155int sortscmp(const void *, const void *); 156 157/* 158 * hist.c 159 */ 160void dohist(Char **, struct command *); 161struct Hist * 162 enthist(int, struct wordent *, bool); 163void savehist(struct wordent *); 164 165/* 166 * lex.c 167 */ 168void addla(Char *); 169void bseek(struct Ain *); 170void btell(struct Ain *); 171void btoeof(void); 172void copylex(struct wordent *, struct wordent *); 173Char *domod(Char *, int); 174void freelex(struct wordent *); 175int lex(struct wordent *); 176void prlex(FILE *, struct wordent *); 177int readc(bool); 178void settell(void); 179void unreadc(int); 180 181/* 182 * misc.c 183 */ 184int any(char *, int); 185Char **blkcat(Char **, Char **); 186Char **blkcpy(Char **, Char **); 187Char **blkend(Char **); 188void blkfree(Char **); 189int blklen(Char **); 190void blkpr(FILE *, Char **); 191Char **blkspl(Char **, Char **); 192void closem(void); 193Char **copyblk(Char **); 194int dcopy(int, int); 195int dmove(int, int); 196void donefds(void); 197Char lastchr(Char *); 198void lshift(Char **, int); 199int number(Char *); 200int prefix(Char *, Char *); 201Char **saveblk(Char **); 202Char *strip(Char *); 203Char *quote(Char *); 204void udvar(Char *); 205 206/* 207 * parse.c 208 */ 209void alias(struct wordent *); 210void freesyn(struct command *); 211struct command * 212 syntax(struct wordent *, struct wordent *, int); 213 214/* 215 * proc.c 216 */ 217void dobg(Char **, struct command *); 218void dobg1(Char **, struct command *); 219void dofg(Char **, struct command *); 220void dofg1(Char **, struct command *); 221void dojobs(Char **, struct command *); 222void dokill(Char **, struct command *); 223void donotify(Char **, struct command *); 224void dostop(Char **, struct command *); 225void dowait(Char **, struct command *); 226void palloc(int, struct command *); 227void panystop(bool); 228void pchild(int); 229void pendjob(void); 230struct process * 231 pfind(Char *); 232int pfork(struct command *, int); 233void pgetty(int, int); 234void pjwait(struct process *); 235void pnote(void); 236void prestjob(void); 237void psavejob(void); 238void pstart(struct process *, int); 239void pwait(void); 240 241/* 242 * sem.c 243 */ 244void execute(struct command *, int, int *, int *); 245void mypipe(int *); 246 247/* 248 * set.c 249 */ 250struct varent 251 *adrof1(Char *, struct varent *); 252void doset(Char **, struct command *); 253void dolet(Char **, struct command *); 254Char *putn(int); 255int getn(Char *); 256Char *value1(Char *, struct varent *); 257void set(Char *, Char *); 258void set1(Char *, Char **, struct varent *); 259void setq(Char *, Char **, struct varent *); 260void unset(Char **, struct command *); 261void unset1(Char *[], struct varent *); 262void unsetv(Char *); 263void setNS(Char *); 264void shift(Char **, struct command *); 265void plist(struct varent *); 266 267/* 268 * time.c 269 */ 270void donice(Char **, struct command *); 271void dotime(Char **, struct command *); 272void prusage(struct rusage *, struct rusage *, 273 struct timespec *, struct timespec *); 274void ruadd(struct rusage *, struct rusage *); 275void settimes(void); 276void pcsecs(long); 277void psecs(long); 278 279/* 280 * alloc.c 281 */ 282void *xmalloc(size_t); 283void *xreallocarray(void *, size_t, size_t); 284void *xcalloc(size_t, size_t); 285char *xstrdup(const char *); 286 287/* 288 * str.c: 289 */ 290size_t Strlcpy(Char *, const Char *, size_t); 291size_t Strlcat(Char *, const Char *, size_t); 292Char *Strchr(Char *, int); 293Char *Strrchr(Char *, int); 294Char *Strspl(Char *, Char *); 295size_t Strlen(Char *); 296int Strcmp(Char *, Char *); 297int Strncmp(Char *, Char *, size_t); 298Char *Strsave(Char *); 299Char *Strend(Char *); 300Char *Strstr(Char *, Char *); 301Char *str2short(char *); 302Char **blk2short(char **); 303char *short2str(Char *); 304char **short2blk(Char **); 305char *short2qstr(Char *); 306char *vis_str(Char *); 307