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