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