Initial import from FreeBSD RELENG_4:
[dragonfly.git] / usr.sbin / i4b / isdntel / defs.h
1 /*
2  * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23  * SUCH DAMAGE.
24  *
25  *---------------------------------------------------------------------------
26  *
27  *      isdntel - isdn4bsd telephone answering support
28  *      ==============================================
29  *
30  *      $Id: defs.h,v 1.10 1999/12/13 21:25:26 hm Exp $ 
31  *
32  * $FreeBSD: src/usr.sbin/i4b/isdntel/defs.h,v 1.6.2.1 2001/08/01 17:45:06 obrien Exp $
33  *
34  *      last edit-date: [Mon Dec 13 21:53:50 1999]
35  *
36  *----------------------------------------------------------------------------*/
37
38 #include <ncurses.h>
39 #include <stdio.h>
40 #include <signal.h>
41 #include <errno.h>
42 #include <string.h>
43 #include <stdlib.h>
44 #include <stdarg.h>
45 #include <unistd.h>
46 #include <fcntl.h>
47 #include <ctype.h>
48 #include <sys/time.h>
49 #if defined(__FreeBSD__) && __FreeBSD__ >= 3
50 #include <dirent.h>
51 #else
52 #include <sys/dir.h>
53 #endif
54 #include <sys/param.h>
55
56 #include <machine/i4b_ioctl.h>
57
58 #define GOOD    0
59 #define ERROR   (-1)
60 #define WARNING (-2)
61
62 #define SPOOLDIR        "/var/isdn"
63 #define PLAYCMD         "cat %s | g711conv -a >/dev/audio"
64
65 /* reread timeout in seconds */
66
67 #define REREADTIMEOUT   60
68
69 /* window dimensions */
70
71 #define START_O         3       /* main window start  */
72
73 #define DAT_POS         0
74 #define TIM_POS         (DAT_POS+10)
75 #define DST_POS         (TIM_POS+8)
76 #define SRC_POS         (DST_POS+17)
77 #define ALI_POS         (SRC_POS+17)
78 #define SEC_POS         (ALI_POS+21)
79 #define LAST_POS        (SEC_POS+5)
80
81 /* fullscreen mode menu window */
82
83 #define WMITEMS         5               /* no of items */
84 #define WMENU_LEN       18              /* window width */
85 #define WMENU_HGT       (WMITEMS+4)     /* window height */
86 #define WMENU_TITLE     "Command"
87 #define WMENU_POSLN     8               /* window position: lines */
88 #define WMENU_POSCO     20              /* window position: columns */
89
90 #define CR              0x0d
91 #define LF              0x0a
92 #define TAB             0x09
93 #define CNTRL_D         0x04
94 #define CNTRL_L         0x0c
95
96 struct onefile {
97         char    *fname;         /* filename */
98         char    *date;
99         char    *time;
100         char    *srcnumber;
101         char    *dstnumber;
102         char    *seconds;
103         char    *alias;
104         int     len;
105         struct onefile *next;   /* ptr to next entry */
106         struct onefile *prev;   /* prt to previous entry */
107 };
108
109 #ifdef MAIN
110
111 int curses_ready = 0;           /* flag, curses display is initialized */
112
113 struct onefile *cur_file = NULL;/* the CURRENT filename */
114 struct onefile *first = NULL;   /* init dir-list head-ptr */
115 struct onefile *last = NULL;    /* init dir-list tail-ptr */
116
117 WINDOW *main_w;                 /* curses main window pointer */
118
119 int nofiles = 0;
120 int cur_pos = 0;
121
122 char *spooldir = SPOOLDIR;
123 char *playstring = PLAYCMD;
124
125 #else
126
127 extern int curses_ready;
128
129 extern struct onefile *cur_file;
130 extern struct onefile *first;
131 extern struct onefile *last;
132
133 extern WINDOW *main_w;
134
135 extern int nofiles;
136 extern int cur_pos;
137
138 extern char *spooldir;
139 extern char *playstring;
140
141 #endif
142
143 extern void init_alias( char *filename );
144 extern void init_files( int inipos );
145 extern void init_screen ( void );
146 extern void do_menu ( void );
147 extern int fill_list( void );
148 extern char *get_alias( char *number );
149 extern int main ( int argc, char **argv );
150 extern void do_quit ( int exitval );
151 extern void fatal ( char *fmt, ... );
152 extern void error ( char *fmt, ... );
153 extern void play ( struct onefile * );
154 extern void delete ( struct onefile * );
155 extern void reread( void );
156
157 /* EOF */