| 1 | /* $NetBSD: extern.h,v 1.31 2019/01/05 16:54:00 christos Exp $ */ |
| 2 | |
| 3 | /*- |
| 4 | * Copyright (c) 1991, 1993 |
| 5 | * The Regents of the University of California. All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. Neither the name of the University nor the names of its contributors |
| 16 | * may be used to endorse or promote products derived from this software |
| 17 | * without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | * SUCH DAMAGE. |
| 30 | * |
| 31 | * @(#)extern.h 8.1 (Berkeley) 5/31/93 |
| 32 | */ |
| 33 | |
| 34 | #ifndef _EXTERN_H_ |
| 35 | #define _EXTERN_H_ |
| 36 | |
| 37 | #include <sys/cdefs.h> |
| 38 | |
| 39 | /* |
| 40 | * csh.c |
| 41 | */ |
| 42 | int gethdir(Char *); |
| 43 | void dosource(Char **, struct command *); |
| 44 | __dead void exitstat(void); |
| 45 | __dead void goodbye(void); |
| 46 | void importpath(Char *); |
| 47 | void initdesc(void); |
| 48 | __dead void pintr(int); |
| 49 | __dead void pintr1(int); |
| 50 | void printprompt(void); |
| 51 | #ifdef EDIT |
| 52 | char *printpromptstr(EditLine *); |
| 53 | #endif |
| 54 | void process(int); |
| 55 | void rechist(void); |
| 56 | void untty(void); |
| 57 | int vis_fputc(int, FILE *); |
| 58 | |
| 59 | #ifdef PROF |
| 60 | __dead void done(int); |
| 61 | #else |
| 62 | __dead void xexit(int); |
| 63 | #endif |
| 64 | |
| 65 | /* |
| 66 | * dir.c |
| 67 | */ |
| 68 | void dinit(Char *); |
| 69 | void dodirs(Char **, struct command *); |
| 70 | Char *dcanon(Char *, Char *); |
| 71 | void dtildepr(Char *, Char *); |
| 72 | void dtilde(void); |
| 73 | void dochngd(Char **, struct command *); |
| 74 | Char *dnormalize(Char *); |
| 75 | void dopushd(Char **, struct command *); |
| 76 | void dopopd(Char **, struct command *); |
| 77 | struct directory; |
| 78 | void dfree(struct directory *); |
| 79 | |
| 80 | /* |
| 81 | * dol.c |
| 82 | */ |
| 83 | void Dfix(struct command *); |
| 84 | Char *Dfix1(Char *); |
| 85 | void heredoc(Char *); |
| 86 | |
| 87 | /* |
| 88 | * err.c |
| 89 | */ |
| 90 | void seterror(int, ...); |
| 91 | __dead void stderror(int, ...); |
| 92 | |
| 93 | /* |
| 94 | * exec.c |
| 95 | */ |
| 96 | __dead void doexec(Char **, struct command *); |
| 97 | void dohash(Char **, struct command *); |
| 98 | void dounhash(Char **, struct command *); |
| 99 | void dowhich(Char **, struct command *); |
| 100 | void execash(Char **, struct command *); |
| 101 | void hashstat(Char **, struct command *); |
| 102 | void xechoit(Char **); |
| 103 | |
| 104 | /* |
| 105 | * exp.c |
| 106 | */ |
| 107 | int expr(Char ***); |
| 108 | int exp0(Char ***, int); |
| 109 | |
| 110 | /* |
| 111 | * file.c |
| 112 | */ |
| 113 | #ifdef FILEC |
| 114 | ssize_t tenex(Char *, size_t); |
| 115 | #endif |
| 116 | |
| 117 | /* |
| 118 | * func.c |
| 119 | */ |
| 120 | void Setenv(Char *, Char *); |
| 121 | void doalias(Char **, struct command *); |
| 122 | void dobreak(Char **, struct command *); |
| 123 | void docontin(Char **, struct command *); |
| 124 | void doecho(Char **, struct command *); |
| 125 | void doelse(Char **, struct command *); |
| 126 | void doend(Char **, struct command *); |
| 127 | void doeval(Char **, struct command *); |
| 128 | void doexit(Char **, struct command *); |
| 129 | void doforeach(Char **, struct command *); |
| 130 | void doglob(Char **, struct command *); |
| 131 | void dogoto(Char **, struct command *); |
| 132 | void doif(Char **, struct command *); |
| 133 | void dolimit(Char **, struct command *); |
| 134 | __dead void dologin(Char **, struct command *); |
| 135 | __dead void dologout(Char **, struct command *); |
| 136 | void donohup(Char **, struct command *); |
| 137 | void doonintr(Char **, struct command *); |
| 138 | void doprintf(Char **, struct command *); |
| 139 | void dorepeat(Char **, struct command *); |
| 140 | void dosetenv(Char **, struct command *); |
| 141 | void dosuspend(Char **, struct command *); |
| 142 | void doswbrk(Char **, struct command *); |
| 143 | void doswitch(Char **, struct command *); |
| 144 | void doumask(Char **, struct command *); |
| 145 | void dounlimit(Char **, struct command *); |
| 146 | void dounsetenv(Char **, struct command *); |
| 147 | void dowhile(Char **, struct command *); |
| 148 | void dozip(Char **, struct command *); |
| 149 | void func(struct command *, struct biltins *); |
| 150 | struct biltins *isbfunc(struct command *); |
| 151 | void prvars(void); |
| 152 | void gotolab(Char *); |
| 153 | int srchx(Char *); |
| 154 | void unalias(Char **, struct command *); |
| 155 | void wfree(void); |
| 156 | |
| 157 | /* |
| 158 | * glob.c |
| 159 | */ |
| 160 | Char **dobackp(Char *, int); |
| 161 | void Gcat(Char *, Char *); |
| 162 | Char *globone(Char *, int); |
| 163 | int Gmatch(Char *, Char *); |
| 164 | void ginit(void); |
| 165 | Char **globall(Char **); |
| 166 | void rscan(Char **, void (*)(int)); |
| 167 | void tglob(Char **); |
| 168 | void trim(Char **); |
| 169 | #ifdef FILEC |
| 170 | int sortscmp(const void *, const void *); |
| 171 | #endif /* FILEC */ |
| 172 | |
| 173 | /* |
| 174 | * hist.c |
| 175 | */ |
| 176 | void dohist(Char **, struct command *); |
| 177 | struct Hist *enthist(int, struct wordent *, int); |
| 178 | #ifdef EDIT |
| 179 | void loadhist(struct Hist *); |
| 180 | #endif |
| 181 | void savehist(struct wordent *); |
| 182 | |
| 183 | /* |
| 184 | * lex.c |
| 185 | */ |
| 186 | void addla(Char *); |
| 187 | void bseek(struct Ain *); |
| 188 | void btell(struct Ain *); |
| 189 | void btoeof(void); |
| 190 | void copylex(struct wordent *, struct wordent *); |
| 191 | Char *domod(Char *, int); |
| 192 | void freelex(struct wordent *); |
| 193 | int lex(struct wordent *); |
| 194 | void prlex(FILE *, struct wordent *); |
| 195 | #ifdef EDIT |
| 196 | int sprlex(char **, struct wordent *); |
| 197 | #endif |
| 198 | int readc(int); |
| 199 | void settell(void); |
| 200 | void unreadc(int); |
| 201 | |
| 202 | /* |
| 203 | * misc.c |
| 204 | */ |
| 205 | int any(const char *, int); |
| 206 | Char **blkcat(Char **, Char **); |
| 207 | Char **blkcpy(Char **, Char **); |
| 208 | Char **blkend(Char **); |
| 209 | void blkfree(Char **); |
| 210 | int blklen(Char **); |
| 211 | void blkpr(FILE *, Char **); |
| 212 | Char **blkspl(Char **, Char **); |
| 213 | void closem(void); |
| 214 | Char **copyblk(Char **); |
| 215 | int dcopy(int, int); |
| 216 | int dmove(int, int); |
| 217 | void donefds(void); |
| 218 | Char lastchr(Char *); |
| 219 | void lshift(Char **, size_t); |
| 220 | int number(Char *); |
| 221 | int prefix(Char *, Char *); |
| 222 | Char **saveblk(Char **); |
| 223 | Char *strip(Char *); |
| 224 | Char *quote(Char *); |
| 225 | char *strsave(const char *); |
| 226 | char *strspl(char *, char *); |
| 227 | __dead void udvar(Char *); |
| 228 | |
| 229 | #ifndef SHORT_STRINGS |
| 230 | # ifdef NOTUSED |
| 231 | char *strstr(const char *, const char *); |
| 232 | # endif /* NOTUSED */ |
| 233 | char *strend(char *); |
| 234 | #endif |
| 235 | |
| 236 | /* |
| 237 | * parse.c |
| 238 | */ |
| 239 | void alias(struct wordent *); |
| 240 | void freesyn(struct command *); |
| 241 | struct command *syntax(struct wordent *, struct wordent *, int); |
| 242 | |
| 243 | |
| 244 | /* |
| 245 | * proc.c |
| 246 | */ |
| 247 | void dobg(Char **, struct command *); |
| 248 | void dobg1(Char **, struct command *); |
| 249 | void dofg(Char **, struct command *); |
| 250 | void dofg1(Char **, struct command *); |
| 251 | void dojobs(Char **, struct command *); |
| 252 | void dokill(Char **, struct command *); |
| 253 | void donotify(Char **, struct command *); |
| 254 | void dostop(Char **, struct command *); |
| 255 | void dowait(Char **, struct command *); |
| 256 | void palloc(int, struct command *); |
| 257 | void panystop(int); |
| 258 | void pchild(int); |
| 259 | void pendjob(void); |
| 260 | struct process *pfind(Char *); |
| 261 | int pfork(struct command *, int); |
| 262 | void pgetty(int, int); |
| 263 | void pjwait(struct process *); |
| 264 | void pnote(void); |
| 265 | void prestjob(void); |
| 266 | void psavejob(void); |
| 267 | void pstart(struct process *, int); |
| 268 | void pwait(void); |
| 269 | |
| 270 | /* |
| 271 | * sem.c |
| 272 | */ |
| 273 | void execute(struct command *, int, int *, int *); |
| 274 | void mypipe(int *); |
| 275 | |
| 276 | /* |
| 277 | * set.c |
| 278 | */ |
| 279 | struct varent*adrof1(Char *, struct varent *); |
| 280 | void doset(Char **, struct command *); |
| 281 | void dolet(Char **, struct command *); |
| 282 | Char *putn(int); |
| 283 | int getn(Char *); |
| 284 | Char *value1(Char *, struct varent *); |
| 285 | void set(Char *, Char *); |
| 286 | void set1(Char *, Char **, struct varent *); |
| 287 | void setq(Char *, Char **, struct varent *); |
| 288 | void unset(Char **, struct command *); |
| 289 | void unset1(Char *[], struct varent *); |
| 290 | void unsetv(Char *); |
| 291 | void setNS(Char *); |
| 292 | void shift(Char **, struct command *); |
| 293 | void plist(struct varent *); |
| 294 | |
| 295 | /* |
| 296 | * time.c |
| 297 | */ |
| 298 | void donice(Char **, struct command *); |
| 299 | void dotime(Char **, struct command *); |
| 300 | void prusage1(FILE *, const char *, struct rusage *, struct rusage *, |
| 301 | struct timespec *, struct timespec *); |
| 302 | void prusage(FILE *, struct rusage *, struct rusage *, struct timespec *, |
| 303 | struct timespec *); |
| 304 | void ruadd(struct rusage *, struct rusage *); |
| 305 | void settimes(void); |
| 306 | void psecs(long); |
| 307 | |
| 308 | /* |
| 309 | * alloc.c |
| 310 | */ |
| 311 | void Free(void *); |
| 312 | void * Malloc(size_t); |
| 313 | void *Realloc(void *, size_t); |
| 314 | void *Calloc(size_t, size_t); |
| 315 | |
| 316 | /* |
| 317 | * str.c: |
| 318 | */ |
| 319 | #ifdef SHORT_STRINGS |
| 320 | Char *s_strchr(const Char *, int); |
| 321 | Char *s_strrchr(const Char *, int); |
| 322 | Char *s_strcat(Char *, const Char *); |
| 323 | #ifdef NOTUSED |
| 324 | Char *s_strncat(Char *, const Char *, size_t); |
| 325 | #endif |
| 326 | Char *s_strcpy(Char *, const Char *); |
| 327 | Char *s_strncpy(Char *, const Char *, size_t); |
| 328 | Char *s_strspl(const Char *, const Char *); |
| 329 | size_t s_strlen(const Char *); |
| 330 | int s_strcmp(const Char *, const Char *); |
| 331 | int s_strncmp(const Char *, const Char *, size_t); |
| 332 | Char *s_strsave(const Char *); |
| 333 | Char *s_strend(const Char *); |
| 334 | Char *s_strstr(const Char *, const Char *); |
| 335 | Char *str2short(const char *); |
| 336 | Char **blk2short(char **); |
| 337 | char *short2str(const Char *); |
| 338 | char **short2blk(Char * const *); |
| 339 | #endif |
| 340 | char *short2qstr(const Char *); |
| 341 | char *vis_str(const Char *); |
| 342 | |
| 343 | #endif /* !_EXTERN_H_ */ |
| 344 | |