1 /* $OpenBSD: extern.h,v 1.31 2018/09/18 17:48:22 millert 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 char *strspl(char *, char *); 205 void udvar(Char *); 206 207 /* 208 * parse.c 209 */ 210 void alias(struct wordent *); 211 void freesyn(struct command *); 212 struct command * 213 syntax(struct wordent *, struct wordent *, int); 214 215 /* 216 * proc.c 217 */ 218 void dobg(Char **, struct command *); 219 void dobg1(Char **, struct command *); 220 void dofg(Char **, struct command *); 221 void dofg1(Char **, struct command *); 222 void dojobs(Char **, struct command *); 223 void dokill(Char **, struct command *); 224 void donotify(Char **, struct command *); 225 void dostop(Char **, struct command *); 226 void dowait(Char **, struct command *); 227 void palloc(int, struct command *); 228 void panystop(bool); 229 void pchild(int); 230 void pendjob(void); 231 struct process * 232 pfind(Char *); 233 int pfork(struct command *, int); 234 void pgetty(int, int); 235 void pjwait(struct process *); 236 void pnote(void); 237 void prestjob(void); 238 void psavejob(void); 239 void pstart(struct process *, int); 240 void pwait(void); 241 242 /* 243 * sem.c 244 */ 245 void execute(struct command *, int, int *, int *); 246 void mypipe(int *); 247 248 /* 249 * set.c 250 */ 251 struct varent 252 *adrof1(Char *, struct varent *); 253 void doset(Char **, struct command *); 254 void dolet(Char **, struct command *); 255 Char *putn(int); 256 int getn(Char *); 257 Char *value1(Char *, struct varent *); 258 void set(Char *, Char *); 259 void set1(Char *, Char **, struct varent *); 260 void setq(Char *, Char **, struct varent *); 261 void unset(Char **, struct command *); 262 void unset1(Char *[], struct varent *); 263 void unsetv(Char *); 264 void setNS(Char *); 265 void shift(Char **, struct command *); 266 void plist(struct varent *); 267 268 /* 269 * time.c 270 */ 271 void donice(Char **, struct command *); 272 void dotime(Char **, struct command *); 273 void prusage(struct rusage *, struct rusage *, 274 struct timespec *, struct timespec *); 275 void ruadd(struct rusage *, struct rusage *); 276 void settimes(void); 277 void pcsecs(long); 278 void psecs(long); 279 280 /* 281 * alloc.c 282 */ 283 void *xmalloc(size_t); 284 void *xreallocarray(void *, size_t, size_t); 285 void *xcalloc(size_t, size_t); 286 char *xstrdup(const char *); 287 288 /* 289 * str.c: 290 */ 291 size_t Strlcpy(Char *, const Char *, size_t); 292 size_t Strlcat(Char *, const Char *, size_t); 293 Char *Strchr(Char *, int); 294 Char *Strrchr(Char *, int); 295 Char *Strspl(Char *, Char *); 296 size_t Strlen(Char *); 297 int Strcmp(Char *, Char *); 298 int Strncmp(Char *, Char *, size_t); 299 Char *Strsave(Char *); 300 Char *Strend(Char *); 301 Char *Strstr(Char *, Char *); 302 Char *str2short(char *); 303 Char **blk2short(char **); 304 char *short2str(Char *); 305 char **short2blk(Char **); 306 char *short2qstr(Char *); 307 char *vis_str(Char *); 308