xref: /freebsd/contrib/tcsh/tc.decls.h (revision 18054d0220cfc8df9c9568c437bd6fbb59d53c3c)
1 /*
2  * tc.decls.h: Function declarations from all the tcsh modules
3  */
4 /*-
5  * Copyright (c) 1980, 1991 The Regents of the University of California.
6  * 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 #ifndef _h_tc_decls
33 #define _h_tc_decls
34 
35 struct blk_buf;
36 struct strbuf;
37 struct Strbuf;
38 
39 /*
40  * tc.alloc.c
41  */
42 #ifndef SYSMALLOC
43 #ifndef WINNT_NATIVE
44 #ifndef __linux__
45 extern	void		  free		(ptr_t);
46 extern	memalign_t	  malloc	(size_t);
47 extern	memalign_t	  realloc	(ptr_t, size_t);
48 extern	memalign_t	  calloc	(size_t, size_t);
49 #endif
50 #endif /* !WINNT_NATIVE */
51 #else /* SYSMALLOC */
52 extern	void		  sfree		(ptr_t);
53 extern	memalign_t	  smalloc	(size_t);
54 extern	memalign_t	  srealloc	(ptr_t, size_t);
55 extern	memalign_t	  scalloc	(size_t, size_t);
56 #endif /* SYSMALLOC */
57 extern	void		  showall	(Char **, struct command *);
58 
59 /*
60  * tc.bind.c
61  */
62 extern	void		  dobindkey	(Char **, struct command *);
63 
64 /*
65  * tc.defs.c:
66  */
67 extern	void		  getmachine	(void);
68 
69 
70 /*
71  * tc.disc.c
72  */
73 extern	int		  setdisc	(int);
74 extern	int		  resetdisc	(int);
75 
76 /*
77  * tc.func.c
78  */
79 extern	Char		 *expand_lex    (const struct wordent *, int, int);
80 extern	Char		 *sprlex	(const struct wordent *);
81 extern	Char		 *Itoa		(int, size_t, Char);
82 extern	void		  dolist	(Char **, struct command *);
83 extern	void		  dotermname	(Char **, struct command *);
84 extern	void		  dotelltc	(Char **, struct command *);
85 extern	void		  doechotc	(Char **, struct command *);
86 extern	void		  dosettc	(Char **, struct command *);
87 extern	int		  cmd_expand	(Char *, Char **);
88 extern	void		  dowhich	(Char **, struct command *);
89 extern	struct process	 *find_stop_ed	(void);
90 extern	void		  fg_proc_entry	(struct process *);
91 extern	void		  alrmcatch	(void);
92 extern	void		  precmd	(void);
93 extern	void		  postcmd	(void);
94 extern	void		  cwd_cmd	(void);
95 extern	void		  beep_cmd	(void);
96 extern	void		  period_cmd	(void);
97 extern	void		  job_cmd	(Char *);
98 extern	void		  aliasrun	(int, Char *, Char *);
99 extern	void		  setalarm	(int);
100 extern	void		  rmstar	(struct wordent *);
101 extern	void		  continue_jobs	(struct wordent *);
102 extern	Char		 *gettilde	(const Char *);
103 extern	Char		 *getusername	(Char **);
104 #ifdef OBSOLETE
105 extern	void		  doaliases	(Char **, struct command *);
106 #endif /* OBSOLETE */
107 extern	void		  shlvl		(int);
108 extern	int		  fixio		(int, int);
109 extern	int		  collate	(const Char *, const Char *);
110 #ifdef HASHBANG
111 extern	int		  hashbang	(int, Char ***);
112 #endif /* HASHBANG */
113 #ifdef REMOTEHOST
114 extern	void		  remotehost	(void);
115 #endif /* REMOTEHOST */
116 
117 
118 /*
119  * tc.os.c
120  */
121 #ifdef MACH
122 extern	void		  dosetpath	(Char **, struct command *);
123 #endif /* MACH */
124 
125 #ifdef TCF
126 extern	void		  dogetxvers	(Char **, struct command *);
127 extern	void		  dosetxvers	(Char **, struct command *);
128 extern	void		  dogetspath	(Char **, struct command *);
129 extern	void		  dosetspath	(Char **, struct command *);
130 extern	char		 *sitename	(pid_t);
131 extern	void		  domigrate	(Char **, struct command *);
132 #endif /* TCF */
133 
134 #ifdef WARP
135 extern	void 		  dowarp	(Char **, struct command *);
136 #endif /* WARP */
137 
138 #if defined(_CRAY) && !defined(_CRAYMPP)
139 extern	void 		  dodmmode	(Char **, struct command *);
140 #endif /* _CRAY && !_CRAYMPP */
141 
142 #if defined(masscomp) || defined(hcx)
143 extern	void		  douniverse	(Char **, struct command *);
144 #endif /* masscomp */
145 
146 #if defined(_OSD_POSIX) /* BS2000 */
147 extern	void		  dobs2cmd	(Char **, struct command *);
148 #endif /* _OSD_POSIX */
149 
150 #if defined(hcx)
151 extern	void		  doatt		(Char **, struct command *);
152 extern	void		  doucb		(Char **, struct command *);
153 #endif /* hcx */
154 
155 #ifdef _SEQUENT_
156 extern	void	 	  pr_stat_sub	(struct process_stats *,
157 					 struct process_stats *,
158 					 struct process_stats *);
159 #endif /* _SEQUENT_ */
160 
161 #ifdef NEEDtcgetpgrp
162 extern	pid_t	 	  xtcgetpgrp	(int);
163 extern	int		  xtcsetpgrp	(int, int);
164 # undef tcgetpgrp
165 # define tcgetpgrp(a) 	  xtcgetpgrp(a)
166 # undef tcsetpgrp
167 # define tcsetpgrp(a, b)  xtcsetpgrp((a), (b))
168 #endif /* NEEDtcgetpgrp */
169 
170 #ifdef YPBUGS
171 extern	void	 	  fix_yp_bugs	(void);
172 #endif /* YPBUGS */
173 #ifdef STRCOLLBUG
174 extern	void	 	  fix_strcoll_bug	(void);
175 #endif /* STRCOLLBUG */
176 
177 extern	void	 	  osinit	(void);
178 
179 #ifndef HAVE_MEMMOVE
180 extern void 		*xmemmove	(void *, const void *, size_t);
181 # define memmove(a, b, c) xmemmove(a, b, c)
182 #endif /* !HAVE_MEMMOVE */
183 
184 #ifndef HAVE_MEMSET
185 extern void 		*xmemset	(void *, int, size_t);
186 # define memset(a, b, c) xmemset(a, b, c)
187 #endif /* !HAVE_MEMSET */
188 
189 
190 #ifndef HAVE_GETCWD
191 extern	char		 *xgetcwd	(char *, size_t);
192 # undef getcwd
193 # define getcwd(a, b) xgetcwd(a, b)
194 #endif /* !HAVE_GETCWD */
195 
196 #ifndef HAVE_GETHOSTNAME
197 extern	int	 	  xgethostname	(char *, int);
198 # undef gethostname
199 # define gethostname(a, b) xgethostname(a, b)
200 #endif /* !HAVE_GETHOSTNAME */
201 
202 #ifndef HAVE_NICE
203 extern	int	 	  xnice	(int);
204 # undef nice
205 # define nice(a)	  xnice(a)
206 #endif /* !HAVE_NICE */
207 
208 #ifndef HAVE_STRERROR
209 extern	char	 	 *xstrerror	(int);
210 # undef strerror
211 # define strerror(a) 	  xstrerror(a)
212 #endif /* !HAVE_STRERROR */
213 
214 #ifdef apollo
215 extern	void		  doinlib	(Char **, struct command *);
216 extern	void		  dover		(Char **, struct command *);
217 extern	void		  dorootnode	(Char **, struct command *);
218 extern	int		  getv		(Char *);
219 #endif /* apollo */
220 
221 
222 /*
223  * tc.printf.h
224  */
225 #ifndef __GNUC__
226 #define __attribute__(a)
227 #endif
228 extern	int		  xprintf	(const char *, ...)
229     __attribute__((__format__(__printf__, 1, 2)));
230 extern	int		  xsnprintf	(char *, size_t, const char *, ...)
231     __attribute__((__format__(__printf__, 3, 4)));
232 extern	char		 *xasprintf	(const char *, ...)
233     __attribute__((__format__(__printf__, 1, 2)));
234 extern	int		  xvprintf	(const char *, va_list)
235     __attribute__((__format__(__printf__, 1, 0)));
236 extern	int		  xvsnprintf	(char *, size_t, const char *, va_list)
237     __attribute__((__format__(__printf__, 3, 0)));
238 extern	char		 *xvasprintf	(const char *, va_list)
239     __attribute__((__format__(__printf__, 1, 0)));
240 
241 /*
242  * tc.prompt.c
243  */
244 extern	void		  dateinit	(void);
245 extern	void		  printprompt	(int, const char *);
246 extern  int 		  expdollar	(struct Strbuf *, const Char **, Char);
247 extern	Char		 *tprintf	(int, const Char *, const char *,
248 					 time_t, ptr_t);
249 
250 /*
251  * tc.sched.c
252  */
253 extern	time_t		  sched_next	(void);
254 extern	void		  dosched	(Char **, struct command *);
255 extern	void		  sched_run	(void);
256 
257 /*
258  * tc.str.c:
259  */
260 #ifdef WIDE_STRINGS
261 extern	size_t		  one_mbtowc	(Char *, const char *, size_t);
262 extern	size_t		  one_wctomb	(char *, Char);
263 extern  int		  rt_mbtowc	(Char *, const char *, size_t);
264 #else
265 #define one_mbtowc(PWC, S, N) \
266 	((void)(N), *(PWC) = (unsigned char)*(S), (size_t)1)
267 #define one_wctomb(S, WCHAR) (*(S) = (char)(WCHAR), (size_t)1)
268 #endif
269 #ifdef SHORT_STRINGS
270 extern	Char		 *s_strchr	(const Char *, int);
271 extern	Char		 *s_strrchr	(const Char *, int);
272 extern	Char		 *s_strcat	(Char *, const Char *);
273 # ifdef NOTUSED
274 extern	Char		 *s_strncat	(Char *, const Char *, size_t);
275 # endif /* NOTUSED */
276 extern	Char		 *s_strcpy	(Char *, const Char *);
277 extern	Char		 *s_strncpy	(Char *, const Char *, size_t);
278 extern	Char		 *s_strspl	(const Char *, const Char *);
279 extern	size_t		  s_strlen	(const Char *);
280 extern	int		  s_strcmp	(const Char *, const Char *);
281 extern	int		  s_strncmp	(const Char *, const Char *, size_t);
282 extern	int		  s_strcasecmp	(const Char *, const Char *);
283 extern	Char		 *s_strnsave	(const Char *, size_t);
284 extern	Char		 *s_strsave	(const Char *);
285 extern	Char		 *s_strend	(const Char *);
286 extern	Char		 *s_strstr	(const Char *, const Char *);
287 extern	Char		 *str2short	(const char *);
288 extern	Char		**blk2short	(char **);
289 extern	char		 *short2str	(const Char *);
290 extern	char		**short2blk	(Char **);
291 #else /* !SHORT_STRINGS */
292 extern	char		 *caching_strip	(const char *);
293 #endif
294 extern	char		 *short2qstr	(const Char *);
295 
296 extern  struct blk_buf   *bb_alloc	(void);
297 extern	void		  bb_append	(struct blk_buf *, Char *);
298 extern	void		  bb_cleanup	(void *);
299 extern	Char		**bb_finish	(struct blk_buf *);
300 extern  void 		  bb_free	(void *);
301 
302 extern	struct strbuf	 *strbuf_alloc(void);
303 extern	void		  strbuf_terminate(struct strbuf *);
304 extern  void		  strbuf_append1(struct strbuf *, char);
305 extern  void		  strbuf_appendn(struct strbuf *, const char *,
306 					 size_t);
307 extern  void		  strbuf_append (struct strbuf *, const char *);
308 extern  char		 *strbuf_finish (struct strbuf *);
309 extern	void		  strbuf_cleanup(void *);
310 extern	void		  strbuf_free(void *);
311 extern	struct Strbuf	 *Strbuf_alloc(void);
312 extern	void		  Strbuf_terminate(struct Strbuf *);
313 extern  void		  Strbuf_append1(struct Strbuf *, Char);
314 extern  void		  Strbuf_appendn(struct Strbuf *, const Char *,
315 					 size_t);
316 extern  void		  Strbuf_append (struct Strbuf *, const Char *);
317 extern  Char		 *Strbuf_finish (struct Strbuf *);
318 extern	void		  Strbuf_cleanup(void *);
319 extern	void		  Strbuf_free(void *);
320 
321 
322 /*
323  * tc.vers.c:
324  */
325 extern	void		  fix_version	(void);
326 
327 /*
328  * tc.who.c
329  */
330 #if defined (HAVE_UTMP_H) || defined (HAVE_UTMPX_H) || defined (WINNT_NATIVE)
331 extern	void		  initwatch	(void);
332 extern	void		  resetwatch	(void);
333 extern	void		  watch_login	(int);
334 extern	char	 	 *who_info	(ptr_t, int);
335 extern	void		  dolog		(Char **, struct command *);
336 # ifdef HAVE_STRUCT_UTMP_UT_HOST
337 extern	char		 *utmphost	(void);
338 extern	size_t		  utmphostsize	(void);
339 # endif /* HAVE_STRUCT_UTMP_UT_HOST */
340 #else
341 # define HAVENOUTMP
342 #endif
343 
344 #endif /* _h_tc_decls */
345