tc.decls.h revision 195609
1170754Sdelphij/* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.64 2008/05/14 20:10:30 christos Exp $ */ 2170754Sdelphij/* 3170754Sdelphij * tc.decls.h: Function declarations from all the tcsh modules 4170754Sdelphij */ 5170754Sdelphij/*- 6170754Sdelphij * Copyright (c) 1980, 1991 The Regents of the University of California. 7170754Sdelphij * All rights reserved. 8170754Sdelphij * 9170754Sdelphij * Redistribution and use in source and binary forms, with or without 10170754Sdelphij * modification, are permitted provided that the following conditions 11170754Sdelphij * are met: 12170754Sdelphij * 1. Redistributions of source code must retain the above copyright 13170754Sdelphij * notice, this list of conditions and the following disclaimer. 14170754Sdelphij * 2. Redistributions in binary form must reproduce the above copyright 15170754Sdelphij * notice, this list of conditions and the following disclaimer in the 16170754Sdelphij * documentation and/or other materials provided with the distribution. 17170754Sdelphij * 3. Neither the name of the University nor the names of its contributors 18170754Sdelphij * may be used to endorse or promote products derived from this software 19170754Sdelphij * without specific prior written permission. 20170754Sdelphij * 21170754Sdelphij * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22170754Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23170754Sdelphij * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24170754Sdelphij * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25170754Sdelphij * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26170754Sdelphij * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27170754Sdelphij * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28170754Sdelphij * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29170754Sdelphij * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30170754Sdelphij * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31170754Sdelphij * SUCH DAMAGE. 32170754Sdelphij */ 33170754Sdelphij#ifndef _h_tc_decls 34170754Sdelphij#define _h_tc_decls 35170754Sdelphij 36170754Sdelphijstruct blk_buf; 37170754Sdelphijstruct strbuf; 38170754Sdelphijstruct Strbuf; 39170754Sdelphij 40170754Sdelphij/* 41170754Sdelphij * tc.alloc.c 42170754Sdelphij */ 43170754Sdelphij#ifndef SYSMALLOC 44170754Sdelphij#ifndef WINNT_NATIVE 45170754Sdelphij#ifndef __linux__ 46170754Sdelphijextern void free (ptr_t); 47170754Sdelphijextern memalign_t malloc (size_t); 48170754Sdelphijextern memalign_t realloc (ptr_t, size_t); 49170754Sdelphijextern memalign_t calloc (size_t, size_t); 50170754Sdelphij#endif 51170754Sdelphij#endif /* !WINNT_NATIVE */ 52170754Sdelphij#else /* SYSMALLOC */ 53170754Sdelphijextern void sfree (ptr_t); 54170754Sdelphijextern memalign_t smalloc (size_t); 55170754Sdelphijextern memalign_t srealloc (ptr_t, size_t); 56170754Sdelphijextern memalign_t scalloc (size_t, size_t); 57170754Sdelphij#endif /* SYSMALLOC */ 58170754Sdelphijextern void showall (Char **, struct command *); 59170754Sdelphij 60170754Sdelphij/* 61170754Sdelphij * tc.bind.c 62170754Sdelphij */ 63170754Sdelphijextern void dobindkey (Char **, struct command *); 64170754Sdelphij 65170754Sdelphij/* 66170754Sdelphij * tc.defs.c: 67170754Sdelphij */ 68170754Sdelphijextern void getmachine (void); 69170754Sdelphij 70170754Sdelphij 71170754Sdelphij/* 72170754Sdelphij * tc.disc.c 73170754Sdelphij */ 74170754Sdelphijextern int setdisc (int); 75170754Sdelphijextern int resetdisc (int); 76170754Sdelphij 77170754Sdelphij/* 78170754Sdelphij * tc.func.c 79170754Sdelphij */ 80170754Sdelphijextern Char *expand_lex (const struct wordent *, int, int); 81170754Sdelphijextern Char *sprlex (const struct wordent *); 82170754Sdelphijextern Char *Itoa (int, size_t, Char); 83170754Sdelphijextern void dolist (Char **, struct command *); 84170754Sdelphijextern void dotermname (Char **, struct command *); 85170754Sdelphijextern void dotelltc (Char **, struct command *); 86170754Sdelphijextern void doechotc (Char **, struct command *); 87170754Sdelphijextern void dosettc (Char **, struct command *); 88170754Sdelphijextern int cmd_expand (Char *, Char **); 89170754Sdelphijextern void dowhich (Char **, struct command *); 90170754Sdelphijextern struct process *find_stop_ed (void); 91170754Sdelphijextern void fg_proc_entry (struct process *); 92170754Sdelphijextern void alrmcatch (void); 93170754Sdelphijextern void precmd (void); 94170754Sdelphijextern void postcmd (void); 95170754Sdelphijextern void cwd_cmd (void); 96170754Sdelphijextern void beep_cmd (void); 97170754Sdelphijextern void period_cmd (void); 98170754Sdelphijextern void job_cmd (Char *); 99170754Sdelphijextern void aliasrun (int, Char *, Char *); 100170754Sdelphijextern void setalarm (int); 101170754Sdelphijextern void rmstar (struct wordent *); 102170754Sdelphijextern void continue_jobs (struct wordent *); 103170754Sdelphijextern Char *gettilde (const Char *); 104170754Sdelphijextern Char *getusername (Char **); 105170754Sdelphij#ifdef OBSOLETE 106170754Sdelphijextern void doaliases (Char **, struct command *); 107170754Sdelphij#endif /* OBSOLETE */ 108170754Sdelphijextern void shlvl (int); 109170754Sdelphijextern int fixio (int, int); 110170754Sdelphijextern int collate (const Char *, const Char *); 111170754Sdelphij#ifdef HASHBANG 112170754Sdelphijextern int hashbang (int, Char ***); 113170754Sdelphij#endif /* HASHBANG */ 114170754Sdelphij#ifdef REMOTEHOST 115170754Sdelphijextern void remotehost (void); 116170754Sdelphij#endif /* REMOTEHOST */ 117170754Sdelphij 118170754Sdelphij 119170754Sdelphij/* 120170754Sdelphij * tc.os.c 121170754Sdelphij */ 122170754Sdelphij#ifdef MACH 123170754Sdelphijextern void dosetpath (Char **, struct command *); 124170754Sdelphij#endif /* MACH */ 125170754Sdelphij 126170754Sdelphij#ifdef TCF 127170754Sdelphijextern void dogetxvers (Char **, struct command *); 128170754Sdelphijextern void dosetxvers (Char **, struct command *); 129170754Sdelphijextern void dogetspath (Char **, struct command *); 130170754Sdelphijextern void dosetspath (Char **, struct command *); 131170754Sdelphijextern char *sitename (pid_t); 132170754Sdelphijextern void domigrate (Char **, struct command *); 133170754Sdelphij#endif /* TCF */ 134170754Sdelphij 135170754Sdelphij#ifdef WARP 136170754Sdelphijextern void dowarp (Char **, struct command *); 137170754Sdelphij#endif /* WARP */ 138170754Sdelphij 139170754Sdelphij#if defined(_CRAY) && !defined(_CRAYMPP) 140170754Sdelphijextern void dodmmode (Char **, struct command *); 141170754Sdelphij#endif /* _CRAY && !_CRAYMPP */ 142170754Sdelphij 143170754Sdelphij#if defined(masscomp) || defined(hcx) 144170754Sdelphijextern void douniverse (Char **, struct command *); 145170754Sdelphij#endif /* masscomp */ 146170754Sdelphij 147170754Sdelphij#if defined(_OSD_POSIX) /* BS2000 */ 148170754Sdelphijextern void dobs2cmd (Char **, struct command *); 149170754Sdelphij#endif /* _OSD_POSIX */ 150170754Sdelphij 151170754Sdelphij#if defined(hcx) 152170754Sdelphijextern void doatt (Char **, struct command *); 153170754Sdelphijextern void doucb (Char **, struct command *); 154170754Sdelphij#endif /* hcx */ 155170754Sdelphij 156170754Sdelphij#ifdef _SEQUENT_ 157170754Sdelphijextern void pr_stat_sub (struct process_stats *, 158170754Sdelphij struct process_stats *, 159170754Sdelphij struct process_stats *); 160170754Sdelphij#endif /* _SEQUENT_ */ 161170754Sdelphij 162170754Sdelphij#ifdef NEEDtcgetpgrp 163170754Sdelphijextern pid_t xtcgetpgrp (int); 164170754Sdelphijextern int xtcsetpgrp (int, int); 165170754Sdelphij# undef tcgetpgrp 166170754Sdelphij# define tcgetpgrp(a) xtcgetpgrp(a) 167170754Sdelphij# undef tcsetpgrp 168170754Sdelphij# define tcsetpgrp(a, b) xtcsetpgrp((a), (b)) 169170754Sdelphij#endif /* NEEDtcgetpgrp */ 170170754Sdelphij 171170754Sdelphij#ifdef YPBUGS 172170754Sdelphijextern void fix_yp_bugs (void); 173170754Sdelphij#endif /* YPBUGS */ 174170754Sdelphij#ifdef STRCOLLBUG 175170754Sdelphijextern void fix_strcoll_bug (void); 176170754Sdelphij#endif /* STRCOLLBUG */ 177170754Sdelphij 178170754Sdelphijextern void osinit (void); 179170754Sdelphij 180170754Sdelphij#ifndef HAVE_MEMMOVE 181170754Sdelphijextern void *xmemmove (void *, const void *, size_t); 182170754Sdelphij# define memmove(a, b, c) xmemmove(a, b, c) 183170754Sdelphij#endif /* !HAVE_MEMMOVE */ 184170754Sdelphij 185170754Sdelphij#ifndef HAVE_MEMSET 186170754Sdelphijextern void *xmemset (void *, int, size_t); 187170754Sdelphij# define memset(a, b, c) xmemset(a, b, c) 188170754Sdelphij#endif /* !HAVE_MEMSET */ 189170754Sdelphij 190170754Sdelphij 191170754Sdelphij#ifndef HAVE_GETCWD 192170754Sdelphijextern char *xgetcwd (char *, size_t); 193170754Sdelphij# undef getcwd 194170754Sdelphij# define getcwd(a, b) xgetcwd(a, b) 195170754Sdelphij#endif /* !HAVE_GETCWD */ 196170754Sdelphij 197170754Sdelphij#ifndef HAVE_GETHOSTNAME 198170754Sdelphijextern int xgethostname (char *, int); 199170754Sdelphij# undef gethostname 200170754Sdelphij# define gethostname(a, b) xgethostname(a, b) 201170754Sdelphij#endif /* !HAVE_GETHOSTNAME */ 202170754Sdelphij 203170754Sdelphij#ifndef HAVE_NICE 204170754Sdelphijextern int xnice (int); 205170754Sdelphij# undef nice 206170754Sdelphij# define nice(a) xnice(a) 207170754Sdelphij#endif /* !HAVE_NICE */ 208170754Sdelphij 209170754Sdelphij#ifndef HAVE_STRERROR 210170754Sdelphijextern char *xstrerror (int); 211170754Sdelphij# undef strerror 212170754Sdelphij# define strerror(a) xstrerror(a) 213170754Sdelphij#endif /* !HAVE_STRERROR */ 214170754Sdelphij 215170754Sdelphij#ifdef apollo 216170754Sdelphijextern void doinlib (Char **, struct command *); 217170754Sdelphijextern void dover (Char **, struct command *); 218170754Sdelphijextern void dorootnode (Char **, struct command *); 219170754Sdelphijextern int getv (Char *); 220170754Sdelphij#endif /* apollo */ 221170754Sdelphij 222170754Sdelphij 223170754Sdelphij/* 224170754Sdelphij * tc.printf.h 225170754Sdelphij */ 226170754Sdelphij#ifndef __GNUC__ 227170754Sdelphij#define __attribute__(a) 228170754Sdelphij#endif 229170754Sdelphijextern pret_t xprintf (const char *, ...) 230170754Sdelphij __attribute__((__format__(__printf__, 1, 2))); 231170754Sdelphijextern pret_t xsnprintf (char *, size_t, const char *, ...) 232170754Sdelphij __attribute__((__format__(__printf__, 3, 4))); 233170754Sdelphijextern char *xasprintf (const char *, ...) 234170754Sdelphij __attribute__((__format__(__printf__, 1, 2))); 235170754Sdelphijextern pret_t xvprintf (const char *, va_list) 236170754Sdelphij __attribute__((__format__(__printf__, 1, 0))); 237170754Sdelphijextern pret_t xvsnprintf (char *, size_t, const char *, va_list) 238170754Sdelphij __attribute__((__format__(__printf__, 3, 0))); 239170754Sdelphijextern char *xvasprintf (const char *, va_list) 240170754Sdelphij __attribute__((__format__(__printf__, 1, 0))); 241170754Sdelphij 242170754Sdelphij/* 243170754Sdelphij * tc.prompt.c 244170754Sdelphij */ 245170754Sdelphijextern void dateinit (void); 246170754Sdelphijextern void printprompt (int, const char *); 247170754Sdelphijextern int expdollar (struct Strbuf *, const Char **, Char); 248170754Sdelphijextern Char *tprintf (int, const Char *, const char *, 249170754Sdelphij time_t, ptr_t); 250170754Sdelphij 251170754Sdelphij/* 252170754Sdelphij * tc.sched.c 253170754Sdelphij */ 254170754Sdelphijextern time_t sched_next (void); 255170754Sdelphijextern void dosched (Char **, struct command *); 256170754Sdelphijextern void sched_run (void); 257170754Sdelphij 258170754Sdelphij/* 259170754Sdelphij * tc.str.c: 260170754Sdelphij */ 261170754Sdelphij#ifdef WIDE_STRINGS 262170754Sdelphijextern size_t one_mbtowc (wchar_t *, const char *, size_t); 263170754Sdelphijextern size_t one_wctomb (char *, wchar_t); 264170754Sdelphijextern int rt_mbtowc (wchar_t *, const char *, size_t); 265170754Sdelphij#else 266170754Sdelphij#define one_mbtowc(PWC, S, N) \ 267170754Sdelphij ((void)(N), *(PWC) = (unsigned char)*(S), (size_t)1) 268170754Sdelphij#define one_wctomb(S, WCHAR) (*(S) = (WCHAR), (size_t)1) 269170754Sdelphij#endif 270170754Sdelphij#ifdef SHORT_STRINGS 271170754Sdelphijextern Char *s_strchr (const Char *, int); 272170754Sdelphijextern Char *s_strrchr (const Char *, int); 273170754Sdelphijextern Char *s_strcat (Char *, const Char *); 274170754Sdelphij# ifdef NOTUSED 275170754Sdelphijextern Char *s_strncat (Char *, const Char *, size_t); 276170754Sdelphij# endif /* NOTUSED */ 277170754Sdelphijextern Char *s_strcpy (Char *, const Char *); 278170754Sdelphijextern Char *s_strncpy (Char *, const Char *, size_t); 279170754Sdelphijextern Char *s_strspl (const Char *, const Char *); 280170754Sdelphijextern size_t s_strlen (const Char *); 281170754Sdelphijextern int s_strcmp (const Char *, const Char *); 282170754Sdelphijextern int s_strncmp (const Char *, const Char *, size_t); 283170754Sdelphijextern int s_strcasecmp (const Char *, const Char *); 284170754Sdelphijextern Char *s_strnsave (const Char *, size_t); 285170754Sdelphijextern Char *s_strsave (const Char *); 286170754Sdelphijextern Char *s_strend (const Char *); 287170754Sdelphijextern Char *s_strstr (const Char *, const Char *); 288170754Sdelphijextern Char *str2short (const char *); 289170754Sdelphijextern Char **blk2short (char **); 290170754Sdelphijextern char *short2str (const Char *); 291170754Sdelphijextern char **short2blk (Char **); 292170754Sdelphij#else /* !SHORT_STRINGS */ 293170754Sdelphijextern char *caching_strip (const char *); 294170754Sdelphij#endif 295170754Sdelphijextern char *short2qstr (const Char *); 296170754Sdelphij 297170754Sdelphijextern struct blk_buf *bb_alloc (void); 298170754Sdelphijextern void bb_append (struct blk_buf *, Char *); 299170754Sdelphijextern void bb_cleanup (void *); 300170754Sdelphijextern Char **bb_finish (struct blk_buf *); 301170754Sdelphijextern void bb_free (void *); 302170754Sdelphij 303170754Sdelphijextern struct strbuf *strbuf_alloc(void); 304170754Sdelphijextern void strbuf_terminate(struct strbuf *); 305170754Sdelphijextern void strbuf_append1(struct strbuf *, char); 306170754Sdelphijextern void strbuf_appendn(struct strbuf *, const char *, 307170754Sdelphij size_t); 308170754Sdelphijextern void strbuf_append (struct strbuf *, const char *); 309170754Sdelphijextern char *strbuf_finish (struct strbuf *); 310170754Sdelphijextern void strbuf_cleanup(void *); 311170754Sdelphijextern void strbuf_free(void *); 312170754Sdelphijextern struct Strbuf *Strbuf_alloc(void); 313170754Sdelphijextern void Strbuf_terminate(struct Strbuf *); 314170754Sdelphijextern void Strbuf_append1(struct Strbuf *, Char); 315170754Sdelphijextern void Strbuf_appendn(struct Strbuf *, const Char *, 316170754Sdelphij size_t); 317170754Sdelphijextern void Strbuf_append (struct Strbuf *, const Char *); 318170754Sdelphijextern Char *Strbuf_finish (struct Strbuf *); 319170754Sdelphijextern void Strbuf_cleanup(void *); 320170754Sdelphijextern void Strbuf_free(void *); 321170754Sdelphij 322170754Sdelphij 323170754Sdelphij/* 324170754Sdelphij * tc.vers.c: 325170754Sdelphij */ 326170754Sdelphijextern void fix_version (void); 327170754Sdelphij 328170754Sdelphij/* 329170754Sdelphij * tc.who.c 330170754Sdelphij */ 331170754Sdelphij#if defined (HAVE_UTMP_H) || defined (HAVE_UTMPX_H) || defined (WINNT_NATIVE) 332170754Sdelphijextern void initwatch (void); 333170754Sdelphijextern void resetwatch (void); 334170754Sdelphijextern void watch_login (int); 335170754Sdelphijextern char *who_info (ptr_t, int); 336170754Sdelphijextern void dolog (Char **, struct command *); 337170754Sdelphij# ifdef HAVE_STRUCT_UTMP_UT_HOST 338170754Sdelphijextern char *utmphost (void); 339170754Sdelphijextern size_t utmphostsize (void); 340170754Sdelphij# endif /* HAVE_STRUCT_UTMP_UT_HOST */ 341170754Sdelphij#else 342170754Sdelphij# define HAVENOUTMP 343170754Sdelphij#endif 344170754Sdelphij 345170754Sdelphij#endif /* _h_tc_decls */ 346170754Sdelphij