tc.decls.h revision 232633
11590Srgrimes/* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.65 2010/02/09 20:26:13 christos Exp $ */ 21590Srgrimes/* 31590Srgrimes * tc.decls.h: Function declarations from all the tcsh modules 41590Srgrimes */ 51590Srgrimes/*- 61590Srgrimes * Copyright (c) 1980, 1991 The Regents of the University of California. 71590Srgrimes * All rights reserved. 81590Srgrimes * 91590Srgrimes * Redistribution and use in source and binary forms, with or without 101590Srgrimes * modification, are permitted provided that the following conditions 111590Srgrimes * are met: 121590Srgrimes * 1. Redistributions of source code must retain the above copyright 131590Srgrimes * notice, this list of conditions and the following disclaimer. 141590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 151590Srgrimes * notice, this list of conditions and the following disclaimer in the 161590Srgrimes * documentation and/or other materials provided with the distribution. 171590Srgrimes * 3. Neither the name of the University nor the names of its contributors 181590Srgrimes * may be used to endorse or promote products derived from this software 191590Srgrimes * without specific prior written permission. 201590Srgrimes * 211590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241590Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311590Srgrimes * SUCH DAMAGE. 321590Srgrimes */ 331590Srgrimes#ifndef _h_tc_decls 341590Srgrimes#define _h_tc_decls 3528199Scharnier 361590Srgrimesstruct blk_buf; 371590Srgrimesstruct strbuf; 381590Srgrimesstruct Strbuf; 391590Srgrimes 401590Srgrimes/* 4128199Scharnier * tc.alloc.c 421590Srgrimes */ 4328199Scharnier#ifndef SYSMALLOC 4428199Scharnier#ifndef WINNT_NATIVE 4550477Speter#ifndef __linux__ 461590Srgrimesextern void free (ptr_t); 471590Srgrimesextern memalign_t malloc (size_t); 481590Srgrimesextern memalign_t realloc (ptr_t, size_t); 491590Srgrimesextern memalign_t calloc (size_t, size_t); 5028199Scharnier#endif 5128199Scharnier#endif /* !WINNT_NATIVE */ 521590Srgrimes#else /* SYSMALLOC */ 531590Srgrimesextern void sfree (ptr_t); 541590Srgrimesextern memalign_t smalloc (size_t); 551590Srgrimesextern memalign_t srealloc (ptr_t, size_t); 5628199Scharnierextern memalign_t scalloc (size_t, size_t); 571590Srgrimes#endif /* SYSMALLOC */ 581590Srgrimesextern void showall (Char **, struct command *); 591590Srgrimes 601590Srgrimes/* 6187303Sdwmalone * tc.bind.c 621590Srgrimes */ 631590Srgrimesextern void dobindkey (Char **, struct command *); 641590Srgrimes 6592922Simp/* 6692922Simp * tc.defs.c: 671590Srgrimes */ 681590Srgrimesextern void getmachine (void); 691590Srgrimes 701590Srgrimes 711590Srgrimes/* 721590Srgrimes * tc.disc.c 731590Srgrimes */ 741590Srgrimesextern int setdisc (int); 751590Srgrimesextern int resetdisc (int); 761590Srgrimes 771590Srgrimes/* 781590Srgrimes * tc.func.c 791590Srgrimes */ 801590Srgrimesextern Char *expand_lex (const struct wordent *, int, int); 8124360Simpextern Char *sprlex (const struct wordent *); 821590Srgrimesextern Char *Itoa (int, size_t, Char); 831590Srgrimesextern void dolist (Char **, struct command *); 841590Srgrimesextern void dotermname (Char **, struct command *); 851590Srgrimesextern void dotelltc (Char **, struct command *); 861590Srgrimesextern void doechotc (Char **, struct command *); 871590Srgrimesextern void dosettc (Char **, struct command *); 881590Srgrimesextern int cmd_expand (Char *, Char **); 891590Srgrimesextern void dowhich (Char **, struct command *); 901590Srgrimesextern struct process *find_stop_ed (void); 9128199Scharnierextern void fg_proc_entry (struct process *); 921590Srgrimesextern void alrmcatch (void); 931590Srgrimesextern void precmd (void); 941590Srgrimesextern void postcmd (void); 951590Srgrimesextern void cwd_cmd (void); 9696776Sjmallettextern void beep_cmd (void); 9799433Stjrextern void period_cmd (void); 981590Srgrimesextern void job_cmd (Char *); 991590Srgrimesextern void aliasrun (int, Char *, Char *); 1001590Srgrimesextern void setalarm (int); 1011590Srgrimesextern void rmstar (struct wordent *); 1021590Srgrimesextern void continue_jobs (struct wordent *); 1031590Srgrimesextern Char *gettilde (const Char *); 10428199Scharnierextern Char *getusername (Char **); 1051590Srgrimes#ifdef OBSOLETE 1061590Srgrimesextern void doaliases (Char **, struct command *); 1071590Srgrimes#endif /* OBSOLETE */ 1081590Srgrimesextern void shlvl (int); 1091590Srgrimesextern int fixio (int, int); 1101590Srgrimesextern int collate (const Char *, const Char *); 1111590Srgrimes#ifdef HASHBANG 1121590Srgrimesextern int hashbang (int, Char ***); 1131590Srgrimes#endif /* HASHBANG */ 1141590Srgrimes#ifdef REMOTEHOST 11528199Scharnierextern void remotehost (void); 1161590Srgrimes#endif /* REMOTEHOST */ 1171590Srgrimes 1181590Srgrimes 1191590Srgrimes/* 1201590Srgrimes * tc.os.c 1211590Srgrimes */ 1221590Srgrimes#ifdef MACH 12328199Scharnierextern void dosetpath (Char **, struct command *); 12496803Sjmallett#endif /* MACH */ 1251590Srgrimes 1261590Srgrimes#ifdef TCF 12728199Scharnierextern void dogetxvers (Char **, struct command *); 12828199Scharnierextern void dosetxvers (Char **, struct command *); 12928199Scharnierextern void dogetspath (Char **, struct command *); 13028199Scharnierextern void dosetspath (Char **, struct command *); 13128199Scharnierextern char *sitename (pid_t); 13228199Scharnierextern void domigrate (Char **, struct command *); 13328199Scharnier#endif /* TCF */ 1341590Srgrimes 1351590Srgrimes#ifdef WARP 1361590Srgrimesextern void dowarp (Char **, struct command *); 13787303Sdwmalone#endif /* WARP */ 1381590Srgrimes 1391590Srgrimes#if defined(_CRAY) && !defined(_CRAYMPP) 1401590Srgrimesextern void dodmmode (Char **, struct command *); 14196776Sjmallett#endif /* _CRAY && !_CRAYMPP */ 14299433Stjr 1431590Srgrimes#if defined(masscomp) || defined(hcx) 1441590Srgrimesextern void douniverse (Char **, struct command *); 1451590Srgrimes#endif /* masscomp */ 1461590Srgrimes 1471590Srgrimes#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