1 /* $Header: /p/tcsh/cvsroot/tcsh/sh.decls.h,v 3.64 2013/12/08 22:53:09 christos Exp $ */
3 * sh.decls.h External declarations from sh*.c
6 * Copyright (c) 1980, 1991 The Regents of the University of California.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 extern Char
*gethdir (const Char
*);
40 extern void dosource (Char
**, struct command
*);
41 extern void exitstat (void);
42 extern void goodbye (Char
**, struct command
*);
43 extern void importpath (Char
*);
44 extern void initdesc (void);
45 extern void pintr (void);
46 extern void pintr1 (int);
47 extern void phup (void);
48 extern void process (int);
49 extern void untty (void);
51 extern void done (int) __attribute__((__noreturn__
));
53 extern void xexit (int) __attribute__((__noreturn__
));
55 extern int grabpgrp (int, pid_t
);
60 extern void dinit (Char
*);
61 extern void dodirs (Char
**, struct command
*);
62 extern Char
*dcanon (Char
*, Char
*);
63 extern void dtildepr (Char
*);
64 extern void dtilde (void);
65 extern void dochngd (Char
**, struct command
*);
66 extern Char
*dnormalize (const Char
*, int);
67 extern void dopushd (Char
**, struct command
*);
68 extern void dopopd (Char
**, struct command
*);
69 extern void dfree (struct directory
*);
70 extern void dsetstack (void);
71 extern const Char
*getstakd (int);
72 extern void recdirs (Char
*, int);
73 extern void loaddirs (Char
*);
78 extern void Dfix (struct command
*);
79 extern Char
*Dfix1 (Char
*);
80 extern void heredoc (Char
*);
81 extern Char
*randsuf (void);
86 extern void reset (void) __attribute__((__noreturn__
));
87 extern void cleanup_push_internal(void *, void (*fn
) (void *)
89 , const char *, size_t
90 #define cleanup_push(v, f) cleanup_push_internal(v, f, __FILE__, __LINE__)
92 #define cleanup_push(v, f) cleanup_push_internal(v, f)
95 extern int cleanup_reset(void);
96 extern void cleanup_ignore(void *);
97 extern void cleanup_until(void *);
98 extern void cleanup_until_mark(void);
99 extern size_t cleanup_push_mark(void);
100 extern void cleanup_pop_mark(size_t);
101 extern void open_cleanup(void *);
102 extern void opendir_cleanup(void *);
103 extern void sigint_cleanup(void *);
104 extern void sigprocmask_cleanup(void *);
105 extern void xfree_indirect(void *);
106 extern void errinit (void);
107 extern void seterror (unsigned int, ...);
108 extern void fixerror (void);
109 extern void stderror (unsigned int, ...)
110 __attribute__((__noreturn__
));
115 extern void doexec (struct command
*, int);
116 extern void dohash (Char
**, struct command
*);
117 extern void dounhash (Char
**, struct command
*);
118 extern void execash (Char
**, struct command
*);
119 extern void hashstat (Char
**, struct command
*);
120 extern void xechoit (Char
**);
121 extern int executable (const Char
*, const Char
*, int);
122 extern int tellmewhat (struct wordent
*, Char
**);
123 extern void dowhere (Char
**, struct command
*);
124 extern int find_cmd (Char
*, int);
129 extern Char
*filetest (Char
*, Char
***, int);
130 extern tcsh_number_t
expr (Char
***);
131 extern tcsh_number_t
exp0 (Char
***, int);
136 #if defined(FILEC) && defined(TIOCSTI)
137 extern size_t tenex (Char
*, size_t);
143 extern void tsetenv (const Char
*, const Char
*);
144 extern void Unsetenv (Char
*);
145 extern void doalias (Char
**, struct command
*);
146 extern void dobreak (Char
**, struct command
*);
147 extern void docontin (Char
**, struct command
*);
148 extern void doecho (Char
**, struct command
*);
149 extern void doelse (Char
**, struct command
*);
150 extern void doend (Char
**, struct command
*);
151 extern void doeval (Char
**, struct command
*);
152 extern void doexit (Char
**, struct command
*);
153 extern void doforeach (Char
**, struct command
*);
154 extern void doglob (Char
**, struct command
*);
155 extern void dogoto (Char
**, struct command
*);
156 extern void doif (Char
**, struct command
*);
157 extern void dolimit (Char
**, struct command
*);
158 extern void dologin (Char
**, struct command
*);
159 extern void dologout (Char
**, struct command
*);
161 extern void donewgrp (Char
**, struct command
*);
163 extern void donohup (Char
**, struct command
*);
164 extern void dohup (Char
**, struct command
*);
165 extern void doonintr (Char
**, struct command
*);
166 extern void doprintenv (Char
**, struct command
*);
167 extern void dorepeat (Char
**, struct command
*);
168 extern void dofiletest (Char
**, struct command
*);
169 extern void dosetenv (Char
**, struct command
*);
170 extern void dosuspend (Char
**, struct command
*);
171 extern void doswbrk (Char
**, struct command
*);
172 extern void doswitch (Char
**, struct command
*);
173 extern void doumask (Char
**, struct command
*);
174 extern void dounlimit (Char
**, struct command
*);
175 extern void dounsetenv (Char
**, struct command
*);
176 extern void dowhile (Char
**, struct command
*);
177 extern void dozip (Char
**, struct command
*);
178 extern void func (struct command
*,
179 const struct biltins
*);
180 extern void gotolab (Char
*);
181 extern const struct biltins
*isbfunc (struct command
*);
182 extern void prvars (void);
183 extern int srchx (Char
*);
184 extern void unalias (Char
**, struct command
*);
185 extern void wfree (void);
186 extern void dobuiltins (Char
**, struct command
*);
187 extern void reexecute (struct command
*);
192 extern Char
*globequal (Char
*);
193 extern Char
**dobackp (Char
*, int);
194 extern Char
*globone (Char
*, int);
195 extern int Gmatch (const Char
*, const Char
*);
196 extern int Gnmatch (const Char
*, const Char
*,
198 extern Char
**globall (Char
**, int);
199 extern Char
**glob_all_or_error(Char
**);
200 extern void rscan (Char
**, void (*)(Char
));
201 extern int tglob (Char
**);
202 extern void trim (Char
**);
204 #if !defined(WINNT_NATIVE) && defined(NLS_CATALOGS)
205 extern char *xcatgets (nl_catd
, int, int, const char *);
206 #if defined(HAVE_ICONV) && defined(HAVE_NL_LANGINFO)
207 extern char *iconv_catgets (nl_catd
, int, int, const char *);
210 extern void nlsinit (void);
211 extern void nlsclose (void);
212 extern int t_pmatch (const Char
*, const Char
*,
218 extern void dohist (Char
**, struct command
*);
219 extern struct Hist
*enthist (int, struct wordent
*, int, int, int);
220 extern void savehist (struct wordent
*, int);
221 extern char *fmthist (int, ptr_t
);
222 extern void rechist (Char
*, int);
223 extern void loadhist (Char
*, int);
224 extern void displayHistStats(const char *);
225 extern void sethistory (int);
230 extern void mesginit (void);
235 extern void addla (Char
*);
236 extern void bseek (struct Ain
*);
237 extern void btell (struct Ain
*);
238 extern void btoeof (void);
239 extern void copylex (struct wordent
*, struct wordent
*);
240 extern Char
*domod (Char
*, Char
);
241 extern void freelex (struct wordent
*);
242 extern int lex (struct wordent
*);
243 extern void lex_cleanup (void *);
244 extern void prlex (struct wordent
*);
245 extern eChar
readc (int);
246 extern void settell (void);
247 extern void unreadc (Char
);
253 extern int any (const char *, Char
);
254 extern Char
**blkcpy (Char
**, Char
**);
255 extern void blkfree (Char
**);
256 extern void blk_cleanup (void *);
257 extern void blk_indirect_cleanup(void *);
258 extern int blklen (Char
**);
259 extern void blkpr (Char
*const *);
260 extern Char
*blkexpand (Char
*const *);
261 extern Char
**blkspl (Char
**, Char
**);
262 extern void closem (void);
263 #ifndef CLOSE_ON_EXEC
264 extern void closech (void);
265 #endif /* !CLOSE_ON_EXEC */
266 extern Char
**copyblk (Char
**);
267 extern int dcopy (int, int);
268 extern int dmove (int, int);
269 extern void donefds (void);
270 extern Char
lastchr (Char
*);
271 extern void lshift (Char
**, int);
272 extern int number (Char
*);
273 extern int prefix (const Char
*, const Char
*);
274 extern Char
**saveblk (Char
**);
275 extern void setzero (void *, size_t);
276 extern Char
*strip (Char
*);
277 extern Char
*quote (Char
*);
278 extern const Char
*quote_meta (struct Strbuf
*, const Char
*);
279 #ifndef SHORT_STRINGS
280 extern char *strnsave (const char *, size_t);
282 extern char *strsave (const char *);
283 extern void udvar (Char
*) __attribute__((__noreturn__
));
285 extern char *strstr (const char *, const char *);
287 extern char *strspl (const char *, const char *);
288 extern char *strend (const char *);
289 extern char *areadlink (const char *);
290 extern void xclose (int);
291 extern void xclosedir (DIR *);
292 extern int xcreat (const char *, mode_t
);
293 extern struct group
*xgetgrgid (gid_t
);
294 extern struct passwd
*xgetpwnam (const char *);
295 extern struct passwd
*xgetpwuid (uid_t
);
296 extern int xopen (const char *, int, ...);
297 extern ssize_t
xread (int, void *, size_t);
298 extern int xtcsetattr (int, int, const struct termios
*);
299 extern ssize_t
xwrite (int, const void *, size_t);
304 extern void alias (struct wordent
*);
305 extern void freesyn (struct command
*);
306 extern struct command
*syntax (const struct wordent
*,
307 const struct wordent
*, int);
308 extern void syntax_cleanup(void *);
313 extern void drainoline (void);
314 extern void flush (void);
316 extern void pcsecs (unsigned long);
317 #else /* !BSDTIMES */
319 extern void pcsecs (clock_t);
321 extern void pcsecs (time_t);
323 #endif /* BSDTIMES */
325 extern void psecs (unsigned long);
326 #endif /* BSDLIMIT */
327 extern int putpure (int);
328 extern int putraw (int);
329 extern void xputchar (int);
331 extern void putwraw (Char
);
332 extern void xputwchar (Char
);
334 # define putwraw(C) putraw(C)
335 # define xputwchar(C) xputchar(C)
337 extern void output_raw_restore(void *);
343 extern void dobg (Char
**, struct command
*);
344 extern void dobg1 (Char
**, struct command
*);
345 extern void dofg (Char
**, struct command
*);
346 extern void dofg1 (Char
**, struct command
*);
347 extern void dojobs (Char
**, struct command
*);
348 extern void dokill (Char
**, struct command
*);
349 extern void donotify (Char
**, struct command
*);
350 extern void dostop (Char
**, struct command
*);
351 extern void dowait (Char
**, struct command
*);
352 extern void palloc (pid_t
, struct command
*);
353 extern void panystop (int);
354 extern void pchild (void);
355 extern void pendjob (void);
356 extern pid_t
pfork (struct command
*, int);
357 extern void pgetty (int, pid_t
);
358 extern void pjwait (struct process
*);
359 extern void pnote (void);
360 extern void psavejob (void);
361 extern void psavejob_cleanup(void *);
362 extern int pstart (struct process
*, int);
363 extern void pwait (void);
364 extern struct process
*pfind (Char
*);
369 extern void execute (struct command
*, volatile int, int *,
371 extern void mypipe (int *);
376 extern struct varent
*adrof1 (const Char
*, struct varent
*);
377 extern void doset (Char
**, struct command
*);
378 extern void dolet (Char
**, struct command
*);
379 extern Char
*putn (tcsh_number_t
);
380 extern tcsh_number_t
getn (const Char
*);
381 extern Char
*value1 (Char
*, struct varent
*);
382 extern void setcopy (const Char
*, const Char
*, int);
383 extern void setv (const Char
*, Char
*, int);
384 extern void set1 (const Char
*, Char
**,
385 struct varent
*, int);
386 extern void setq (const Char
*, Char
**,
387 struct varent
*, int);
388 extern void unset (Char
**, struct command
*);
389 extern void unset1 (Char
*[], struct varent
*);
390 extern void unsetv (Char
*);
391 extern void setNS (const Char
*);
392 extern void shift (Char
**, struct command
*);
393 extern void plist (struct varent
*, int);
394 extern Char
*unparse (struct command
*);
395 #if defined(DSPMBYTE)
396 extern void update_dspmbyte_vars (void);
397 extern void autoset_dspmbyte (const Char
*);
399 #if defined(AUTOSET_KANJI)
400 extern void autoset_kanji (void);
402 extern void exportpath (Char
**);
407 extern void donice (Char
**, struct command
*);
408 extern void dotime (Char
**, struct command
*);
410 extern void prusage (struct sysrusage
*,
412 timeval_t
*, timeval_t
*);
413 extern void ruadd (struct sysrusage
*,
417 extern void prusage (struct process_stats
*,
418 struct process_stats
*,
419 timeval_t
*, timeval_t
*);
420 extern void ruadd (struct process_stats
*,
421 struct process_stats
*);
422 # else /* !_SEQUENT_ */
424 extern void prusage (struct tms
*, struct tms
*,
427 extern void prusage (struct tms
*, struct tms
*,
430 # endif /* !_SEQUENT_ */
431 #endif /* BSDTIMES */
432 extern void settimes (void);
433 #if defined(BSDTIMES) || defined(_SEQUENT_)
434 extern void tvsub (struct timeval
*,
437 #endif /* BSDTIMES || _SEQUENT_ */
442 extern void copyn (Char
*, const Char
*, size_t);
443 extern void catn (Char
*, const Char
*, int);
445 #endif /* _h_sh_decls */