2017-03-18 21:41:53 +00:00
|
|
|
/* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.66 2012/06/21 18:49:11 christos Exp $ */
|
2000-04-15 04:41:27 +00:00
|
|
|
/*
|
|
|
|
* tc.decls.h: Function declarations from all the tcsh modules
|
|
|
|
*/
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1980, 1991 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2002-07-24 16:23:10 +00:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
2000-04-15 04:41:27 +00:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
#ifndef _h_tc_decls
|
|
|
|
#define _h_tc_decls
|
|
|
|
|
2007-03-11 22:33:41 +00:00
|
|
|
struct blk_buf;
|
|
|
|
struct strbuf;
|
|
|
|
struct Strbuf;
|
|
|
|
|
2000-04-15 04:41:27 +00:00
|
|
|
/*
|
|
|
|
* tc.alloc.c
|
|
|
|
*/
|
|
|
|
#ifndef SYSMALLOC
|
2000-11-30 21:05:33 +00:00
|
|
|
#ifndef WINNT_NATIVE
|
2007-03-11 22:33:41 +00:00
|
|
|
#ifndef __linux__
|
|
|
|
extern void free (ptr_t);
|
|
|
|
extern memalign_t malloc (size_t);
|
|
|
|
extern memalign_t realloc (ptr_t, size_t);
|
|
|
|
extern memalign_t calloc (size_t, size_t);
|
|
|
|
#endif
|
2000-11-30 21:05:33 +00:00
|
|
|
#endif /* !WINNT_NATIVE */
|
2000-04-15 04:41:27 +00:00
|
|
|
#else /* SYSMALLOC */
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void sfree (ptr_t);
|
|
|
|
extern memalign_t smalloc (size_t);
|
|
|
|
extern memalign_t srealloc (ptr_t, size_t);
|
|
|
|
extern memalign_t scalloc (size_t, size_t);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* SYSMALLOC */
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void showall (Char **, struct command *);
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.bind.c
|
|
|
|
*/
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void dobindkey (Char **, struct command *);
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.defs.c:
|
|
|
|
*/
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void getmachine (void);
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.disc.c
|
|
|
|
*/
|
2007-03-11 22:33:41 +00:00
|
|
|
extern int setdisc (int);
|
|
|
|
extern int resetdisc (int);
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.func.c
|
|
|
|
*/
|
2007-03-11 22:33:41 +00:00
|
|
|
extern Char *expand_lex (const struct wordent *, int, int);
|
|
|
|
extern Char *sprlex (const struct wordent *);
|
|
|
|
extern Char *Itoa (int, size_t, Char);
|
|
|
|
extern void dolist (Char **, struct command *);
|
|
|
|
extern void dotermname (Char **, struct command *);
|
|
|
|
extern void dotelltc (Char **, struct command *);
|
|
|
|
extern void doechotc (Char **, struct command *);
|
|
|
|
extern void dosettc (Char **, struct command *);
|
|
|
|
extern int cmd_expand (Char *, Char **);
|
|
|
|
extern void dowhich (Char **, struct command *);
|
|
|
|
extern struct process *find_stop_ed (void);
|
|
|
|
extern void fg_proc_entry (struct process *);
|
|
|
|
extern void alrmcatch (void);
|
|
|
|
extern void precmd (void);
|
|
|
|
extern void postcmd (void);
|
|
|
|
extern void cwd_cmd (void);
|
|
|
|
extern void beep_cmd (void);
|
|
|
|
extern void period_cmd (void);
|
|
|
|
extern void job_cmd (Char *);
|
|
|
|
extern void aliasrun (int, Char *, Char *);
|
|
|
|
extern void setalarm (int);
|
|
|
|
extern void rmstar (struct wordent *);
|
|
|
|
extern void continue_jobs (struct wordent *);
|
|
|
|
extern Char *gettilde (const Char *);
|
|
|
|
extern Char *getusername (Char **);
|
2000-04-15 04:41:27 +00:00
|
|
|
#ifdef OBSOLETE
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void doaliases (Char **, struct command *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* OBSOLETE */
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void shlvl (int);
|
|
|
|
extern int fixio (int, int);
|
|
|
|
extern int collate (const Char *, const Char *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#ifdef HASHBANG
|
2007-03-11 22:33:41 +00:00
|
|
|
extern int hashbang (int, Char ***);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* HASHBANG */
|
|
|
|
#ifdef REMOTEHOST
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void remotehost (void);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* REMOTEHOST */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.os.c
|
|
|
|
*/
|
|
|
|
#ifdef MACH
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void dosetpath (Char **, struct command *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* MACH */
|
|
|
|
|
|
|
|
#ifdef TCF
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void dogetxvers (Char **, struct command *);
|
|
|
|
extern void dosetxvers (Char **, struct command *);
|
|
|
|
extern void dogetspath (Char **, struct command *);
|
|
|
|
extern void dosetspath (Char **, struct command *);
|
|
|
|
extern char *sitename (pid_t);
|
|
|
|
extern void domigrate (Char **, struct command *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* TCF */
|
|
|
|
|
|
|
|
#ifdef WARP
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void dowarp (Char **, struct command *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* WARP */
|
|
|
|
|
|
|
|
#if defined(_CRAY) && !defined(_CRAYMPP)
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void dodmmode (Char **, struct command *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* _CRAY && !_CRAYMPP */
|
|
|
|
|
|
|
|
#if defined(masscomp) || defined(hcx)
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void douniverse (Char **, struct command *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* masscomp */
|
|
|
|
|
2004-07-11 02:17:56 +00:00
|
|
|
#if defined(_OSD_POSIX) /* BS2000 */
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void dobs2cmd (Char **, struct command *);
|
2004-07-11 02:17:56 +00:00
|
|
|
#endif /* _OSD_POSIX */
|
|
|
|
|
2000-04-15 04:41:27 +00:00
|
|
|
#if defined(hcx)
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void doatt (Char **, struct command *);
|
|
|
|
extern void doucb (Char **, struct command *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* hcx */
|
|
|
|
|
|
|
|
#ifdef _SEQUENT_
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void pr_stat_sub (struct process_stats *,
|
|
|
|
struct process_stats *,
|
|
|
|
struct process_stats *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* _SEQUENT_ */
|
|
|
|
|
|
|
|
#ifdef NEEDtcgetpgrp
|
2007-03-11 22:33:41 +00:00
|
|
|
extern pid_t xtcgetpgrp (int);
|
|
|
|
extern int xtcsetpgrp (int, int);
|
2000-04-15 04:41:27 +00:00
|
|
|
# undef tcgetpgrp
|
|
|
|
# define tcgetpgrp(a) xtcgetpgrp(a)
|
|
|
|
# undef tcsetpgrp
|
|
|
|
# define tcsetpgrp(a, b) xtcsetpgrp((a), (b))
|
|
|
|
#endif /* NEEDtcgetpgrp */
|
|
|
|
|
|
|
|
#ifdef YPBUGS
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void fix_yp_bugs (void);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* YPBUGS */
|
|
|
|
#ifdef STRCOLLBUG
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void fix_strcoll_bug (void);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* STRCOLLBUG */
|
|
|
|
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void osinit (void);
|
2000-04-15 04:41:27 +00:00
|
|
|
|
2005-04-24 19:41:08 +00:00
|
|
|
#ifndef HAVE_MEMMOVE
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void *xmemmove (void *, const void *, size_t);
|
2005-04-24 19:41:08 +00:00
|
|
|
# define memmove(a, b, c) xmemmove(a, b, c)
|
|
|
|
#endif /* !HAVE_MEMMOVE */
|
2000-04-15 04:41:27 +00:00
|
|
|
|
2005-04-24 19:41:08 +00:00
|
|
|
#ifndef HAVE_MEMSET
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void *xmemset (void *, int, size_t);
|
2005-04-24 19:41:08 +00:00
|
|
|
# define memset(a, b, c) xmemset(a, b, c)
|
|
|
|
#endif /* !HAVE_MEMSET */
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
|
2005-04-24 19:41:08 +00:00
|
|
|
#ifndef HAVE_GETCWD
|
2007-03-11 22:33:41 +00:00
|
|
|
extern char *xgetcwd (char *, size_t);
|
2000-04-15 04:41:27 +00:00
|
|
|
# undef getcwd
|
2005-04-24 19:41:08 +00:00
|
|
|
# define getcwd(a, b) xgetcwd(a, b)
|
|
|
|
#endif /* !HAVE_GETCWD */
|
2000-04-15 04:41:27 +00:00
|
|
|
|
2005-04-24 19:41:08 +00:00
|
|
|
#ifndef HAVE_GETHOSTNAME
|
2007-03-11 22:33:41 +00:00
|
|
|
extern int xgethostname (char *, int);
|
2000-04-15 04:41:27 +00:00
|
|
|
# undef gethostname
|
2005-04-24 19:41:08 +00:00
|
|
|
# define gethostname(a, b) xgethostname(a, b)
|
|
|
|
#endif /* !HAVE_GETHOSTNAME */
|
2000-04-15 04:41:27 +00:00
|
|
|
|
2005-04-24 19:41:08 +00:00
|
|
|
#ifndef HAVE_NICE
|
2007-03-11 22:33:41 +00:00
|
|
|
extern int xnice (int);
|
2000-04-15 04:41:27 +00:00
|
|
|
# undef nice
|
|
|
|
# define nice(a) xnice(a)
|
2005-04-24 19:41:08 +00:00
|
|
|
#endif /* !HAVE_NICE */
|
2000-04-15 04:41:27 +00:00
|
|
|
|
2005-04-24 19:41:08 +00:00
|
|
|
#ifndef HAVE_STRERROR
|
2007-03-11 22:33:41 +00:00
|
|
|
extern char *xstrerror (int);
|
2000-04-15 04:41:27 +00:00
|
|
|
# undef strerror
|
|
|
|
# define strerror(a) xstrerror(a)
|
2005-04-24 19:41:08 +00:00
|
|
|
#endif /* !HAVE_STRERROR */
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
#ifdef apollo
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void doinlib (Char **, struct command *);
|
|
|
|
extern void dover (Char **, struct command *);
|
|
|
|
extern void dorootnode (Char **, struct command *);
|
|
|
|
extern int getv (Char *);
|
2000-04-15 04:41:27 +00:00
|
|
|
#endif /* apollo */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.printf.h
|
|
|
|
*/
|
2007-03-11 22:33:41 +00:00
|
|
|
#ifndef __GNUC__
|
|
|
|
#define __attribute__(a)
|
|
|
|
#endif
|
2017-03-18 21:41:53 +00:00
|
|
|
extern int xprintf (const char *, ...)
|
2007-03-11 22:33:41 +00:00
|
|
|
__attribute__((__format__(__printf__, 1, 2)));
|
2017-03-18 21:41:53 +00:00
|
|
|
extern int xsnprintf (char *, size_t, const char *, ...)
|
2007-03-11 22:33:41 +00:00
|
|
|
__attribute__((__format__(__printf__, 3, 4)));
|
|
|
|
extern char *xasprintf (const char *, ...)
|
|
|
|
__attribute__((__format__(__printf__, 1, 2)));
|
2017-03-18 21:41:53 +00:00
|
|
|
extern int xvprintf (const char *, va_list)
|
2007-03-11 22:33:41 +00:00
|
|
|
__attribute__((__format__(__printf__, 1, 0)));
|
2017-03-18 21:41:53 +00:00
|
|
|
extern int xvsnprintf (char *, size_t, const char *, va_list)
|
2007-03-11 22:33:41 +00:00
|
|
|
__attribute__((__format__(__printf__, 3, 0)));
|
|
|
|
extern char *xvasprintf (const char *, va_list)
|
|
|
|
__attribute__((__format__(__printf__, 1, 0)));
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.prompt.c
|
|
|
|
*/
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void dateinit (void);
|
|
|
|
extern void printprompt (int, const char *);
|
|
|
|
extern int expdollar (struct Strbuf *, const Char **, Char);
|
|
|
|
extern Char *tprintf (int, const Char *, const char *,
|
|
|
|
time_t, ptr_t);
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.sched.c
|
|
|
|
*/
|
2007-03-11 22:33:41 +00:00
|
|
|
extern time_t sched_next (void);
|
|
|
|
extern void dosched (Char **, struct command *);
|
|
|
|
extern void sched_run (void);
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.str.c:
|
|
|
|
*/
|
2005-04-24 19:41:08 +00:00
|
|
|
#ifdef WIDE_STRINGS
|
2012-02-20 00:53:59 +00:00
|
|
|
extern size_t one_mbtowc (Char *, const char *, size_t);
|
|
|
|
extern size_t one_wctomb (char *, Char);
|
|
|
|
extern int rt_mbtowc (Char *, const char *, size_t);
|
2005-04-24 19:41:08 +00:00
|
|
|
#else
|
|
|
|
#define one_mbtowc(PWC, S, N) \
|
|
|
|
((void)(N), *(PWC) = (unsigned char)*(S), (size_t)1)
|
|
|
|
#define one_wctomb(S, WCHAR) (*(S) = (WCHAR), (size_t)1)
|
|
|
|
#endif
|
2000-04-15 04:41:27 +00:00
|
|
|
#ifdef SHORT_STRINGS
|
2007-03-11 22:33:41 +00:00
|
|
|
extern Char *s_strchr (const Char *, int);
|
|
|
|
extern Char *s_strrchr (const Char *, int);
|
|
|
|
extern Char *s_strcat (Char *, const Char *);
|
2000-04-15 04:41:27 +00:00
|
|
|
# ifdef NOTUSED
|
2007-03-11 22:33:41 +00:00
|
|
|
extern Char *s_strncat (Char *, const Char *, size_t);
|
2000-04-15 04:41:27 +00:00
|
|
|
# endif /* NOTUSED */
|
2007-03-11 22:33:41 +00:00
|
|
|
extern Char *s_strcpy (Char *, const Char *);
|
|
|
|
extern Char *s_strncpy (Char *, const Char *, size_t);
|
|
|
|
extern Char *s_strspl (const Char *, const Char *);
|
|
|
|
extern size_t s_strlen (const Char *);
|
|
|
|
extern int s_strcmp (const Char *, const Char *);
|
|
|
|
extern int s_strncmp (const Char *, const Char *, size_t);
|
|
|
|
extern int s_strcasecmp (const Char *, const Char *);
|
|
|
|
extern Char *s_strnsave (const Char *, size_t);
|
|
|
|
extern Char *s_strsave (const Char *);
|
|
|
|
extern Char *s_strend (const Char *);
|
|
|
|
extern Char *s_strstr (const Char *, const Char *);
|
|
|
|
extern Char *str2short (const char *);
|
|
|
|
extern Char **blk2short (char **);
|
|
|
|
extern char *short2str (const Char *);
|
|
|
|
extern char **short2blk (Char **);
|
|
|
|
#else /* !SHORT_STRINGS */
|
|
|
|
extern char *caching_strip (const char *);
|
|
|
|
#endif
|
|
|
|
extern char *short2qstr (const Char *);
|
|
|
|
|
2009-07-10 21:47:20 +00:00
|
|
|
extern struct blk_buf *bb_alloc (void);
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void bb_append (struct blk_buf *, Char *);
|
|
|
|
extern void bb_cleanup (void *);
|
|
|
|
extern Char **bb_finish (struct blk_buf *);
|
2009-07-10 21:47:20 +00:00
|
|
|
extern void bb_free (void *);
|
2007-03-11 22:33:41 +00:00
|
|
|
|
2009-07-10 21:47:20 +00:00
|
|
|
extern struct strbuf *strbuf_alloc(void);
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void strbuf_terminate(struct strbuf *);
|
|
|
|
extern void strbuf_append1(struct strbuf *, char);
|
|
|
|
extern void strbuf_appendn(struct strbuf *, const char *,
|
|
|
|
size_t);
|
|
|
|
extern void strbuf_append (struct strbuf *, const char *);
|
|
|
|
extern char *strbuf_finish (struct strbuf *);
|
|
|
|
extern void strbuf_cleanup(void *);
|
2009-07-10 21:47:20 +00:00
|
|
|
extern void strbuf_free(void *);
|
|
|
|
extern struct Strbuf *Strbuf_alloc(void);
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void Strbuf_terminate(struct Strbuf *);
|
|
|
|
extern void Strbuf_append1(struct Strbuf *, Char);
|
|
|
|
extern void Strbuf_appendn(struct Strbuf *, const Char *,
|
|
|
|
size_t);
|
|
|
|
extern void Strbuf_append (struct Strbuf *, const Char *);
|
|
|
|
extern Char *Strbuf_finish (struct Strbuf *);
|
|
|
|
extern void Strbuf_cleanup(void *);
|
2009-07-10 21:47:20 +00:00
|
|
|
extern void Strbuf_free(void *);
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.vers.c:
|
|
|
|
*/
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void fix_version (void);
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* tc.who.c
|
|
|
|
*/
|
2005-04-24 19:41:08 +00:00
|
|
|
#if defined (HAVE_UTMP_H) || defined (HAVE_UTMPX_H) || defined (WINNT_NATIVE)
|
2007-03-11 22:33:41 +00:00
|
|
|
extern void initwatch (void);
|
|
|
|
extern void resetwatch (void);
|
|
|
|
extern void watch_login (int);
|
|
|
|
extern char *who_info (ptr_t, int);
|
|
|
|
extern void dolog (Char **, struct command *);
|
2005-04-24 19:41:08 +00:00
|
|
|
# ifdef HAVE_STRUCT_UTMP_UT_HOST
|
2007-03-11 22:33:41 +00:00
|
|
|
extern char *utmphost (void);
|
|
|
|
extern size_t utmphostsize (void);
|
2005-04-24 19:41:08 +00:00
|
|
|
# endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
|
|
|
#else
|
|
|
|
# define HAVENOUTMP
|
|
|
|
#endif
|
2000-04-15 04:41:27 +00:00
|
|
|
|
|
|
|
#endif /* _h_tc_decls */
|