/*
 *   This file was automatically generated by cextract version 1.2.
 *   Manual editing now recommended, since I've done a whole lot of it.
 *
 *   Created: Thu May 14 15:44:40 1992
 *
 * $Header: /usr/build/vile/vile/RCS/proto.h,v 1.521 2003/07/27 15:19:24 tom Exp $
 *
 */

#ifndef VILE_PROTO_H
#define VILE_PROTO_H 1

#if !CHECK_PROTOTYPES
extern int main (int argc, char **argv);
#endif

#ifdef __cplusplus
extern "C" {
#endif

extern SIGT catchintr (int ACTUAL_SIG_ARGS);
extern char *init_state_value(int n);
extern char *strncpy0 (char *t, const char *f, size_t l);
extern char *vl_strncpy (char *dest, const char *src, size_t destlen);
extern int call_cmdfunc (const CMDFUNC *p, int f, int n);
extern int no_memory (const char *s);
extern int rdonly (void);
extern int writeall (int f, int n, int promptuser, int leaving, int autowriting, int all);
extern void charinit (void);
extern void do_repeats (int *cp, int *fp, int *np);
extern void init_mode_value(struct VAL *, MODECLASS c, int n);
extern void not_interrupted (void);
extern void setup_handler (int sig, void (*disp) (int ACTUAL_SIG_ARGS));
extern void tidy_exit (int code);

#ifndef interrupted
extern int interrupted (void);
#endif

#ifndef strmalloc
extern char *strmalloc (const char *s);
#endif

#if OPT_HEAPSIZE
extern char *track_realloc (char *mp, UINT nbytes);
extern char *track_malloc (UINT nbytes);
extern void track_free (char *mp);
#endif

#ifndef valid_buffer
extern int valid_buffer(BUFFER *bp);
#endif

#ifndef valid_window
extern int valid_window(WINDOW *wp);
#endif

/* screen-drivers */
#if OPT_XTERM >= 3
extern int xterm_mouse_t (int f, int n);
extern int xterm_mouse_T (int f, int n);
#endif

#if OPT_PERL
/* perl.xs (perl.c) */
extern	void	perl_default_region(void);
extern	void	perl_free_handle(void *);
extern	int	perl_free_callback(char *);
extern  void	perl_free_deferred(void);
extern	void	perl_exit(void);
#if OPT_NAMEBST
extern	int	perl_call_sub(void *, int, int, int);
extern	void	perl_free_sub(void *);
#endif

/* api.c */
extern void api_free_private(void *);
/* There are others as well, but the rest are found in api.h */
#endif

/* basic.c */
extern int can_set_nmmark(int c);
extern int firstchar (LINEPTR lp);
extern int getgoal (LINEPTR dlp);
extern int gonmmark (int c);
extern int lastchar (LINEPTR lp);
extern int next_column (int c, int col);
extern int next_sw (int col);
extern int next_tabcol (int col);
extern int nextchar (LINEPTR lp, int off);
extern int setmark (void);
extern int show_mark_is_set (int c);
extern void swapmark (void);

#if OPT_MOUSE
extern	int setcursor (int row, int col);
extern	int setwmark (int row, int col);
#endif

#if SMALLER	/* cancel 'neproto.h' */
extern int gotobob (int f, int n);
extern int gotoeob (int f, int n);
#endif

/* bind.c */
extern int ourstrstr (const char *haystack, const char *needle, int anchor);
extern char *cfg_locate (char *fname, UINT hflag);
extern char *kbd_engl (const char *prompt, char *buffer);
extern char *kcod2prc (int c, char *seq);
extern char *kcod2pstr (int c, char *seq);
extern const CMDFUNC *engl2fnc (const char *fname);
extern const CMDFUNC *kcod2fnc (BINDINGS *bs, int c);
extern int fnc2kcod (const CMDFUNC *);
extern int fnc2kins (const CMDFUNC *);
extern int kbd_complete (DONE_ARGS, const char *table, size_t size_entry);
extern int kbd_engl_stat (const char *prompt, char *buffer, int stated);
extern int kbd_length (void);
extern int kcod2escape_seq (int c, char *ptr);
extern int no_such_function (const char *fname);
extern void kbd_erase (void);
extern void kbd_erase_to_end (int column);
extern void kbd_init (void);
extern void kbd_putc (int c);
extern void kbd_unquery (void);
extern void popdown_completions (void);

#if DISP_X11
extern char *fnc2pstr (const CMDFUNC *f);
#endif

#if OPT_EVAL
extern const char *prc2engl (const char *skey);
#endif

#if OPT_MENUS
extern char *give_accelerator ( char * );
#endif

#if OPT_NAMEBST
extern int delete_namebst(const char *name, int release);
extern int insert_namebst(const char *name, const CMDFUNC *cmd, int ro);
extern int rename_namebst(const char *oldname, const char *newname);
extern int search_namebst(const char *name);
extern void build_namebst(const NTAB *nametbl, int lo, int hi);
#endif

#if OPT_TRACE
extern void trace_alarm (char *file, int lineno);
#define kbd_alarm() trace_alarm(__FILE__, __LINE__)
#else
extern void kbd_alarm (void);
#endif

/* buffer.c */
extern BUFFER *bfind (const char *bname, UINT bflag);
extern BUFFER *find_alt (void);
extern BUFFER *find_any_buffer (const char *name);
extern BUFFER *find_b_file (const char *fname);
extern BUFFER *find_b_hist(int number);
extern BUFFER *find_b_name (const char *name);
extern BUFFER *find_bp (BUFFER *bp1);
extern BUFFER *getfile2bp (const char *fname, int ok_to_ask, int cmdline);
extern BUFFER *make_bp (const char *fname, UINT flags);
extern BUFFER *make_ro_bp(const char *bname, UINT flags);
extern WINDOW *bp2any_wp (BUFFER *bp);
extern char *add_brackets(char *dst, const char *src);
extern char *hist_lookup (int c);
extern char *next_buffer_line(const char *bname);
extern char *strip_brackets(char *dst, const char *src);
extern int add_line_at (BUFFER *bp, LINEPTR prevp, const char *text, int len);
extern int addline (BUFFER *bp, const char *text, int len);
extern int any_changed_buf (BUFFER **bpp);
extern int any_unread_buf (BUFFER **bpp);
extern int ask_for_bname(char *prompt, char *bufn, size_t len);
extern int bclear (BUFFER *bp);
extern int bsizes (BUFFER *bp);
extern int buffer_in_use (BUFFER *bp);
extern int buffer_is_solo (BUFFER *bp);
extern int buffer_is_visible (BUFFER *bp);
extern int delink_bp (BUFFER *bp);
extern int kill_that_buffer (BUFFER *bp);
extern int popupbuff (BUFFER *bp);
extern int renamebuffer(BUFFER *rbp, char *bufname);
extern int shiftwid_val (BUFFER *bp);
extern int swbuffer (BUFFER *bp);
extern int swbuffer_lfl (BUFFER *bp, int lockfl, int this_window);
extern int tabstop_val (BUFFER *bp);
extern int zotbuf (BUFFER *bp);
extern int zotwp (BUFFER *bp);
extern void buffer_flags (char *dst, BUFFER *bp);
extern void chg_buff (BUFFER *bp, USHORT flag);
extern void imply_alt (char *fname, int copy, int lockfl);
extern void make_current (BUFFER *nbp);
extern void set_bname (BUFFER *bp, const char *name);
extern void set_editor_title(void);
extern void sortlistbuffers (void);
extern void unchg_buff (BUFFER *bp, USHORT flag);
extern void undispbuff (BUFFER *bp, WINDOW *wp);

#if !OPT_MAJORMODE
extern int has_C_suffix (BUFFER *bp);
#endif

#if OPT_UPBUFF
void updatelistbuffers (void);
void update_scratch (const char *name, UpBuffFunc func);
#else
#define updatelistbuffers()
#define update_scratch(name, func)
#endif

/* csrch.c */

/* display.c */
extern char *lsprintf (char *buf, const char *fmt, ...) VILE_PRINTF(2,3);
extern int col_limit (WINDOW *wp);
extern int im_waiting (int flag);
extern int mk_to_vcol (MARK mark, int expanded, BUFFER *bp, int col, int adjust);
extern int nu_width (WINDOW *wp);
extern int offs2col (WINDOW *wp, LINEPTR lp, C_NUM offset);
extern int update (int force);
extern int video_alloc (VIDEO **vpp);
extern int vtinit (void);
extern void bottomleft (void);
extern void bprintf (const char *fmt, ...) VILE_PRINTF(1,2);
extern void bputc (int c);
extern void dbgwrite (const char *fmt, ...) VILE_PRINTF(1,2);
extern void hilite (int row, int colfrom, int colto, int on);
extern void kbd_flush (void);
extern void kbd_openup (void);
extern void kbd_overlay(const char *s);
extern void mlerase (void);
extern void mlerror (const char *s);
extern void mlforce (const char *fmt, ...) VILE_PRINTF(1,2);
extern void mlprompt (const char *fmt, ...) VILE_PRINTF(1,2);
extern void mlsavec (int c);
extern void mlwarn (const char *fmt, ...) VILE_PRINTF(1,2);
extern void mlwrite (const char *fmt, ...) VILE_PRINTF(1,2);
extern void movecursor (int row, int col);
extern void newscreensize (int h, int w);
extern void tprintf (const char *fmt, ...) VILE_PRINTF(1,2);
extern void upmode (void);

#if !DISP_X11
extern void getscreensize (int *widthp, int *heightp);
#if defined(SIGWINCH)
extern SIGT sizesignal (int ACTUAL_SIG_ARGS);
#endif
#endif

#ifdef WMDLINEWRAP
extern int line_height (WINDOW *wp, LINEPTR lp);
#else
#define line_height(wp,lp) 1
#endif

#if defined(WMDLINEWRAP) || OPT_MOUSE
extern WINDOW *row2window (int row);
extern int col2offs (WINDOW *wp, LINEPTR lp, C_NUM col);
#endif

#if OPT_MLFORMAT || OPT_POSFORMAT || OPT_TITLE
extern void special_formatter(TBUFF **result, const char *fs, WINDOW *wp);
#endif

#if OPT_WORKING
extern SIGT imworking (int ACTUAL_SIG_ARGS);
#endif

extern	int	allow_working_msg (void);

#if OPT_PSCREEN
extern	OUTC_DCL psc_putchar	(OUTC_ARGS);
extern	void	psc_eeol	(void);
extern	void	psc_eeop	(void);
extern	void	psc_flush	(void);
extern	void	psc_move	(int row, int col);
extern	void	psc_rev		(UINT huh);
#endif	/* OPT_PSCREEN */

/* djhandl.c */
#if CC_DJGPP
extern ULONG was_ctrl_c_hit (void);
extern void want_ctrl_c (int yes);
extern void clear_hard_error (void);
extern void hard_error_catch_setup (void);
extern void hard_error_teardown (void);
extern int did_hard_error_occur (void);
#endif

/* statevar.c */
extern const char * vile_getenv(const char *s);

#if OPT_EVAL
extern char * get_cdpath (void);
extern char * get_findpath (void);
extern char * get_shell (void);
extern void setcmdstatus(int s);
#else
#define get_cdpath() getenv("CDPATH")
#define get_findpath() getenv("VILE_FINDPATH")
#define get_shell()  getenv("SHELL")
#define setcmdstatus(s) /*nothing*/
#endif

#if OPT_SHELL && DISP_X11
extern char * get_xdisplay (void);
extern char * get_xshell (void);
extern char * get_xshellflags (void);
#endif

/* eval.c */
extern UINT mac_tokens (void);
extern char * get_directory (void);
extern char * get_token (char *src, TBUFF **tok, int eolchar, int *actual);
extern char * get_token2 (char *src, TBUFF **tok, int eolchar, int *actual);
extern char * mac_tokval (TBUFF **tok);
extern char * mklower (char *str);
extern char * mktrimmed (char *str);
extern char * render_boolean (TBUFF **rp, int i);
extern char * render_int (TBUFF **rp, int i);
extern char * render_long (TBUFF **rp, long i);
extern char * skip_space_tab(char *src);
extern const char * tokval (char *tokn);
extern const char * skip_cblanks (const char *str);
extern const char * skip_cstring (const char *str);
extern const char * skip_ctext (const char *str);
extern int absol (int x);
extern int is_falsem (const char *val);
extern int is_truem (const char *val);
extern int mac_literalarg (TBUFF **tok);
extern int mac_token (TBUFF **tok);
extern int macroize (TBUFF **p, TBUFF *src, int skip);
extern int must_quote_token (const char * values, unsigned last);
extern int scan_bool (const char *s );
extern int toktyp (const char *tokn);
extern void append_quoted_token (TBUFF ** dst, const char * values, unsigned last);

#ifdef const
#define skip_blanks(s) skip_cblanks(s)
#define skip_string(s) skip_cstring(s)
#define skip_text(s) skip_ctext(s)
#else
extern char *skip_blanks (char *str);
extern char *skip_string (char *str);
extern char *skip_text (char *str);
#endif

#if OPT_EVAL
extern LINEPTR label2lp (BUFFER *bp, const char *label);
extern int rmv_tempvar (const char *name);
extern int set_state_variable (const char *name, const char *value);
extern int vl_lookup_func (const char *name);
extern long scan_long (const char *s);
#define scan_int(s) (int)scan_long(s)
#else
#define gtenv(name) getenv(name)
#define scan_int(s) atoi(s)
#endif

#if OPT_EVAL || DISP_X11
extern int stol (const char *val);
#endif

#if OPT_EVAL || OPT_COLOR
extern int set_palette (const char *value);
#endif

#if OPT_EVAL || !SMALLER
extern char *mkupper (char *str);
#endif

#if OPT_COLOR
extern void set_ctrans (const char *value);
#endif

#if OPT_MACRO_ARGS
extern void restore_arguments(BUFFER *bp);
extern int save_arguments(BUFFER *bp);
#else
#define restore_arguments(cfp) /*nothing*/
#define save_arguments(cfp) 1
#endif

#if OPT_SHOW_COLORS && OPT_UPBUFF
extern void relist_descolor(void);
#else
#define relist_descolor() /*nothing*/
#endif

#if OPT_UPBUFF
extern void updatelistvariables(void);
#else
#define updatelistvariables()	/*nothing */
#endif

#if (SYS_WINNT||SYS_VMS)
extern char *render_hex(TBUFF **rp, UINT i);
#endif

/* exec.c */
extern DIRECTIVE dname_to_dirnum(char **cmdp, int length);
extern int do_source (char *fname, int n, int optional);
extern int dobuf (BUFFER *bp, int n);
extern int docmd (char *cline, int execflag, int f, int n);
extern int dofile (char *fname);
extern int end_named_cmd (void);
extern int execute (const CMDFUNC *execfunc, int f, int n);
extern int more_named_cmd (void);

/* file.c */
extern SIGT imdying (int ACTUAL_SIG_ARGS);
extern int bp2readin (BUFFER *bp, int lockfl);
extern int fileuid_compare (FUID *fuid1, FUID *fuid2);
extern int fileuid_get (const char *fname, FUID *fuid);
extern int fileuid_same (BUFFER *bp, FUID *fuid);
extern int getfile (char *fname, int lockfl);
extern int ifile (char *fname, int belowthisline, FILE *haveffp);
extern int kwrite (char *fn, int msgf);
extern int no_file_found (void);
extern int no_file_name (const char *fname);
extern int no_such_file (const char *fname);
extern int readin (char *fname, int lockfl, BUFFER *bp, int mflg);
extern int same_fname (const char *fname, BUFFER *bp, int lengthen);
extern int set_files_to_edit(const char *prompt, int appflag);
extern int slowreadf (BUFFER *bp, int *nlinep);
extern int write_enc_region (void);
extern int writeout (const char *fn, BUFFER *bp, int forced, int msgf);
extern int writeregion (void);
extern time_t file_modified (char *path);
extern void explicit_dosmode(BUFFER *bp, RECORD_SEP record_sep);
extern void fileuid_invalidate (BUFFER *bp);
extern void fileuid_set (BUFFER *bp, FUID *fuid);
extern void fileuid_set_if_valid(BUFFER *bp, const char *fname);
extern void makename (char *bname, const char *fname);
extern void markWFMODE (BUFFER *bp);
extern void set_last_file_edited (const char *);
extern void unqname (char *name);

#ifdef MDCHK_MODTIME
extern int ask_shouldchange (BUFFER *bp);
extern int check_file_changed (BUFFER *bp, char *fn);
extern int check_visible_files_changed (void);
#endif

#ifdef MDCHK_MODTIME
extern int get_modtime (BUFFER *bp, time_t *the_time);
extern void set_modtime (BUFFER *bp, char *fn);
#endif

#if SMALLER	/* cancel neproto.h */
extern int filesave (int f, int n);
#endif

/* filec.c */
extern char *filec_expand (void);
extern int mlreply_dir (const char *prompt, TBUFF **buf, char *result);
extern int mlreply_file (const char *prompt, TBUFF **buf, UINT flag, char *result);

#if COMPLETE_FILES || COMPLETE_DIRS
extern int fill_directory_buffer(BUFFER *bp, char *path, int dots);
extern int path_completion (DONE_ARGS);
extern void init_filec(const char *buffer_name);
#endif

/* fileio.c */
extern B_COUNT ffsize (void);
extern int ffaccess (char *fn, UINT mode);
extern int ffclose (void);
extern int ffexists (char *p);
extern int ffhasdata (void);
extern int ffputc (int c);
extern int ffputline (const char *buf, int nbuf, const char *ending);
extern int ffronly (char *fn);
extern int ffropen (char *fn);
extern int ffwopen (char *fn, int forced);
extern int file_stat (const char *fn, struct stat *sb);

#if OPT_ENCRYPT
extern void ffdocrypt (int crypting);
#endif

#if ! SYS_MSDOS
extern int ffread (char *buf, long len);
extern void ffseek (long n);
extern void ffrewind (void);
#endif

/* finderr.c */
#if OPT_FINDERR
extern const char * get_febuff (void);
extern void set_febuff (const char *name);
#endif

#if OPT_UPBUFF
extern	int	free_err_exps(BUFFER *bp);
extern	void	update_err_regex(void);
#else
#define update_err_regex()	/*nothing */
#define free_err_exps(bp)	/*nothing */
#endif

/* glob.c */
extern	char **	glob_free   (char **list_of_items);
extern	char **	glob_string (char *item);
extern	int	doglob (char *path);
extern	int	glob_length (char **list_of_items);
extern	int	glob_match_leaf(char *leaf, char *pattern);
extern	int	string_has_wildcards(const char *item);

#if !SYS_UNIX
extern	int	glob_needed (char **list_of_items);
extern	void	expand_wild_args (int *argcp, char ***argvp);
#endif

/* globals.c */

/* history.c */
#if OPT_HISTORY
extern	int	edithistory (TBUFF **buffer, UINT *position, int *given, UINT options, int (*func)(EOL_ARGS), int eolchar);
extern	void	hst_append (TBUFF *cmd, int glue);
extern	void	hst_append_s (char *cmd, int glue);
extern	void	hst_flush (void);
extern	void	hst_glue (int c);
extern	void	hst_init (int c);
extern	void	hst_remove (const char *cmd);
extern	void	hst_reset (void);
#else
#define	hst_append(p,c)
#define	hst_append_s(p,c)
#define	hst_flush()
#define	hst_glue(c)
#define	hst_init(c)
#define	hst_remove(p)
#define	hst_reset()
#endif

/* ibmpc.c */
#if SYS_MSDOS || SYS_OS2 || SYS_WINNT
extern	VIDEO *	scread (VIDEO *vp, int row);
extern	void	scwrite (int row, int col, int nchar, const char *outstr, VIDEO_ATTR *attrstr, int forg, int bacg);
#endif

/* input.c */
extern char *add_backslashes(char *text);
extern char *user_reply(const char *prompt, const char *dftval);
extern int dotcmdbegin (void);
extern int dotcmdfinish (void);
extern int end_string (void);
extern int eol_history(EOL_ARGS);
extern int get_recorded_char (int eatit);
extern int is_edit_char (int c);
extern int kbd_delimiter (void);
extern int kbd_is_pushed_back (void);
extern int kbd_mac_recording (void);
extern int kbd_replaying (int match);
extern int kbd_reply (const char *prompt, TBUFF **extbuf, int (*efunc)(EOL_ARGS), int eolchar, KBD_OPTIONS options, int (*cfunc)(DONE_ARGS));
extern int kbd_seq (void);
extern int kbd_seq_nomap (void);
extern int kbd_show_response (TBUFF **dst, char *src, UINT bufn, int eolchar, KBD_OPTIONS options);
extern int kbd_string (const char *prompt, char *extbuf, UINT bufn, int eolchar, KBD_OPTIONS options, int (*func)(DONE_ARGS));
extern int kbd_string2 (const char *prompt, TBUFF **result, int eolchar, KBD_OPTIONS options, int (*complete)(DONE_ARGS));
extern int kbm_started (int macnum, int force);
extern int keystroke (void);
extern int keystroke8 (void);
extern int keystroke_avail (void);
extern int keystroke_raw8 (void);
extern int mapped_keystroke (void);
extern int mlquickask (const char *prompt, const char *respchars, int *cp);
extern int mlreply (const char *prompt, char *buf, UINT bufn);
extern int mlreply2 (const char *prompt, TBUFF **buf);
extern int mlreply_no_bs (const char *prompt, char *buf, UINT bufn);
extern int mlreply_no_opts (const char *prompt, char *buf, UINT bufn);
extern int mlreply_reg (const char *prompt, char *cbuf, int *retp, int at_dft);
extern int mlreply_reg_count (int state, int *retp, int *next);
extern int mlyesno (const char *prompt);
extern int no_completion (DONE_ARGS);
extern int read_quoted(int count, int verbose);
extern int screen2tbuff (TBUFF **buf, CHARTYPE inclchartype);
extern int screen_string (char *buf, int bufn, CHARTYPE inclchartype);
extern int start_kbm (int n, int macnum, ITBUFF *ptr);
extern int tgetc (int quoted);
extern int tgetc_avail (void);
extern void dotcmdstop (void);
extern void get_kbd_macro(TBUFF **rp);
extern void incr_dot_kregnum (void);
extern void kbd_kill_response (TBUFF *buf, UINT *position, int c);
extern void kbd_mac_check(void);
extern void kbd_pushback (TBUFF *buf, int skip);
extern void set_end_string (int c);
extern void tungetc(int c);
extern void unkeystroke (int c);

#if COMPLETE_FILES
extern int shell_complete (DONE_ARGS);
#else
#define shell_complete no_completion
#endif

/* insert.c */
extern int indentlen (LINEPTR lp);
extern int ins (void);
extern int ins_mode (WINDOW *wp);
extern int inschar (int c, int *backsp_limit_p);
extern int is_cindent_char (BUFFER *bp, int ch);
extern int previndent (int *bracefp);

#if OPT_EVAL
extern char *current_modename (void);
#endif

#if SMALLER	/* cancel 'neproto.h' */
extern int newline (int f, int n);
extern int wrapword (int f, int n);
#endif

/* isearch.c */
#if SMALLER	/* cancel 'neproto.h' */
extern int forwhunt (int f, int n);
extern int backhunt (int f, int n);
#endif

/* itbuff.c */
size_t	 itb_length (ITBUFF *p);
ITBUFF * itb_alloc (ITBUFF **p, size_t n);
ITBUFF * itb_append (ITBUFF **p, int c);
ITBUFF * itb_bappend (ITBUFF **, const char *s, size_t len);
ITBUFF * itb_copy (ITBUFF **d, ITBUFF *s);
ITBUFF * itb_init (ITBUFF **p, int c);
ITBUFF * itb_sappend (ITBUFF **, const char *s);
int	 itb_get (ITBUFF *p, size_t n);
int	 itb_last (ITBUFF *p);
int	 itb_more (ITBUFF *p);
int	 itb_next (ITBUFF *p);
int	 itb_peek (ITBUFF *p);
int *	 itb_values (ITBUFF *p);
void	 itb_first (ITBUFF *p);
void	 itb_free (ITBUFF **p);
void	 itb_stuff (ITBUFF *p, int c);

#if VILE_NEEDED
ITBUFF * itb_insert (ITBUFF **p, int c);
void	 itb_delete (ITBUFF *p, size_t cnt);
void	 itb_unnext (ITBUFF *p);
void	 itb_unput (ITBUFF *p);
#endif

/* lckfiles.c */
#if OPT_LCKFILES
extern int set_lock (const char *fname, char *who, int n);
extern void release_lock (const char *fname);
#endif

/* line.c */
extern LINEPTR lalloc (int used, BUFFER *bp);
extern int begin_kill (void);
extern int do_report (L_NUM value);
extern int index2reg (int c);
extern int index2ukb (int inx);
extern int kinsert (int c);
extern int kinsertlater (int c);
extern int ldelete (long n, int kflag);
extern int lreplc(LINEPTR lp, C_NUM off, int c);
extern int linsert (int n, int c);
extern int lnewline (void);
extern int lstrinsert (const char *s, int len);
extern int reg2index (int c);
extern void end_kill (void);
extern void kdone (void);
extern void kregcirculate (int killing);
extern void ksetup (void);
extern void lfree (LINEPTR lp, BUFFER *bp);
extern void lremove (BUFFER *bp, LINEPTR lp);
extern void ltextfree (LINEPTR lp, BUFFER *bp);

#if OPT_EVAL
extern int lrepltext (CHARTYPE type, const char *iline, int ilen);
extern void lgrabtext (TBUFF **rp, CHARTYPE type);
#endif

#if SMALLER	/* cancel neproto.h */
extern int insspace (int f, int n);
#endif

/* map.c */
extern int mapped_c (int remap, int raw);
extern int mapped_c_avail (void);
extern int mapped_ungotc_avail(void);
extern int sysmapped_c (void);
extern int sysmapped_c_avail (void);
extern void abbr_check (int *backsp_limit_p);
extern void addtosysmap (const char *seq, int seqlen, int code);
extern void mapungetc (int c);

/* menu.c */
#if OPT_MENUS
extern ActionFunc vlmenu_action_func(char *action);
extern char * vlmenu_is_cmd (char *action);
extern int do_menu (void * menubar);
extern int parse_menu (const char *rc_filename);
extern int vlmenu_is_bind (char *action);
	/* driver-specific interface */
extern int gui_create_menus (void);
extern void * gui_add_menu_item (void * pm, char *nom, char *accel, int the_class);
extern void * gui_make_menu (void * menubar, char *nom, int the_class);
extern void gui_add_func_callback (void * w, void * closure);
extern void gui_add_list_callback (void *pm);
#endif

/* msgs.c */
#if OPT_POPUP_MSGS
void msg_putc (int c);
void popup_msgs (void);
void purge_msgs (void);
#endif

/* modes.c */
extern REGEXVAL * free_regexval (REGEXVAL *rp);
extern REGEXVAL * new_regexval (const char *pattern, int magic);
extern char * get_record_sep (BUFFER *bp);
extern const FSM_CHOICES * name_to_choices (const char *name);
extern const char * choice_to_name (const FSM_CHOICES *choices, int code);
extern const char * string_mode_val (VALARGS *args);
extern int adjvalueset (const char *cp, int defining, int setting, int global, VALARGS *args);
extern int choice_to_code (const FSM_CHOICES *choices, const char *name, size_t len);
extern int combine_choices (const FSM_CHOICES *choices, const char *string);
extern int find_mode (BUFFER *bp, const char *mode, int global, VALARGS *args);
extern int getfillcol(BUFFER *bp);
extern int len_record_sep(BUFFER *bp);
extern int lookup_valnames(const char *rp, const struct VALNAMES *table);
extern int mode_eol (EOL_ARGS);
extern int set_mode_value (BUFFER *bp, const char *cp, int defining, int setting, int global, VALARGS *args, const char *rp);
extern int string_to_number (const char *from, int *np);
extern void copy_mvals (int maximum, struct VAL *dst, struct VAL *src);
extern void free_local_vals (const struct VALNAMES *names, struct VAL *gbl, struct VAL *val);
extern void set_record_sep(BUFFER *bp, RECORD_SEP value);
extern void set_winflags(int glob_vals, USHORT flags);

#if OPT_COLOR_SCHEMES
extern void init_scheme(void);
#endif

#if OPT_ENUM_MODES
extern int fsm_complete(DONE_ARGS);
#endif

#if OPT_EVAL || OPT_COLOR
extern int set_colors(int ncolors);
#endif

#if OPT_EVAL || OPT_MAJORMODE
extern int is_varmode ( const char *name );
extern const char *const * list_of_modes (void);
#endif

#if OPT_MAJORMODE
extern char * get_submode_name (BUFFER *bp, int n);
extern int alloc_mode (const char *name, int predef);
extern int major_complete(DONE_ARGS);
extern struct VAL * get_submode_vals (BUFFER *bp, int n);
extern struct VAL * get_submode_valx (BUFFER *bp, int n, int *m);
extern void infer_majormode (BUFFER *bp);
extern void set_majormode_rexp (const char *name, int n, const char *pat);
extern void set_submode_val (const char *name, int n, int value);
extern void set_submode_txt (const char *name, int n, char * value);
extern void set_vilemode (BUFFER *bp);
#else
#define infer_majormode(bp) fix_cmode(bp, (global_b_val(MDCMOD) && has_C_suffix(bp)))
#define set_vilemode(bp) /*nothing*/
#endif

#if OPT_SHOW_COLORS
extern int is_color_code(int n);
extern const char *get_color_name(int n);
#endif

#if OPT_UPBUFF
extern void save_vals (int maximum, struct VAL *gbl, struct VAL *dst, struct VAL *src);
#endif

#if SYS_VMS
extern const char *vms_record_format(int code);
#endif

/* npopen.c and other files :-) */
#if SYS_UNIX || SYS_MSDOS || SYS_OS2 || SYS_WINNT
extern int  inout_popen(FILE **fr, FILE **fw, char *cmd);
extern FILE *npopen(char *cmd, const char *type);
extern void npclose(FILE *fp);
extern void npflush(void);
extern int  softfork(void);
#endif

#if SYS_UNIX || SYS_OS2 || SYS_WINNT
extern int system_SHELL (char *cmd);
#endif

#if SYS_MSDOS || SYS_WINNT || (SYS_OS2 && CC_CSETPP) || TEST_DOS_PIPES
extern void npflush (void);
#endif

/* ntconio.c */
#if DISP_NTCONS
extern void ntcons_reopen(void);
#endif

/* oneliner.c */
extern int llineregion (void);
extern int plineregion (void);
extern int pplineregion (void);
extern int subst_again_region (void);
extern int subst_all_region (void);
extern int substregion (void);

/* opers.c */
extern int vile_op (int f, int n, OpsFunc fn, const char *str);

/* path.c */
extern void append_libdir_to_path(void);
extern char * home_dir (void);
extern char * is_appendname (char *fn);
extern char * last_slash (char *fn);
extern char * lengthen_path (char *path);
extern char * pathcat (char *dst, const char *path, char *leaf);
extern char * pathleaf (char *path);
extern char * shorten_path (char *path, int keep_cwd);
extern const char *parse_pathlist (const char *list, char *result);
extern int find_in_path_list(const char *path_list, char *path);
extern int is_directory (char *path);
extern int is_file (char *path);
extern int is_internalname (const char *fn);
extern int is_nonfile (char *path);
extern int is_pathname (char *path);
extern int is_scratchname (const char *fn);
extern int maybe_pathname (char *fn);
extern void append_to_path_list(char **path_list, char *path);
extern void prepend_to_path_list(char **path_list, char *path);
extern char *path_trunc(char *path,
                        int  max_path_len,
                        char *trunc_buf,
                        int  trunc_buf_len);

#if OPT_MSDOS_PATH
extern char * is_msdos_drive (char *path);
extern char * sl_to_bsl (const char *p);
#endif

#ifndef bsl_to_sl_inplace
extern void bsl_to_sl_inplace (char *p);
#endif

#if OPT_CASELESS && SYS_OS2
extern int is_case_preserving (const char *name);
#endif

#if OPT_VMS_PATH
extern char * strip_version (char *path);
extern char * unix_pathleaf (char *path);
extern char * version_of (char *fname);
extern char * vms_pathleaf (char *path);
extern int is_vms_pathname (const char *path, int option);
#endif

#if SYS_UNIX || !SMALLER
extern char * home_path (char *path);
#endif

/* random.c */
extern L_NUM line_no (BUFFER *the_buffer, LINEPTR the_line);
extern L_NUM vl_line_count (BUFFER *the_buffer);
extern TBUFF * tb_visbuf (const char *buffer, size_t len);
extern char * current_directory (int force);
extern char * vl_vischr (char *buffer, int ch);
extern int catnap (int milli, int watchinput);
extern int fmatchindent (int c);
extern int getccol (int bflg);
extern int getcol (MARK mark, int actual);
extern int getoff (C_NUM goal, C_NUM *rcolp);
extern int gocol (int n);
extern int is_user_fence (int ch, int *sdirp);
extern int line_report (L_NUM before);
extern int liststuff (const char *name, int appendit, void (*)(LIST_ARGS), int iarg, void *vargp);
extern int restore_dot(MARK saved_dot);
extern int set_directory (const char *dir);
extern long vl_atol (char *str, int base, int *failed);
extern void autocolor (void);
extern void ch_fname (BUFFER *bp, const char *fname);
extern void set_directory_from_file (BUFFER *bp);
extern void set_rdonly (BUFFER *bp, const char *name, int mode);

#ifdef HAVE_STRTOUL
extern ULONG vl_atoul(char *str, int base, int *failed);
#else
#define vl_atoul(str, base, failed) (ULONG)vl_atol(str, base, failed)
#endif

#ifndef vl_stricmp
extern int vl_stricmp(const char *a, const char *b);
#endif

#if OPT_EVAL
extern B_COUNT char_no (BUFFER *the_buffer, MARK the_mark);
extern B_COUNT vl_getcchar (void);
extern L_NUM getcline (void);
extern char * previous_directory (void);
#endif

#if OPT_HOOKS
extern int run_a_hook (HOOK *hook);
extern int run_readhook (void);
#define DisableHook(hook) (hook)->latch += 1
#define EnableHook(hook)  (hook)->latch -= 1
#else
#define run_a_hook(hook)  /*nothing*/
#define run_readhook()    /*nothing*/
#define DisableHook(hook) /*nothing*/
#define EnableHook(hook)  /*nothing*/
#endif

#if defined(__BEOS__)
extern int beos_can_output (int fd);
extern int beos_has_input (int fd);
extern void beos_napms (int millisec);
#endif

#if SYS_MSDOS || SYS_OS2 || SYS_WINNT
extern const char * curr_dir_on_drive (int drive);
extern int curdrive (void);
extern int setdrive (int d);
extern void update_dos_drv_dir (char * cwd);
# if CC_WATCOM
     extern int dos_crit_handler (UINT deverror, UINT errcode, UINT *devhdr);
# else
     extern void dos_crit_handler (void);
# endif
# if OPT_MS_MOUSE
     extern int ms_exists (void);
     extern void ms_processing (void);
# endif
#endif

/* regexp.c */
extern regexp * regcomp (const char *origexp, size_t exp_len, int magic);
extern int regexec (regexp *prog, char *string, char *stringend, int startoff, int endoff);
extern int lregexec (regexp *prog, LINEPTR lp, int startoff, int endoff);

/* region.c */
typedef int (*DORGNLINES)(int (*)(REGN_ARGS), void *, int);

extern DORGNLINES get_do_lines_rgn(void);
extern int        blank_region (void);
extern int        detab_region (void);
extern int        detabline (void *flagp, int l, int r);
extern int        entab_region (void);
extern int        entabline (void *flagp, int l, int r);
extern int        flipregion (void);
extern int        get_fl_region (REGION *rp);
extern int        getregion (REGION *rp);
extern int        kill_line(void *flagp, int l, int r);
extern int        killregion (void);
extern int        killregionmaybesave (int save);
extern int        l_detab_region (void);
extern int        l_entab_region (void);
extern int        lowerregion (void);
extern int        openregion (void);
extern int        shiftlregion (void);
extern int        shiftrregion (void);
extern int        stringrect (void);
extern int        trim_region (void);
extern int        trimline (void *flagp, int l, int r);
extern int        upperregion (void);
extern int        yankregion (void);

#if OPT_SELECTIONS
extern TBUFF * encode_attributes(LINE *lp, BUFFER *bp, REGION * top_region);
#endif

/* search.c */
extern int findpat (int f, int n, regexp *exp, int direc);
extern int fsearch (int f, int n, int marking, int fromscreen);
extern int readpattern (const char *prompt, TBUFF **apat, regexp **srchexpp, int c, int fromscreen);
extern int scanner (regexp *exp, int direct, int wrapok, int *wrappedp);
extern void attrib_matches (void);
extern void regerror (const char *s);
extern void scanboundry (int wrapok, MARK dot, int dir);

#if OPT_HILITEMATCH
void clobber_save_curbp(BUFFER *bp);
#endif

/* select.c */
#if OPT_SELECTIONS
extern	BUFFER *sel_buffer	(void);
extern	LINEPTR setup_region    (void);
extern	int	apply_attribute	(void);
extern	int	assign_attr_id	(void);
extern	int	attribute_cntl_a_seqs_in_region(REGION *rp, REGIONSHAPE shape);
extern	int	attributeregion (void);
extern	int	attributeregion_in_region(REGION *rp, REGIONSHAPE shape,
					    VIDEO_ATTR vattr, char *hc);
extern	int	decode_attribute (char *text, int length, int offset, int *countp);
extern	int	sel_begin	(void);
extern	int	sel_extend	(int wiping, int include_dot);
extern	int	sel_get_leftmark(MARK *result);
extern	int	sel_get_rightmark(MARK *result);
extern	int	sel_setshape	(REGIONSHAPE shape);
extern	void	do_sweep	(int flag);
extern	void	find_release_attr (BUFFER *bp, REGION *rp);
extern	void	free_attrib	(BUFFER *bp, AREGION *ap);
extern	void	free_attribs	(BUFFER *bp);
extern	void	sel_reassert_ownership (BUFFER *bp);
extern	void	sel_release	(void);

#if OPT_MOUSE
extern	int	on_mouse_click	(int button, int y, int x);
extern	int	paste_selection	(void);
extern	void	on_double_click	(void);
extern	void	on_triple_click	(void);
#endif

#if OPT_PERL || OPT_TCL || SYS_WINNT
extern	BUFFER *get_selection_buffer_and_region(AREGION *arp);
#endif /* OPT_PERL || OPT_TCL */

#if OPT_SEL_YANK
extern	int	sel_yank	(int reg);
extern	int	sel_attached	(void);
#endif

#if OPT_LINE_ATTRS
extern	void	lattr_shift	(BUFFER *bp, LINEPTR lp, int doto, int shift);
#endif

#else

#define	do_sweep(flag) /*nothing*/

#endif /* OPT_SELECTIONS */

/* spawn.c */
#if OPT_FINDPATH

typedef struct findcfg_struct
{
    int        disabled;   /* mode is disabled                             */
    int        recur_token;/* ascii char that triggers a recursive find;
                            * 0 (zero) indicates that this token is unset.
                            */
    int        nonrecur_token;
                           /* ascii char that triggers a nonrecursive find;
                            * 0 (zero) indicates that this token is unset.
                            */
    int        dirs_only;  /* Boolean, T -> find only looks for directory
                            * names.
                            */
    int        follow;     /* Boolean, T -> follow symbolic links. */
} FINDCFG;

extern char *last_findcmd(void);
extern int  parse_findcfg_mode(FINDCFG *pcfg, char *str);
#endif

#if OPT_SHELL
extern SIGT rtfrmshell (int ACTUAL_SIG_ARGS);
extern void pressreturn (void);
extern int filterregion (void);
extern int open_region_filter (void);
#else
#define pressreturn() (void)keystroke()
#endif

/* tags.c */
#if OPT_TAGS
extern int cmdlinetag (const char *t);
#endif /* OPT_TAGS */

/* tbuff.c */
size_t	tb_length (TBUFF *p);
TBUFF *	tb_alloc (TBUFF **p, size_t n);
TBUFF *	tb_append (TBUFF **p, int c);
TBUFF *	tb_bappend (TBUFF **p, const char *s, size_t len);
TBUFF *	tb_copy (TBUFF **d, TBUFF *s);
TBUFF *	tb_init (TBUFF **p, int c);
TBUFF *	tb_insert (TBUFF **p, size_t n, int c);
TBUFF *	tb_put (TBUFF **p, size_t n, int c);
TBUFF *	tb_sappend (TBUFF **p, const char *s);
TBUFF *	tb_sappend0 (TBUFF **p, const char *s);
TBUFF *	tb_scopy (TBUFF **p, const char *s);
TBUFF *	tb_string (const char *s);
char *	tb_values (TBUFF *p);
int	tb_get (TBUFF *p, size_t n);
int	tb_more (TBUFF *p);
int	tb_next (TBUFF *p);
int	tb_peek (TBUFF *p);
void	tb_first (TBUFF *p);
void	tb_free (TBUFF **p);
void	tb_stuff (TBUFF *p, int c);
void	tb_unnext (TBUFF *p);
void	tb_unput (TBUFF *p);

/* termio.c */
extern OUTC_DCL ttputc (OUTC_ARGS);
extern int  nullterm_setdescrip (const char *res);
extern int  nullterm_watchfd (int fd, WATCHTYPE type, long *idp);
extern int  open_terminal (TERM *termp);
extern int  ttgetc (void);
extern int  tttypahead (void);
extern int ttwatchfd (int fd, WATCHTYPE type, long *idp);
extern void nullterm_cursorvis (int flag);
extern void nullterm_icursor (int c);
extern void nullterm_kclose (void);
extern void nullterm_kopen (void);
extern void nullterm_pflush (void);
extern void nullterm_scroll (int f, int t, int n);
extern void nullterm_setback (int b);
extern void nullterm_setccol (int c);
extern void nullterm_setfore (int f);
extern void nullterm_setpal (const char *p);
extern void nullterm_settitle (const char *t);
extern void nullterm_unwatchfd (int fd, long id);
extern void ttclean (int f);
extern void ttclose (void);
extern void ttflush (void);
extern void ttopen (void);
extern void ttunclean (void);
extern void ttunwatchfd (int fd, long id);
extern void vl_save_tty (void);
extern void vl_restore_tty (void);

/* ucrypt.c */
#if	OPT_ENCRYPT
extern	int	vl_encrypt_char(int c);
extern	int	vl_resetkey (BUFFER *bp, const char *fname);
extern	void	vl_encrypt_blok (char *bptr, UINT len);
extern	void	vl_make_encrypt_key (char *dst, const char *src);
extern	void	vl_setup_encrypt (char *pw);
#endif	/* OPT_ENCRYPT */

/* undo.c */
extern void copy_for_undo (LINEPTR lp);
extern void dumpuline (LINEPTR lp);
extern void freeundostacks (BUFFER *bp, int both);
extern void mayneedundo (void);
extern void nounmodifiable (BUFFER *bp);
extern int  redo_ok(void);
extern void tag_for_undo (LINEPTR lp);
extern void toss_to_undo (LINEPTR lp);
extern int  undo_ok(void);

/* version.c */
extern const char * getversion (void);
extern const char * non_filename (void);
extern void print_usage (int code);

/* vms2unix.c */
#if OPT_VMS_PATH
extern	char *	is_vms_dirtype	(char *path);
extern	char *	is_vms_rootdir	(char *path);
extern	char *	unix2vms_path   (char *dst, const char *src);
extern	char *	vms2unix_path   (char *dst, const char *src);
extern	int	vms_ffexists	(char *filename);
extern	void	vms_dir2path	(char *path);
extern	char *	vms_path2dir    (const char *src);
#endif

#if SYS_VMS
extern	int	vms_creat	(char *path);
#endif

/* vmspipe.c */
#if SYS_VMS
extern FILE *vms_rpipe (const char *cmd, int fd, const char *input_file);
#endif

/* w32isms */
#if SYS_WINNT

#define  PASS_HIGH(c)        ((int)(c) <= print_high && (int)(c) >= print_low)
#define  _SPC_               ' '
#define  _TAB_               '\t'
#define  _TILDE_             '~'

#define W32_SKIP_SHELL(cmd)  (strnicmp(cmd, \
                                       W32_START_STR, \
                                       W32_START_STR_LEN) == 0)
#define W32_START_STR        "start "
#define W32_START_STR_LEN    (sizeof(W32_START_STR) - 1)
#define W32_SYS_ERROR        NOERROR

typedef struct fontstr_options_struct
{
    ULONG         size;      /* Font's point size.                     */
    int           bold;      /* Boolean -> T, user wants bold weight.  */
    int           italic;    /* Boolean -> T, user wants italic style. */
    char          face[256]; /* Font face requested by user.  If no face
                              * specified, face[0] == '\0';
                              */
} FONTSTR_OPTIONS;

typedef struct oleauto_options_struct
{
    int  invisible;     /* Boolean, T -> server invisible at startup        */
    int  multiple;      /* Boolean, T -> multiple server instances possible */
    int  rows, cols;    /* Size of winvile at startup, 0 if unspecified     */
    char *fontstr;      /* Ptr to font specification (see parse_font_str()),
                         * fall back on default font if NULL.
                         */
} OLEAUTO_OPTIONS;

extern void disp_win32_error(ULONG errcode, void *hwnd);
extern char *fmt_win32_error(ULONG errcode, char **buf, ULONG buflen);
extern const char *get_favorites(void);
extern int  is_win95(void);
extern int  is_winnt(void);
extern char *mk_shell_cmd_str(char *cmd, int *allocd_mem, int prepend_shc);
extern char *ntwinio_current_font(void);
extern int  ntwinio_font_frm_str(const char *fontstr, int use_mb);
extern void ntwinio_oleauto_reg(void);
extern void ntwinio_redirect_hwnd(int redirect);
extern void oleauto_exit(int code);
extern int  oleauto_init(OLEAUTO_OPTIONS *opts);
extern int  oleauto_redirected_key(ULONG keycode, ULONG keystate);
extern int  oleauto_register(OLEAUTO_OPTIONS *opts);
extern int  oleauto_unregister(void);
extern int  parse_font_str(const char *fontstr, FONTSTR_OPTIONS *results);
extern void restore_console_title(void);
extern void set_console_title(const char *title);
extern int  stdin_data_available(void);
extern int  w32_CreateProcess(char *cmd, int no_wait);
extern int  w32_del_selection(int copy_to_clipboard);
extern void w32_keybrd_reopen(int pressret);
extern int  w32_keybrd_write(char *data);
extern int  w32_system(const char *cmd);
extern int  w32_system_winvile(const char *cmd, int *pressret);
extern char *w32_wdw_title(void);
extern int  winopen_dir(const char *dir);
extern int  winsave_dir(const char *dir);
extern void winvile_cleanup(void);
extern int  winvile_cursor(int visible, int queue_change);
extern int  winvile_cursor_state(int visible, int queue_change);
extern void *winvile_hwnd(void);       /* winvile's main window */
extern void winvile_start(void);
#ifdef WINVER
extern void w32_center_window(HWND child_hwnd, HWND parent_hwnd);
#endif
#endif

/* watchfd.c */
extern int watchfd(int fd, WATCHTYPE type, char *callback);
extern void unwatchfd(int fd);
extern void dowatchcallback(int fd);

/* window.c */
extern WINDOW * wpopup (void);
extern W_VALUES * save_window_modes(BUFFER *bp);
extern int delwp (WINDOW *thewp);
extern int set_curwp (WINDOW *wp);
extern void clone_window (WINDOW *dst, WINDOW *src);
extern void copy_traits (W_TRAITS *dst, W_TRAITS *src);
extern void init_window (WINDOW *wp, BUFFER *bp);
extern void restore_window_modes(BUFFER *bp, W_VALUES *saved);
extern void shrinkwrap (void);
extern void winit (int screen);

#if OPT_EVAL
extern int getlinerow (void);
#endif

#if SMALLER	/* cancel neproto.h */
extern int reposition (int f, int n);
extern int resize (int f, int n);
#endif

#if OPT_SEL_YANK || OPT_PERL || OPT_COLOR || OPT_EVAL || OPT_DEBUGMACROS
extern WINDOW * push_fake_win(BUFFER *bp);
extern BUFFER * pop_fake_win(WINDOW *oldwp, BUFFER *oldbp);
#endif

#if OPT_PERL
extern ULONG win2id (WINDOW *wp);
extern WINDOW * id2win (ULONG id);
extern WINDOW * index2win (int idx);
#endif

#if OPT_PERL || DISP_NTWIN
extern int win2index (WINDOW *wp_to_find);
#endif

/* word.c */
extern int ffgetline (int *lenp);
extern int formatregion (void);
extern int isendviwordf (void);
extern int isendwordf (void);
extern int isnewviwordb (void);
extern int isnewviwordf (void);
extern int isnewwordb (void);
extern int isnewwordf (void);
extern int joinregion (void);
extern void fmatch (int rch);
extern void setchartype (void);

/* x11.c */
#if DISP_X11
extern	char *	x_current_fontname	(void);
extern	char *	x_get_display_name	(void);
extern	char *	x_get_icon_name		(void);
extern	char *	x_get_window_name	(void);
extern	int	x_preparse_args		(int *pargc, char ***pargv);
extern	int	x_setfont		(const char *fname);
extern	int	x_typahead		(int milli);
extern	void	x_move_events		(void);
extern	void	x_set_icon_name		(const char *name);
extern	void	x_set_window_name	(const char *name);

#if XTOOLKIT
extern	void	own_selection		(void);
#endif	/* !XTOOKIT */

#if OPT_MENUS
#ifdef NEED_X_INCLUDES
extern	Widget	x_menu_widget		(void);
#endif
extern	int	x_menu_height		(void);
#endif

#if OPT_MENUS_COLORED
extern	int	x_menu_background	(void);
extern	int	x_menu_foreground	(void);
#endif /* OPT_MENUS_COLORED */

#if OPT_WORKING
extern	void	x_working		(void);
#endif

extern	int	gui_isprint		(int ch);
#endif	/* DISP_X11 */

#if DISP_X11 || DISP_NTWIN
extern	void	gui_resize		(int cols, int rows);
#endif

#if DISP_NTWIN
extern	void	gui_version(char *program);
extern	void	gui_usage(char *program, const char *const *options, size_t length);
#endif

#if OPT_SCROLLBARS
extern	void	gui_update_scrollbar	(WINDOW *uwp);
#endif

#if NO_LEAKS
extern	void	bind_leaks (void);
extern	void	bp_leaks (void);
extern	void	ev_leaks (void);
extern	void	fileio_leaks (void);
extern	void	itb_leaks (void);
extern	void	kbs_leaks (void);
extern	void	map_leaks (void);
extern	void	mode_leaks (void);
extern	void	onel_leaks (void);
extern	void	path_leaks (void);
extern	void	tags_leaks (void);
extern	void	tb_leaks (void);
extern	void	trace_leaks (void);
extern	void	vars_leaks (void);
extern	void	vt_leaks (void);
extern	void	wp_leaks (void);

#if DISP_X11
extern	void	x11_leaks		(void);
#endif

#if OPT_FILTER
extern	void	flt_leaks (void);
extern	void	filters_leaks (void);
#endif

#endif /* NO_LEAKS */

#if defined(HAVE_MKSTEMP) && defined(HAVE_MKDTEMP)
#define vl_mkdtemp(path) mkdtemp(path)
#endif

#if SYS_UNIX
#ifdef MISSING_EXTERN_ACCESS
extern	int	access	(const char *path, int mode);
#endif
#ifdef MISSING_EXTERN_ALARM
extern	UINT	alarm	(UINT secs);
#endif
#ifdef MISSING_EXTERN_ATOI
extern int	atoi	(const char *s);
#endif
#ifdef MISSING_EXTERN_CHDIR
extern	int	chdir	(const char *path);
#endif
#ifdef MISSING_EXTERN_CLOSE
extern	int	close	(int fd);
#endif
#ifdef MISSING_EXTERN_CRYPT
extern	char *	crypt	(const char *key, const char *salt);
#endif
#ifdef MISSING_EXTERN_DUP
extern	int	dup	(int fd);
#endif
#ifdef MISSING_EXTERN_EXECLP
extern	int	execlp	(const char *path, ...);
#endif
#ifdef MISSING_EXTERN_FCLOSE
extern	int	fclose	(FILE *fp);
#endif
#ifdef MISSING_EXTERN_FCLOSE
extern	int	fflush	(FILE *fp);
#endif
#if defined(MISSING_EXTERN_FILENO) && !defined(fileno)
extern	int	fileno	(FILE *fp);
#endif
#ifdef MISSING_EXTERN_FORK
extern	int	fork	(void);
#endif
#ifdef MISSING_EXTERN_FPRINTF
extern	int	fprintf	(FILE *fp, const char *fmt, ...);
#endif
#ifdef MISSING_EXTERN_FPUTS
extern	int	fputs	(const char *s, FILE *fp);
#endif
#ifdef MISSING_EXTERN_FREAD
extern	int	fread	(char *ptr, size_t size, size_t nmemb, FILE *fp);
#endif
#ifdef MISSING_EXTERN_FREE
extern void	free	(void *ptr);
#endif
#ifdef MISSING_EXTERN_FSEEK
extern	int	fseek	(FILE *fp, long offset, int whence);
#endif
#ifdef MISSING_EXTERN_FWRITE
extern	int	fwrite	(const char *ptr, size_t size, size_t nmemb, FILE *fp);
#endif
#if defined(MISSING_EXTERN_GETCWD) && defined(HAVE_GETCWD)
extern	char *	getcwd (char *buffer, int len);
#endif
#ifdef MISSING_EXTERN_GETENV
extern	char *	getenv	(const char *name);
#endif
#ifdef MISSING_EXTERN_GETPASS
extern	char *	getpass	(const char *prompt);
#endif
#if defined(MISSING_EXTERN_GETHOSTNAME) && defined(HAVE_GETHOSTNAME)
extern	int	gethostname (char *name, int len);
#endif
#ifdef MISSING_EXTERN_GETPGRP
extern	int	getpgrp	(int pid);
#endif
#ifdef MISSING_EXTERN_GETPID
extern	int	getpid	(void);
#endif
#ifdef MISSING_EXTERN_GETUID
extern	int	getuid	(void);
#endif
#if defined(MISSING_EXTERN_GETWD) && defined(HAVE_GETWD)
extern	char *	getwd	(char *buffer);
#endif
#ifdef MISSING_EXTERN_IOCTL
extern	int	ioctl	(int fd, ULONG mask, caddr_t ptr);
#endif
#ifdef MISSING_EXTERN_ISATTY
extern	int	isatty	(int fd);
#endif
#ifdef MISSING_EXTERN_KILL
extern	int	kill	(int pid, int sig);
#endif
#if defined(MISSING_EXTERN_KILLPG) && defined(HAVE_KILLPG)
extern	int	killpg	(int pgrp, int sig);
#endif
#ifdef MISSING_EXTERN_LONGJMP
extern	void	longjmp	(jmp_buf env, int val);
#endif
#ifdef MISSING_EXTERN_LSTAT
extern	int	lstat (const char *path, struct stat *sb);
#endif
#ifdef MISSING_EXTERN_MEMSET
#ifndef memset	/* may be defined by dbmalloc */
extern	void *	memset	(void *dst, int ch, size_t n);
#endif
#endif
#if defined(MISSING_EXTERN_MKDIR) && defined(HAVE_MKDIR)
extern	int	mkdir	(const char *path, int mode);
#endif
#ifdef MISSING_EXTERN_OPEN
extern	int	open	(char *path, int flags);
#endif
#ifdef MISSING_EXTERN_PERROR
extern	void	perror	(const char *s);
#endif
#ifdef MISSING_EXTERN_PIPE
extern	int	pipe	(int filedes[2]);
#endif
#ifdef MISSING_EXTERN_PRINTF
extern	int	printf	(const char *fmt, ...);
#endif
#ifdef MISSING_EXTERN_PUTS
extern	int	puts	(const char *s);
#endif
#ifdef MISSING_EXTERN_QSORT
#if ANSI_QSORT
extern void qsort (void *base, size_t nmemb, size_t size, int (*compar)(const void *a, const void *b);
#else
extern void qsort (void *base, size_t nmemb, size_t size, int (*compar)(char **a, char **b);
#endif
#endif
#ifdef MISSING_EXTERN_READ
extern	int	read	(int fd, char *buffer, size_t size);
#endif
#ifdef MISSING_EXTERN_READLINK
extern	int	readlink (const char *path, char *buffer, size_t size);
#endif
#if defined(MISSING_EXTERN_SELECT) && defined(HAVE_SELECT) && defined(HAVE_TYPE_FD_SET)
extern	int	select	(int numfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
#endif
#ifdef MISSING_EXTERN_SETBUF
extern	void	setbuf	(FILE *fp, char *buffer);
#endif
#ifdef MISSING_EXTERN_SETBUFFER
extern	void	setbuffer (FILE *fp, char *buffer, int size);
#endif
#if defined(MISSING_EXTERN_SETITIMER) && defined(HAVE_SETITIMER)
extern	int	setitimer (int which, const struct itimerval *value, struct itimerval *ovalue);
#endif
#if defined(MISSING_EXTERN_SETJMP) && !defined(setjmp)
extern	int	setjmp	(jmp_buf env);
#endif
#ifdef MISSING_EXTERN_SETPGRP
#if SETPGRP_VOID
extern	pid_t	setpgrp	(void);
#else
extern	int	setpgrp	(int pid, int pgid);
#endif
#endif
#ifdef MISSING_EXTERN_SETSID
extern	pid_t	setsid	(void);
#endif
#ifdef MISSING_EXTERN_SETVBUF
#ifdef SETVBUF_REVERSED
extern	int	setvbuf (FILE *fp, int mode, char *buffer, size_t size);
#else
extern	int	setvbuf (FILE *fp, char *buffer, int mode, size_t size);
#endif
#endif
#ifdef MISSING_EXTERN_SLEEP
extern	int	sleep	(UINT secs);
#endif
#ifdef MISSING_EXTERN_SSCANF
extern	int	sscanf	(const char *src, const char *fmt, ...);
#endif
#ifdef MISSING_EXTERN_STRERROR
extern	char *	strerror (int code);
#endif
#ifdef MISSING_EXTERN_STRTOL
extern	long	strtol	(const char *nptr, char **endptr, int base);
#endif
#if defined(MISSING_EXTERN_STRTOUL) && defined(HAVE_STRTOUL)
extern	ULONG	strtoul	(const char *nptr, char **endptr, int base);
#endif
#ifdef MISSING_EXTERN_SYSTEM
extern	int	system	(const char *cmd);
#endif
#ifdef MISSING_EXTERN_TIME
extern	time_t	time	(time_t *t);
#endif
#ifdef MISSING_EXTERN_UNLINK
extern	int	unlink	(char *path);
#endif
#if defined(MISSING_EXTERN_UTIME) && defined(HAVE_UTIME)
extern	int	utime	(const char *path, const struct utimbuf *t);
#endif
#if defined(MISSING_EXTERN_UTIMES) && defined(HAVE_UTIMES)
extern	int	utimes	(const char *path, struct timeval *t);
#endif
#ifdef MISSING_EXTERN_WAIT
extern	int	wait	(int *sb);
#endif
#ifdef MISSING_EXTERN_WRITE
extern	int	write	(int fd, const char *buffer, int size);
#endif
#endif

#ifdef __cplusplus
}
#endif

#endif /* VILE_PROTO_H */
