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