tc.decls.h revision 195609
1195609Smp/* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.64 2008/05/14 20:10:30 christos Exp $ */ 259243Sobrien/* 359243Sobrien * tc.decls.h: Function declarations from all the tcsh modules 459243Sobrien */ 559243Sobrien/*- 659243Sobrien * Copyright (c) 1980, 1991 The Regents of the University of California. 759243Sobrien * All rights reserved. 859243Sobrien * 959243Sobrien * Redistribution and use in source and binary forms, with or without 1059243Sobrien * modification, are permitted provided that the following conditions 1159243Sobrien * are met: 1259243Sobrien * 1. Redistributions of source code must retain the above copyright 1359243Sobrien * notice, this list of conditions and the following disclaimer. 1459243Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1559243Sobrien * notice, this list of conditions and the following disclaimer in the 1659243Sobrien * documentation and/or other materials provided with the distribution. 17100616Smp * 3. Neither the name of the University nor the names of its contributors 1859243Sobrien * may be used to endorse or promote products derived from this software 1959243Sobrien * without specific prior written permission. 2059243Sobrien * 2159243Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2259243Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2359243Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2459243Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2559243Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2659243Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2759243Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2859243Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2959243Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3059243Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3159243Sobrien * SUCH DAMAGE. 3259243Sobrien */ 3359243Sobrien#ifndef _h_tc_decls 3459243Sobrien#define _h_tc_decls 3559243Sobrien 36167465Smpstruct blk_buf; 37167465Smpstruct strbuf; 38167465Smpstruct Strbuf; 39167465Smp 4059243Sobrien/* 4159243Sobrien * tc.alloc.c 4259243Sobrien */ 4359243Sobrien#ifndef SYSMALLOC 4469408Sache#ifndef WINNT_NATIVE 45167465Smp#ifndef __linux__ 46167465Smpextern void free (ptr_t); 47167465Smpextern memalign_t malloc (size_t); 48167465Smpextern memalign_t realloc (ptr_t, size_t); 49167465Smpextern memalign_t calloc (size_t, size_t); 50167465Smp#endif 5169408Sache#endif /* !WINNT_NATIVE */ 5259243Sobrien#else /* SYSMALLOC */ 53167465Smpextern void sfree (ptr_t); 54167465Smpextern memalign_t smalloc (size_t); 55167465Smpextern memalign_t srealloc (ptr_t, size_t); 56167465Smpextern memalign_t scalloc (size_t, size_t); 5759243Sobrien#endif /* SYSMALLOC */ 58167465Smpextern void showall (Char **, struct command *); 5959243Sobrien 6059243Sobrien/* 6159243Sobrien * tc.bind.c 6259243Sobrien */ 63167465Smpextern void dobindkey (Char **, struct command *); 6459243Sobrien 6559243Sobrien/* 6659243Sobrien * tc.defs.c: 6759243Sobrien */ 68167465Smpextern void getmachine (void); 6959243Sobrien 7059243Sobrien 7159243Sobrien/* 7259243Sobrien * tc.disc.c 7359243Sobrien */ 74167465Smpextern int setdisc (int); 75167465Smpextern int resetdisc (int); 7659243Sobrien 7759243Sobrien/* 7859243Sobrien * tc.func.c 7959243Sobrien */ 80167465Smpextern Char *expand_lex (const struct wordent *, int, int); 81167465Smpextern Char *sprlex (const struct wordent *); 82167465Smpextern Char *Itoa (int, size_t, Char); 83167465Smpextern void dolist (Char **, struct command *); 84167465Smpextern void dotermname (Char **, struct command *); 85167465Smpextern void dotelltc (Char **, struct command *); 86167465Smpextern void doechotc (Char **, struct command *); 87167465Smpextern void dosettc (Char **, struct command *); 88167465Smpextern int cmd_expand (Char *, Char **); 89167465Smpextern void dowhich (Char **, struct command *); 90167465Smpextern struct process *find_stop_ed (void); 91167465Smpextern void fg_proc_entry (struct process *); 92167465Smpextern void alrmcatch (void); 93167465Smpextern void precmd (void); 94167465Smpextern void postcmd (void); 95167465Smpextern void cwd_cmd (void); 96167465Smpextern void beep_cmd (void); 97167465Smpextern void period_cmd (void); 98167465Smpextern void job_cmd (Char *); 99167465Smpextern void aliasrun (int, Char *, Char *); 100167465Smpextern void setalarm (int); 101167465Smpextern void rmstar (struct wordent *); 102167465Smpextern void continue_jobs (struct wordent *); 103167465Smpextern Char *gettilde (const Char *); 104167465Smpextern Char *getusername (Char **); 10559243Sobrien#ifdef OBSOLETE 106167465Smpextern void doaliases (Char **, struct command *); 10759243Sobrien#endif /* OBSOLETE */ 108167465Smpextern void shlvl (int); 109167465Smpextern int fixio (int, int); 110167465Smpextern int collate (const Char *, const Char *); 11159243Sobrien#ifdef HASHBANG 112167465Smpextern int hashbang (int, Char ***); 11359243Sobrien#endif /* HASHBANG */ 11459243Sobrien#ifdef REMOTEHOST 115167465Smpextern void remotehost (void); 11659243Sobrien#endif /* REMOTEHOST */ 11759243Sobrien 11859243Sobrien 11959243Sobrien/* 12059243Sobrien * tc.os.c 12159243Sobrien */ 12259243Sobrien#ifdef MACH 123167465Smpextern void dosetpath (Char **, struct command *); 12459243Sobrien#endif /* MACH */ 12559243Sobrien 12659243Sobrien#ifdef TCF 127167465Smpextern void dogetxvers (Char **, struct command *); 128167465Smpextern void dosetxvers (Char **, struct command *); 129167465Smpextern void dogetspath (Char **, struct command *); 130167465Smpextern void dosetspath (Char **, struct command *); 131167465Smpextern char *sitename (pid_t); 132167465Smpextern void domigrate (Char **, struct command *); 13359243Sobrien#endif /* TCF */ 13459243Sobrien 13559243Sobrien#ifdef WARP 136167465Smpextern void dowarp (Char **, struct command *); 13759243Sobrien#endif /* WARP */ 13859243Sobrien 13959243Sobrien#if defined(_CRAY) && !defined(_CRAYMPP) 140167465Smpextern void dodmmode (Char **, struct command *); 14159243Sobrien#endif /* _CRAY && !_CRAYMPP */ 14259243Sobrien 14359243Sobrien#if defined(masscomp) || defined(hcx) 144167465Smpextern void douniverse (Char **, struct command *); 14559243Sobrien#endif /* masscomp */ 14659243Sobrien 147131962Smp#if defined(_OSD_POSIX) /* BS2000 */ 148167465Smpextern void dobs2cmd (Char **, struct command *); 149131962Smp#endif /* _OSD_POSIX */ 150131962Smp 15159243Sobrien#if defined(hcx) 152167465Smpextern void doatt (Char **, struct command *); 153167465Smpextern void doucb (Char **, struct command *); 15459243Sobrien#endif /* hcx */ 15559243Sobrien 15659243Sobrien#ifdef _SEQUENT_ 157167465Smpextern void pr_stat_sub (struct process_stats *, 158167465Smp struct process_stats *, 159167465Smp struct process_stats *); 16059243Sobrien#endif /* _SEQUENT_ */ 16159243Sobrien 16259243Sobrien#ifdef NEEDtcgetpgrp 163167465Smpextern pid_t xtcgetpgrp (int); 164167465Smpextern int xtcsetpgrp (int, int); 16559243Sobrien# undef tcgetpgrp 16659243Sobrien# define tcgetpgrp(a) xtcgetpgrp(a) 16759243Sobrien# undef tcsetpgrp 16859243Sobrien# define tcsetpgrp(a, b) xtcsetpgrp((a), (b)) 16959243Sobrien#endif /* NEEDtcgetpgrp */ 17059243Sobrien 17159243Sobrien#ifdef YPBUGS 172167465Smpextern void fix_yp_bugs (void); 17359243Sobrien#endif /* YPBUGS */ 17459243Sobrien#ifdef STRCOLLBUG 175167465Smpextern void fix_strcoll_bug (void); 17659243Sobrien#endif /* STRCOLLBUG */ 17759243Sobrien 178167465Smpextern void osinit (void); 17959243Sobrien 180145479Smp#ifndef HAVE_MEMMOVE 181167465Smpextern void *xmemmove (void *, const void *, size_t); 182145479Smp# define memmove(a, b, c) xmemmove(a, b, c) 183145479Smp#endif /* !HAVE_MEMMOVE */ 18459243Sobrien 185145479Smp#ifndef HAVE_MEMSET 186167465Smpextern void *xmemset (void *, int, size_t); 187145479Smp# define memset(a, b, c) xmemset(a, b, c) 188145479Smp#endif /* !HAVE_MEMSET */ 18959243Sobrien 19059243Sobrien 191145479Smp#ifndef HAVE_GETCWD 192167465Smpextern char *xgetcwd (char *, size_t); 19359243Sobrien# undef getcwd 194145479Smp# define getcwd(a, b) xgetcwd(a, b) 195145479Smp#endif /* !HAVE_GETCWD */ 19659243Sobrien 197145479Smp#ifndef HAVE_GETHOSTNAME 198167465Smpextern int xgethostname (char *, int); 19959243Sobrien# undef gethostname 200145479Smp# define gethostname(a, b) xgethostname(a, b) 201145479Smp#endif /* !HAVE_GETHOSTNAME */ 20259243Sobrien 203145479Smp#ifndef HAVE_NICE 204167465Smpextern int xnice (int); 20559243Sobrien# undef nice 20659243Sobrien# define nice(a) xnice(a) 207145479Smp#endif /* !HAVE_NICE */ 20859243Sobrien 209145479Smp#ifndef HAVE_STRERROR 210167465Smpextern char *xstrerror (int); 21159243Sobrien# undef strerror 21259243Sobrien# define strerror(a) xstrerror(a) 213145479Smp#endif /* !HAVE_STRERROR */ 21459243Sobrien 21559243Sobrien#ifdef apollo 216167465Smpextern void doinlib (Char **, struct command *); 217167465Smpextern void dover (Char **, struct command *); 218167465Smpextern void dorootnode (Char **, struct command *); 219167465Smpextern int getv (Char *); 22059243Sobrien#endif /* apollo */ 22159243Sobrien 22259243Sobrien 22359243Sobrien/* 22459243Sobrien * tc.printf.h 22559243Sobrien */ 226167465Smp#ifndef __GNUC__ 227167465Smp#define __attribute__(a) 228167465Smp#endif 229167465Smpextern pret_t xprintf (const char *, ...) 230167465Smp __attribute__((__format__(__printf__, 1, 2))); 231167465Smpextern pret_t xsnprintf (char *, size_t, const char *, ...) 232167465Smp __attribute__((__format__(__printf__, 3, 4))); 233167465Smpextern char *xasprintf (const char *, ...) 234167465Smp __attribute__((__format__(__printf__, 1, 2))); 235167465Smpextern pret_t xvprintf (const char *, va_list) 236167465Smp __attribute__((__format__(__printf__, 1, 0))); 237167465Smpextern pret_t xvsnprintf (char *, size_t, const char *, va_list) 238167465Smp __attribute__((__format__(__printf__, 3, 0))); 239167465Smpextern char *xvasprintf (const char *, va_list) 240167465Smp __attribute__((__format__(__printf__, 1, 0))); 24159243Sobrien 24259243Sobrien/* 24359243Sobrien * tc.prompt.c 24459243Sobrien */ 245167465Smpextern void dateinit (void); 246167465Smpextern void printprompt (int, const char *); 247167465Smpextern int expdollar (struct Strbuf *, const Char **, Char); 248167465Smpextern Char *tprintf (int, const Char *, const char *, 249167465Smp time_t, ptr_t); 25059243Sobrien 25159243Sobrien/* 25259243Sobrien * tc.sched.c 25359243Sobrien */ 254167465Smpextern time_t sched_next (void); 255167465Smpextern void dosched (Char **, struct command *); 256167465Smpextern void sched_run (void); 25759243Sobrien 25859243Sobrien/* 25959243Sobrien * tc.str.c: 26059243Sobrien */ 261145479Smp#ifdef WIDE_STRINGS 262167465Smpextern size_t one_mbtowc (wchar_t *, const char *, size_t); 263167465Smpextern size_t one_wctomb (char *, wchar_t); 264167465Smpextern int rt_mbtowc (wchar_t *, const char *, size_t); 265145479Smp#else 266145479Smp#define one_mbtowc(PWC, S, N) \ 267145479Smp ((void)(N), *(PWC) = (unsigned char)*(S), (size_t)1) 268145479Smp#define one_wctomb(S, WCHAR) (*(S) = (WCHAR), (size_t)1) 269145479Smp#endif 27059243Sobrien#ifdef SHORT_STRINGS 271167465Smpextern Char *s_strchr (const Char *, int); 272167465Smpextern Char *s_strrchr (const Char *, int); 273167465Smpextern Char *s_strcat (Char *, const Char *); 27459243Sobrien# ifdef NOTUSED 275167465Smpextern Char *s_strncat (Char *, const Char *, size_t); 27659243Sobrien# endif /* NOTUSED */ 277167465Smpextern Char *s_strcpy (Char *, const Char *); 278167465Smpextern Char *s_strncpy (Char *, const Char *, size_t); 279167465Smpextern Char *s_strspl (const Char *, const Char *); 280167465Smpextern size_t s_strlen (const Char *); 281167465Smpextern int s_strcmp (const Char *, const Char *); 282167465Smpextern int s_strncmp (const Char *, const Char *, size_t); 283167465Smpextern int s_strcasecmp (const Char *, const Char *); 284167465Smpextern Char *s_strnsave (const Char *, size_t); 285167465Smpextern Char *s_strsave (const Char *); 286167465Smpextern Char *s_strend (const Char *); 287167465Smpextern Char *s_strstr (const Char *, const Char *); 288167465Smpextern Char *str2short (const char *); 289167465Smpextern Char **blk2short (char **); 290167465Smpextern char *short2str (const Char *); 291167465Smpextern char **short2blk (Char **); 292167465Smp#else /* !SHORT_STRINGS */ 293167465Smpextern char *caching_strip (const char *); 294167465Smp#endif 295167465Smpextern char *short2qstr (const Char *); 29659243Sobrien 297195609Smpextern struct blk_buf *bb_alloc (void); 298167465Smpextern void bb_append (struct blk_buf *, Char *); 299167465Smpextern void bb_cleanup (void *); 300167465Smpextern Char **bb_finish (struct blk_buf *); 301195609Smpextern void bb_free (void *); 30259243Sobrien 303195609Smpextern struct strbuf *strbuf_alloc(void); 304167465Smpextern void strbuf_terminate(struct strbuf *); 305167465Smpextern void strbuf_append1(struct strbuf *, char); 306167465Smpextern void strbuf_appendn(struct strbuf *, const char *, 307167465Smp size_t); 308167465Smpextern void strbuf_append (struct strbuf *, const char *); 309167465Smpextern char *strbuf_finish (struct strbuf *); 310167465Smpextern void strbuf_cleanup(void *); 311195609Smpextern void strbuf_free(void *); 312195609Smpextern struct Strbuf *Strbuf_alloc(void); 313167465Smpextern void Strbuf_terminate(struct Strbuf *); 314167465Smpextern void Strbuf_append1(struct Strbuf *, Char); 315167465Smpextern void Strbuf_appendn(struct Strbuf *, const Char *, 316167465Smp size_t); 317167465Smpextern void Strbuf_append (struct Strbuf *, const Char *); 318167465Smpextern Char *Strbuf_finish (struct Strbuf *); 319167465Smpextern void Strbuf_cleanup(void *); 320195609Smpextern void Strbuf_free(void *); 321167465Smp 322167465Smp 32359243Sobrien/* 32459243Sobrien * tc.vers.c: 32559243Sobrien */ 326167465Smpextern void fix_version (void); 32759243Sobrien 32859243Sobrien/* 32959243Sobrien * tc.who.c 33059243Sobrien */ 331145479Smp#if defined (HAVE_UTMP_H) || defined (HAVE_UTMPX_H) || defined (WINNT_NATIVE) 332167465Smpextern void initwatch (void); 333167465Smpextern void resetwatch (void); 334167465Smpextern void watch_login (int); 335167465Smpextern char *who_info (ptr_t, int); 336167465Smpextern void dolog (Char **, struct command *); 337145479Smp# ifdef HAVE_STRUCT_UTMP_UT_HOST 338167465Smpextern char *utmphost (void); 339167465Smpextern size_t utmphostsize (void); 340145479Smp# endif /* HAVE_STRUCT_UTMP_UT_HOST */ 341145479Smp#else 342145479Smp# define HAVENOUTMP 343145479Smp#endif 34459243Sobrien 34559243Sobrien#endif /* _h_tc_decls */ 346