summaryrefslogtreecommitdiff
path: root/usr.sbin/i4b/isdntel
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/i4b/isdntel')
-rw-r--r--usr.sbin/i4b/isdntel/Makefile9
-rw-r--r--usr.sbin/i4b/isdntel/alias.c139
-rw-r--r--usr.sbin/i4b/isdntel/alias.h49
-rw-r--r--usr.sbin/i4b/isdntel/defs.h156
-rw-r--r--usr.sbin/i4b/isdntel/display.c252
-rw-r--r--usr.sbin/i4b/isdntel/files.c306
-rw-r--r--usr.sbin/i4b/isdntel/isdntel.894
-rw-r--r--usr.sbin/i4b/isdntel/main.c395
8 files changed, 0 insertions, 1400 deletions
diff --git a/usr.sbin/i4b/isdntel/Makefile b/usr.sbin/i4b/isdntel/Makefile
deleted file mode 100644
index 7528571737155..0000000000000
--- a/usr.sbin/i4b/isdntel/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Id$
-
-PROG = isdntel
-SRCS = main.c display.c files.c alias.c
-DPADD = ${LIBNCURSES} ${LIBMYTINFO}
-LDADD = -lncurses -lmytinfo
-MAN8 = isdntel.8
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/i4b/isdntel/alias.c b/usr.sbin/i4b/isdntel/alias.c
deleted file mode 100644
index fa02ea962cd4a..0000000000000
--- a/usr.sbin/i4b/isdntel/alias.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- *---------------------------------------------------------------------------
- *
- * isdntel - isdn4bsd telephone answering machine support
- * ======================================================
- *
- * $Id: alias.c,v 1.5 1998/12/05 18:03:51 hm Exp $
- *
- * last edit-date: [Sat Dec 5 18:15:02 1998]
- *
- *----------------------------------------------------------------------------*/
-
-#include "defs.h"
-#include "alias.h"
-
-static struct alias *firsta = NULL;
-
-#define MAXBUFSZ 256
-
-/*---------------------------------------------------------------------------*
- * read in and init aliases
- *---------------------------------------------------------------------------*/
-void
-init_alias(char *filename)
-{
- FILE *fp;
- char buffer[MAXBUFSZ + 1];
- char number[MAXBUFSZ + 1];
- char name[MAXBUFSZ + 1];
- char *s, *d;
- struct alias *newa = NULL;
- struct alias *lasta = NULL;
-
- if((fp = fopen(filename, "r")) == NULL)
- fatal("cannot open aliasfile %s!", filename);
-
- while((fgets(buffer, MAXBUFSZ, fp)) != NULL)
- {
- if(buffer[0] == '#' || buffer[0] == ' ' ||
- buffer[0] == '\t' || buffer[0] == '\n')
- {
- continue;
- }
-
- s = buffer;
- d = number;
-
- while(*s && (isdigit(*s)))
- *d++ = *s++;
-
- *d = '\0';
-
- while(*s && (isspace(*s)))
- s++;
-
- d = name;
-
- while(*s && (isprint(*s)))
- *d++ = *s++;
-
- *d = '\0';
-
- if((strlen(number) > 1) && (strlen(name) > 1))
- {
- if((newa = (struct alias *) malloc(sizeof(struct alias))) == NULL)
- fatal("malloc failed for struct alias");
- if((newa->number = (char *) malloc(strlen(number)+1)) == NULL)
- fatal("malloc failed for number alias");
- if((newa->name = (char *) malloc(strlen(name)+1)) == NULL)
- fatal("malloc failed for name alias");
- strcpy(newa->name, name);
- strcpy(newa->number, number);
- newa->next = NULL;
-
- if(firsta == NULL)
- {
- firsta = newa;
- }
- else
- {
- lasta->next = newa;
- }
- lasta = newa;
- }
- }
- fclose(fp);
-}
-
-/*---------------------------------------------------------------------------*
- * read in and init aliases
- *---------------------------------------------------------------------------*/
-char *
-get_alias(char *number)
-{
- struct alias *ca = NULL;
-
- if(firsta == NULL)
- return(NULL);
-
- ca = firsta;
-
- for(;;)
- {
- if(strlen(number) == strlen(ca->number))
- {
- if(!(strcmp(number, ca->number)))
- return(ca->name);
- }
- if(ca->next == NULL)
- break;
- ca = ca->next;
- }
- return(NULL);
-}
-
-/* EOF */
diff --git a/usr.sbin/i4b/isdntel/alias.h b/usr.sbin/i4b/isdntel/alias.h
deleted file mode 100644
index 98b91daf8feb4..0000000000000
--- a/usr.sbin/i4b/isdntel/alias.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- *---------------------------------------------------------------------------
- *
- * isdn4bsd common alias file handling header
- * ==========================================
- *
- * $Id: alias.h,v 1.3 1998/12/05 18:03:52 hm Exp $
- *
- * last edit-date: [Sat Dec 5 18:15:13 1998]
- *
- *----------------------------------------------------------------------------*/
-
-#ifndef _ALIAS_H_
-#define _ALIAS_H_
-
-#define ALIASFILE "/etc/isdn/isdntel.alias"
-
-struct alias {
- char *number; /* telephone number string */
- char *name; /* name string */
- struct alias *next; /* ptr to next alias */
-};
-
-#endif /* _ALIAS_H_ */
-
-/* EOF */
diff --git a/usr.sbin/i4b/isdntel/defs.h b/usr.sbin/i4b/isdntel/defs.h
deleted file mode 100644
index e9233c370355f..0000000000000
--- a/usr.sbin/i4b/isdntel/defs.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- *---------------------------------------------------------------------------
- *
- * isdntel - isdn4bsd telephone answering support
- * ==============================================
- *
- * $Id: defs.h,v 1.6 1998/12/05 18:03:53 hm Exp $
- *
- * last edit-date: [Sat Dec 5 18:15:26 1998]
- *
- *----------------------------------------------------------------------------*/
-
-#include <ncurses.h>
-#include <stdio.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <sys/time.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-#include <dirent.h>
-#else
-#include <sys/dir.h>
-#endif
-#include <sys/param.h>
-
-#define VERSION "1" /* version number */
-#define REL "11" /* release number */
-
-#define GOOD 0
-#define ERROR (-1)
-#define WARNING (-2)
-
-#define SPOOLDIR "/var/isdn"
-#define PLAYCMD "cat %s | alaw2ulaw >/dev/audio"
-
-/* reread timeout in seconds */
-
-#define REREADTIMEOUT 60
-
-/* window dimensions */
-
-#define START_O 3 /* main window start */
-
-#define DAT_POS 0
-#define TIM_POS (DAT_POS+10)
-#define DST_POS (TIM_POS+8)
-#define SRC_POS (DST_POS+17)
-#define ALI_POS (SRC_POS+17)
-#define SEC_POS (ALI_POS+21)
-#define LAST_POS (SEC_POS+5)
-
-/* fullscreen mode menu window */
-
-#define WMITEMS 5 /* no of items */
-#define WMENU_LEN 18 /* window width */
-#define WMENU_HGT (WMITEMS+4) /* window height */
-#define WMENU_TITLE "Command"
-#define WMENU_POSLN 8 /* window position: lines */
-#define WMENU_POSCO 20 /* window position: columns */
-
-#define CR 0x0d
-#define LF 0x0a
-#define TAB 0x09
-#define CNTRL_D 0x04
-#define CNTRL_L 0x0c
-
-struct onefile {
- char *fname; /* filename */
- char *date;
- char *time;
- char *srcnumber;
- char *dstnumber;
- char *seconds;
- char *alias;
- int len;
- struct onefile *next; /* ptr to next entry */
- struct onefile *prev; /* prt to previous entry */
-};
-
-#ifdef MAIN
-
-int curses_ready = 0; /* flag, curses display is initialized */
-
-struct onefile *cur_file = NULL;/* the CURRENT filename */
-struct onefile *first = NULL; /* init dir-list head-ptr */
-struct onefile *last = NULL; /* init dir-list tail-ptr */
-
-WINDOW *main_w; /* curses main window pointer */
-
-int nofiles = 0;
-int cur_pos = 0;
-
-char *spooldir = SPOOLDIR;
-char *playstring = PLAYCMD;
-
-#else
-
-extern int curses_ready;
-
-extern struct onefile *cur_file;
-extern struct onefile *first;
-extern struct onefile *last;
-
-extern WINDOW *main_w;
-
-extern int nofiles;
-extern int cur_pos;
-
-extern char *spooldir;
-extern char *playstring;
-
-#endif
-
-extern void init_alias( char *filename );
-extern void init_files( int inipos );
-extern void init_screen ( void );
-extern void do_menu ( void );
-extern int fill_list( void );
-extern char *get_alias( char *number );
-extern int main ( int argc, char **argv );
-extern void do_quit ( int exitval );
-extern void fatal ( char *fmt, ... );
-extern void error ( char *fmt, ... );
-extern void play ( struct onefile * );
-extern void delete ( struct onefile * );
-extern void reread( void );
-
-/* EOF */
diff --git a/usr.sbin/i4b/isdntel/display.c b/usr.sbin/i4b/isdntel/display.c
deleted file mode 100644
index 1cc0034f01cf0..0000000000000
--- a/usr.sbin/i4b/isdntel/display.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- *---------------------------------------------------------------------------
- *
- * isdntel - isdn4bsd telephone answering machine support
- * ======================================================
- *
- * $Id: display.c,v 1.4 1998/12/05 18:03:55 hm Exp $
- *
- * last edit-date: [Sat Dec 5 18:15:40 1998]
- *
- *----------------------------------------------------------------------------*/
-
-#include "defs.h"
-
-static char *helpstr = "Enter Control-D to exit program or RETURN for command window";
-
-/*---------------------------------------------------------------------------*
- * init curses fullscreen display
- *---------------------------------------------------------------------------*/
-void
-init_screen(void)
-{
- char buffer[512];
-
- initscr(); /* curses init */
-
- if((COLS < 80) || (LINES < 24))
- fatal(0, "ERROR, minimal screensize must be 80x24, is %dx%d, terminating!", COLS, LINES);
-
-
- if((main_w = newwin(LINES-START_O-2, COLS, START_O, 0)) == NULL)
- fatal("ERROR, curses init main window, terminating!");
-
- raw(); /* raw input */
- noecho(); /* do not echo input */
- keypad(stdscr, TRUE); /* use special keys */
- keypad(main_w, TRUE); /* use special keys */
- scrollok(main_w, TRUE);
-
- sprintf(buffer, " isdntel %s.%s ", VERSION, REL);
-
- move(0, 0);
- standout();
- hline(ACS_HLINE, 5);
- move(0, 5);
- addstr(buffer);
- move(0, 5 + strlen(buffer));
- hline(ACS_HLINE, 256);
- standend();
-
- move(1, 0);
- addstr("Date Time Called Party Calling Party Alias Length");
- /* 31.12.96 16:45:12 1234567890123456 1234567890123456 12345678901234567890 123456 */
-
- move(2, 0);
- hline(ACS_HLINE, 256);
-
- move(LINES-2, 0);
- hline(ACS_HLINE, 256);
-
- mvaddstr(LINES-1, (COLS / 2) - (strlen(helpstr) / 2), helpstr);
-
- refresh();
-
- wrefresh(main_w);
-
- curses_ready = 1;
-}
-
-/*---------------------------------------------------------------------------*
- * curses menu for fullscreen command mode
- *---------------------------------------------------------------------------*/
-void
-do_menu(void)
-{
- static char *menu[WMITEMS] =
- {
- "Play File",
-#define PLAY 0
- "Delete File",
-#define DELETE 1
- "Re-Read Spool",
-#define REREAD 2
- "Refresh Screen",
-#define REFRESH 3
- "Exit Program",
-#define EXIT 4
- };
-
- WINDOW *menu_w;
- int c;
- int mpos;
-
- /* create a new window in the lower screen area */
-
- if((menu_w = newwin(WMENU_HGT, WMENU_LEN, WMENU_POSLN, WMENU_POSCO )) == NULL)
- return;
-
- keypad(menu_w, TRUE); /* use special keys */
-
- /* draw border around the window */
-
- box(menu_w, 0, 0);
-
- /* add a title */
-
- wstandout(menu_w);
- mvwaddstr(menu_w, 0, (WMENU_LEN / 2) - (strlen(WMENU_TITLE) / 2), WMENU_TITLE);
- wstandend(menu_w);
-
- /* fill the window with the menu options */
-
- for(mpos=0; mpos <= (WMITEMS-1); mpos++)
- mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]);
-
- /* highlight the first menu option */
-
- mpos = 0;
- wstandout(menu_w);
- mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]);
- wstandend(menu_w);
-
- /* input loop */
-
- for(;;)
- {
- wrefresh(menu_w);
-
- c = wgetch(menu_w);
-
- switch(c)
- {
- case TAB:
- case KEY_DOWN: /* down-move cursor */
- case ' ':
- mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]);
- mpos++;
- if(mpos >= WMITEMS)
- mpos = 0;
- wstandout(menu_w);
- mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]);
- wstandend(menu_w);
- break;
-
- case KEY_UP: /* up-move cursor */
- mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]);
- if(mpos)
- mpos--;
- else
- mpos = WMITEMS-1;
- wstandout(menu_w);
- mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]);
- wstandend(menu_w);
- break;
-
- case 'R':
- case 'r':
- wrefresh(curscr);
- goto mexit;
-
- case 'E':
- case 'e':
- case 'Q':
- case 'q':
- case 'X':
- case 'x':
- do_quit(0);
- goto mexit;
- break;
-
- case 'P':
- case 'p':
- play(cur_file);
- goto mexit;
- break;
-
- case 'D':
- case 'd':
- delete(cur_file);
- goto mexit;
- break;
-
- case CR:
- case LF: /* exec highlighted option */
-#ifdef KEY_ENTER
- case KEY_ENTER:
-#endif
- switch(mpos)
- {
- case PLAY:
- play(cur_file);
- goto mexit;
- break;
- case DELETE:
- delete(cur_file);
- goto mexit;
- break;
- case REREAD:
- reread();
- goto mexit;
- break;
- case REFRESH:
- wrefresh(curscr);
- break;
- case EXIT:
- do_quit(0);
- break;
- }
- goto mexit;
- break;
-
- default:
- goto mexit;
- break;
- }
- }
-
-mexit:
- /* delete the menu window */
-
- delwin(menu_w);
-
- /* re-display the original lower window contents */
-
- touchwin(main_w);
- wrefresh(main_w);
-}
-
-/* EOF */
diff --git a/usr.sbin/i4b/isdntel/files.c b/usr.sbin/i4b/isdntel/files.c
deleted file mode 100644
index ea153f5ee0064..0000000000000
--- a/usr.sbin/i4b/isdntel/files.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- *---------------------------------------------------------------------------
- *
- * isdntel - isdn4bsd telephone answering machine support
- * ======================================================
- *
- * $Id: files.c,v 1.6 1998/12/05 18:03:56 hm Exp $
- *
- * last edit-date: [Sat Dec 5 18:15:57 1998]
- *
- *----------------------------------------------------------------------------*/
-
-#include "defs.h"
-
-/*---------------------------------------------------------------------------*
- * create a doubly linked list in sorted order, return pointer to new
- * first element of list
- *---------------------------------------------------------------------------*/
-struct onefile *store
- (register struct onefile *new, /* new entry to store into list */
- register struct onefile *top) /* current first entry in list */
-{
- register struct onefile *old, *p;
-
- if (last == NULL) /* enter very first element ? */
- {
- new->next = NULL;
- new->prev = NULL;
- last = new; /* init last */
- return (new); /* return new first */
- }
- p = top; /* p = old first element */
- old = NULL;
- while (p)
- {
- if ((strcmp(p->fname, new->fname)) < 0) /* current less new ? */
- {
- old = p;
- p = p->next;
- }
- else
- { /* current >= new */
-
- if (p->prev)
- {
- p->prev->next = new;
- new->next = p;
- new->prev = p->prev;
- p->prev = new;
- return (top);
- }
- new->next = p;
- new->prev = NULL;
- p->prev = new;
- return (new);
- }
- }
- old->next = new;
- new->next = NULL;
- new->prev = old;
- last = new;
- return (first);
-}
-
-/*---------------------------------------------------------------------------*
- * read current directory and build up a doubly linked sorted list
- *---------------------------------------------------------------------------*/
-int
-fill_list(void)
-{
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- register struct dirent *dp;
-#else
- register struct direct *dp;
-#endif
- register struct onefile *new_entry;
- register DIR *dirp;
- int flcnt = 0;
- char tmp[80];
- char *s, *d;
-
- if ((dirp = opendir(spooldir)) == NULL)
- fatal("cannot open spooldirectory %s!\n", spooldir);
-
- for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
- {
- if(!isdigit(*(dp->d_name)))
- continue;
-
- if ((new_entry = (struct onefile *) malloc(sizeof(struct onefile))) == NULL)
- {
- fatal("files.c, fill_list(): structure onefile malloc failed");
- }
-
- /* alloc filename memory and copy name into it */
-
- if ((new_entry->fname = (char *) malloc(strlen(dp->d_name) + 1)) == NULL)
- {
- fatal("files.c, fill_list(): malloc filename string memory failed");
- }
-
- strcpy(new_entry->fname, dp->d_name);
-
- /* fill in remaining fields from filename */
-
- tmp[0] = dp->d_name[4]; /* day msb */
- tmp[1] = dp->d_name[5]; /* day lsb */
- tmp[2] = '.';
- tmp[3] = dp->d_name[2]; /* month msb */
- tmp[4] = dp->d_name[3]; /* month lsb */
- tmp[5] = '.';
- tmp[6] = dp->d_name[0]; /* year msb */
- tmp[7] = dp->d_name[1]; /* year lsb */
- tmp[8] = '\0';
-
- if((new_entry->date = (char *) malloc(strlen(tmp) + 1)) == NULL)
- {
- fatal("files.c, fill_list(): malloc date string memory failed");
- }
-
- strcpy(new_entry->date, tmp);
-
- tmp[0] = dp->d_name[6]; /* hour msb */
- tmp[1] = dp->d_name[7]; /* hour lsb */
- tmp[2] = ':';
- tmp[3] = dp->d_name[8]; /* minute msb */
- tmp[4] = dp->d_name[9]; /* minute lsb */
- tmp[5] = ':';
- tmp[6] = dp->d_name[10]; /* second msb */
- tmp[7] = dp->d_name[11]; /* second lsb */
- tmp[8] = '\0';
-
- if((new_entry->time = (char *) malloc(strlen(tmp) + 1)) == NULL)
- {
- fatal("files.c, fill_list(): malloc time string memory failed");
- }
-
- strcpy(new_entry->time, tmp);
-
- /* destination number */
-
- s = &dp->d_name[13];
- d = &tmp[0];
-
- while(*s && (*s != '-'))
- *d++ = *s++;
-
- *d = '\0';
-
- if((new_entry->dstnumber = (char *) malloc(strlen(tmp) + 1)) == NULL)
- {
- fatal("files.c, fill_list(): malloc dstnumber string memory failed");
- }
-
- strcpy(new_entry->dstnumber, tmp);
-
- /* source number */
-
- s++;
- d = &tmp[0];
-
- while(*s && (*s != '-'))
- *d++ = *s++;
-
- *d = '\0';
-
- if((new_entry->srcnumber = (char *) malloc(strlen(tmp) + 1)) == NULL)
- {
- fatal("files.c, fill_list(): malloc srcnumber string memory failed");
- }
-
- strcpy(new_entry->srcnumber, tmp);
-
- /* length in seconds */
-
- s++;
- d = &tmp[0];
-
- while(*s && (*s != '-'))
- *d++ = *s++;
-
- *d = '\0';
-
- if((new_entry->seconds = (char *) malloc(strlen(tmp) + 1)) == NULL)
- {
- fatal("files.c, fill_list(): malloc seconds string memory failed");
- }
-
- strcpy(new_entry->seconds, tmp);
-
- /* search for alias and add if found */
-
- new_entry->alias = get_alias(new_entry->srcnumber);
-
- /* sort entry into linked list */
-
- first = store(new_entry, first);
-
- flcnt++; /* increment file count */
- }
- closedir(dirp); /* close current dir */
- return(flcnt); /* ok return */
-}
-
-/*---------------------------------------------------------------------------*
- * free the current malloc'ed list
- *---------------------------------------------------------------------------*/
-void
-free_list(void)
-{
- register struct onefile *dir;
- register struct onefile *tmp;
-
- dir = first; /* start of linked list */
-
- while (dir) /* free all */
- {
- tmp = dir->next; /* save ptr to next entry */
- free(dir->fname); /* free filename space */
- free(dir->date);
- free(dir->time);
- free(dir->srcnumber);
- free(dir->dstnumber);
- free(dir->seconds);
- free(dir); /* free struct space */
- dir = tmp; /* ptr = ptr to next entry */
- }
- first = NULL; /* first ptr = NULL */
- last = NULL; /* last ptr = NULL */
-}
-
-/*---------------------------------------------------------------------------*
- * delete a file
- *---------------------------------------------------------------------------*/
-void
-delete(struct onefile *this)
-{
- char buffer[MAXPATHLEN+1];
-
- if(this == NULL)
- return;
-
- sprintf(buffer, "%s", this->fname);
-
- unlink(buffer);
-
- free_list();
-
- wclear(main_w);
-
- init_files(cur_pos);
-}
-
-/*---------------------------------------------------------------------------*
- * reread the spool directory
- *---------------------------------------------------------------------------*/
-void
-reread(void)
-{
- free_list();
-
- wclear(main_w);
-
- init_files(cur_pos);
-}
-
-/*---------------------------------------------------------------------------*
- * play a file
- *---------------------------------------------------------------------------*/
-void
-play(struct onefile *this)
-{
- char buffer[MAXPATHLEN+1];
-
- if(this == NULL)
- return;
-
- sprintf(buffer, playstring, this->fname);
-
- system(buffer);
-}
-
-/*---------------------------------- EOF -------------------------------------*/
diff --git a/usr.sbin/i4b/isdntel/isdntel.8 b/usr.sbin/i4b/isdntel/isdntel.8
deleted file mode 100644
index d87c848a8bc06..0000000000000
--- a/usr.sbin/i4b/isdntel/isdntel.8
+++ /dev/null
@@ -1,94 +0,0 @@
-.\"
-.\" Copyright (c) 1997, 1998 Hellmuth Michaelis. 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" last edit-date: [Sat Dec 5 18:16:19 1998]
-.\"
-.\" $Id: isdntel.8,v 1.6 1998/12/05 18:03:58 hm Exp $
-.\"
-.Dd July 11, 1998
-.Dt isdntel 8
-.Sh NAME
-.Nm isdntel
-.Nd isdn4bsd telephone answering management utility
-.Sh SYNOPSIS
-.Nm isdntel
-.Op Fl a Ar aliasfile
-.Op Fl d Ar spooldir
-.Op Fl p Ar playcommand
-.Op Fl t Ar timeout
-.Sh DESCRIPTION
-.Nm
-is used to provide an "answering machine" functionality for incoming
-telephone voice messages.
-.Pp
-The following options are supported:
-.Bl -tag -width Ds
-.It Fl a
-Use
-.Ar aliasfile
-as the pathname for an aliasfile containing aliases for phone numbers. The
-default path is
-.Em /etc/isdn/isdntel.alias .
-The format of an alias entry is the number string followed by one or more
-spaces or tabs. The rest of the line is taken as the alias string. Comments
-are introduced by a leading blank, tab or "#" character.
-.It Fl d
-Use
-.Ar spooldir
-as the directory where the incoming voice messages are stored by the
-"answ" script called by
-.Xr isdnd 8 .
-This defaults to the directory
-.Em /var/isdn .
-The format of a voice message filename is:
-.Pp
-.Dl YYMMDDhhmmss-dest_number-source_number-length_in_secs
-.It Fl p
-Use
-.Ar playcommand
-as the command string to execute for playing a voice message to some audio
-output facility. The characters
-.Em %s
-are replaced by the currently selected filename. The default string is
-.Em cat %s | alaw2ulaw >/dev/audio
-.It Fl t
-The value for
-.Ar timeout
-specifies the time in seconds the program rereads the spool directory
-when there is no keyboard activity.
-.El
-.Pp
-The screen output should be obvious. If in doubt, consult the source.
-.Sh SEE ALSO
-.Xr isdnd 8
-.Xr isdnd.rc 5
-.Xr i4btel 4
-
-.Sh BUGS
-Still two or more left.
-
-.Sh AUTHOR
-The
-.Nm
-utility and this manual page were written by Hellmuth Michaelis (hm@kts.org)
diff --git a/usr.sbin/i4b/isdntel/main.c b/usr.sbin/i4b/isdntel/main.c
deleted file mode 100644
index fd6a3b2ccf563..0000000000000
--- a/usr.sbin/i4b/isdntel/main.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- *---------------------------------------------------------------------------
- *
- * isdntel - isdn4bsd telephone answering machine support
- * ======================================================
- *
- * $Id: main.c,v 1.6 1998/12/05 18:03:59 hm Exp $
- *
- * last edit-date: [Sat Dec 5 18:16:33 1998]
- *
- *----------------------------------------------------------------------------*/
-
-#define MAIN
-#include "defs.h"
-#include "alias.h"
-
-static void usage( void );
-
-static int top_dis = 0;
-static int bot_dis = 0;
-static int cur_pos_scr = 0;
-
-static void makecurrent(int cur_pos, struct onefile *cur_file, int cold);
-
-/*---------------------------------------------------------------------------*
- * program entry
- *---------------------------------------------------------------------------*/
-int
-main(int argc, char **argv)
-{
- int i;
- int kchar;
-
- char *spooldir = SPOOLDIR;
- char *playstring = PLAYCMD;
- char *aliasfile = ALIASFILE;
- int rrtimeout = REREADTIMEOUT;
-
- extern char *optarg;
-
- while ((i = getopt(argc, argv, "a:d:p:t:?")) != EOF)
- {
- switch (i)
- {
- case 'a':
- aliasfile = optarg;
- break;
-
- case 'd':
- spooldir = optarg;
- break;
-
- case 'p':
- playstring = optarg;
- break;
-
- case 't':
- if(isdigit(*optarg))
- {
- rrtimeout = strtoul(optarg, NULL, 10);
- }
- else
- {
- usage();
- }
- break;
-
- case '?':
- default:
- usage();
- break;
- }
- }
-
- if(rrtimeout < 10)
- rrtimeout = 10;
-
- if((chdir(spooldir)) != 0)
- fatal("cannot change directory to spooldir %s!", spooldir);
-
- init_alias(aliasfile);
-
- init_screen();
-
- init_files(0);
-
- /* go into loop */
-
- for (;;)
- {
- fd_set set;
- struct timeval timeout;
-
- FD_ZERO(&set);
- FD_SET(STDIN_FILENO, &set);
- timeout.tv_sec = rrtimeout;
- timeout.tv_usec = 0;
-
- /* if no char is available within timeout, reread spool */
-
- if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0)
- {
- reread();
- continue;
- }
-
- kchar = wgetch(main_w); /* get char */
-
- switch (kchar)
- {
- case CR:
- case LF:
-#ifdef KEY_ENTER
- case KEY_ENTER:
-#endif
- do_menu();
- break;
-
- case KEY_UP: /* up-move cursor */
- if(cur_file && cur_file->prev)
- {
- cur_file = cur_file->prev;
- cur_pos--;
- }
- break;
-
-
- case TAB:
- case KEY_DOWN: /* down-move cursor */
- if(cur_file && cur_file->next)
- {
- cur_file = cur_file->next;
- cur_pos++;
- }
- break;
-
- case KEY_HOME: /* move cursor to first dir */
- break;
-
- case KEY_LL: /* move cursor to last file */
- break;
-
- case CNTRL_D:
- do_quit(0);
- break;
-
- case CNTRL_L: /* refresh */
- touchwin(curscr);
- wrefresh(curscr);
- break;
-
- }
- makecurrent(cur_pos, cur_file, 0);
- }
-
- do_quit(0);
-
- return(0);
-}
-
-/*---------------------------------------------------------------------------*
- * handle horizontal selection bar movement
- *---------------------------------------------------------------------------*/
-static void
-makecurrent(int cur_pos, struct onefile *cur_file, int cold)
-{
- static int lastpos;
- static struct onefile *lastfile;
- char buffer[256];
-
- /* un-higlight current horizontal bar */
-
- if(!cold && lastfile && cur_file)
- {
- sprintf(buffer, "%s %s %-16s %-16s %-20s %-6s%*s",
- lastfile->date, lastfile->time,
- lastfile->dstnumber, lastfile->srcnumber,
- lastfile->alias == NULL ? "-/-" : lastfile->alias,
- lastfile->seconds,
- COLS - LAST_POS - 2, "");
-
- wattroff(main_w, A_REVERSE);
- mvwprintw(main_w, lastpos, 0, "%s", buffer);
- wattroff(main_w, A_REVERSE);
- }
-
- if(cur_file == NULL)
- {
- lastpos = cur_pos_scr;
- lastfile = cur_file;
- return;
- }
-
- /* have to scroll up or down ? */
-
- if(cur_pos >= bot_dis)
- {
- /* scroll up */
-
- wscrl(main_w, 1);
-
- bot_dis++;
- top_dis++;
- cur_pos_scr = LINES-START_O-3;
- }
- else if(cur_pos < top_dis)
- {
- /* scroll down */
-
- wscrl(main_w, -1);
-
- bot_dis--;
- top_dis--;
- cur_pos_scr = 0;
- }
- else
- {
- cur_pos_scr = cur_pos - top_dis;
- }
-
- sprintf(buffer, "%s %s %-16s %-16s %-20s %-6s%*s",
- cur_file->date, cur_file->time,
- cur_file->dstnumber, cur_file->srcnumber,
- cur_file->alias == NULL ? "-/-" : cur_file->alias,
- cur_file->seconds,
- COLS - LAST_POS - 2, "");
-
- wattron(main_w, A_REVERSE);
- mvwprintw(main_w, cur_pos_scr, 0, "%s", buffer);
- wattroff(main_w, A_REVERSE);
-
- lastpos = cur_pos_scr;
- lastfile = cur_file;
-
- wrefresh(main_w);
-}
-
-/*---------------------------------------------------------------------------*
- * exit program
- *---------------------------------------------------------------------------*/
-void
-do_quit(int exitval)
-{
- move(LINES-1, 0);
- clrtoeol();
- refresh();
- endwin();
- exit(exitval);
-}
-
-/*---------------------------------------------------------------------------*
- * usage display and exit
- *---------------------------------------------------------------------------*/
-static void
-usage(void)
-{
- fprintf(stderr, "\n");
- fprintf(stderr, "isdntel - isdn telephone answering management support utility (version %s.%s)\n", VERSION, REL);
- fprintf(stderr, " usage: isdntel -a <filename> -d <directory> -p <command> -t <timeout>\n");
- fprintf(stderr, " -a <filename> use filename as alias file\n");
- fprintf(stderr, " -d <directory> use directory as spool directory\n");
- fprintf(stderr, " -p <command> specify commandline for play command\n");
- fprintf(stderr, " -t <timeout> spool directory reread timeout in seconds\n");
- fprintf(stderr, "\n");
- exit(1);
-}
-
-/*---------------------------------------------------------------------------*
- * fatal error exit
- *---------------------------------------------------------------------------*/
-void
-fatal(char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
-
- if(curses_ready)
- {
- move(LINES-1, 0);
- clrtoeol();
- refresh();
- endwin();
- }
-
- fprintf(stderr, "\nFatal error: ");
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n\n");
-
- va_end(ap);
-
- exit(1);
-}
-
-/*---------------------------------------------------------------------------*
- * error printing
- *---------------------------------------------------------------------------*/
-void
-error(char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
-
- if(curses_ready)
- {
- wprintw(main_w, "ERROR: ");
- vwprintw(main_w, fmt, ap);
- wprintw(main_w, "\n");
- wrefresh(main_w);
- }
- else
- {
- fprintf(stderr, "ERROR: ");
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
- }
-
- va_end(ap);
-}
-
-/*---------------------------------------------------------------------------*
- * read files and fill display
- *---------------------------------------------------------------------------*/
-void
-init_files(int inipos)
-{
- int i;
-
- nofiles = fill_list();
-
- top_dis = 0;
- bot_dis = 0;
-
- cur_file = first;
-
- cur_pos = 0;
- cur_pos_scr = 0;
-
- if(nofiles == 0)
- return;
-
- for(i=0; (i < nofiles) && (i < (LINES-START_O-2)); i++)
- {
- mvwprintw(main_w, i, 0, "%s %s", cur_file->date, cur_file->time);
- mvwprintw(main_w, i, DST_POS, "%s", cur_file->dstnumber);
- mvwprintw(main_w, i, SRC_POS, "%s", cur_file->srcnumber);
- mvwprintw(main_w, i, ALI_POS,"%s", cur_file->alias == NULL ? "-/-" : cur_file->alias);
- mvwprintw(main_w, i, SEC_POS,"%s", cur_file->seconds);
-
- bot_dis++;
-
- if((cur_file = cur_file->next) == NULL)
- break;
- }
-
- cur_file = first;
-
- if(inipos)
- {
- for(i=0; i < inipos; i++)
- {
- if(cur_file->next != NULL)
- cur_file = cur_file->next;
- else
- break;
- }
- }
- makecurrent(cur_pos, cur_file, 1);
-}
-
-/* EOF */