Add __printflike's where possible and fix all related bugs & issues.
[dragonfly.git] / usr.bin / window / defs.h
1 /*      $NetBSD: defs.h,v 1.8 2009/04/14 08:50:06 lukem Exp $   */
2
3 /*
4  * Copyright (c) 1983, 1993
5  *      The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Edward Wang at The University of California, Berkeley.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *      @(#)defs.h      8.1 (Berkeley) 6/6/93
35  */
36
37 #include <sys/time.h>
38 #include "value.h"
39 #include "ww.h"
40
41 #ifndef EXTERN
42 #define EXTERN extern
43 #endif
44
45 #define NWINDOW 9
46
47 EXTERN struct timeval starttime;
48
49 EXTERN struct ww *window[NWINDOW];      /* the windows */
50 EXTERN struct ww *selwin;               /* the selected window */
51 EXTERN struct ww *lastselwin;           /* the last selected window */
52 EXTERN struct ww *cmdwin;               /* the command window */
53 EXTERN struct ww *framewin;             /* the window for framing */
54 EXTERN struct ww *boxwin;               /* the window for the box */
55 EXTERN struct ww *fgwin;                /* the last foreground window */
56
57 #define isfg(w)         ((w)->ww_order <= fgwin->ww_order)
58
59 EXTERN char *default_shell[128];        /* default shell argv */
60 EXTERN char *default_shellfile;         /* default shell program */
61 EXTERN int default_nline;               /* default buffer size for new windows */
62 EXTERN int default_smooth;              /* default "smooth" parameter */
63 EXTERN char escapec;                    /* the escape character */
64
65 /* flags */
66 EXTERN char quit;                       /* quit command issued */
67 EXTERN char terse;                      /* terse mode */
68 EXTERN char debug;                      /* debug mode */
69 EXTERN char incmd;                      /* in command mode */
70
71 void            addwin(struct ww *, char);
72 int             ccinit(void);
73 void            ccend(void);
74 void            ccflush(void);
75 void            ccreset(void);
76 void            ccstart(void);
77 void            c_colon(void);
78 void            c_debug(void);
79 void            c_help(void);
80 void            c_move(struct ww *);
81 void            c_put(void);
82 void            c_quit(void);
83 void            c_size(struct ww *);
84 void            c_window(void);
85 void            c_yank(void);
86 void            closeiwin(struct ww *);
87 void            closewin(struct ww *);
88 void            closewin1(struct ww *);
89 int             cx_beginbuf(char *, struct value *, int);
90 int             cx_beginfile(char *);
91 void            cx_end(void);
92 void            deletewin(struct ww *);
93 void            docmd(void);
94 int             doconfig(void);
95 void            dodefault(void);
96 int             dolongcmd(char *, struct value *, int);
97 int             dosource(char *);
98 void            error(const char *, ...) __printflike(1, 2);
99 void            err_end(void);
100 int             findid(void);
101 struct ww      *findselwin(void);
102 void            front(struct ww *, char);
103 int             getpos(int *, int *, int, int, int, int);
104 struct ww      *getwin(void);
105 void            labelwin(struct ww *);
106 void            mloop(void);
107 int             more(struct ww *,  char);
108 void            movewin(struct ww *, int, int);
109 struct ww      *openwin(int, int, int, int, int, int, char *, int, int,
110                         char *, char **);
111 struct ww      *openiwin(int, const char *);
112 void            p_memerror(void);
113 void            p_start(void);
114 void            reframe(void);
115 void            setcmd(char);
116 void            setescape(const char *);
117 int             setlabel(struct ww *, const char *);
118 void            setselwin(struct ww *);
119 void            setterse(char);
120 void            setvars(void);
121 void            sizewin(struct ww *, int, int);
122 void            startwin(struct ww *);
123 void            stopwin(struct ww *);
124 int             s_gettok(void);
125 void            verror(const char *, va_list) __printflike(1, 0);
126 void            waitnl(struct ww *);
127 int             waitnl1(struct ww *, const char *);