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