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