1 /*
2     Pirate Bulletin Board System
3     Copyright (C) 1990, Edward Luke, lush@Athena.EE.MsState.EDU
4     Eagles Bulletin Board System
5     Copyright (C) 1992, Raymond Rocker, rocker@rock.b11.ingr.com
6                         Guy Vega, gtvega@seabass.st.usm.edu
7                         Dominic Tynes, dbtynes@seabass.st.usm.edu
8 
9     This program is free software; you can redistribute it and/or modify
10     it under the terms of the GNU General Public License as published by
11     the Free Software Foundation; either version 1, or (at your option)
12     any later version.
13 
14     This program is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     GNU General Public License for more details.
18 
19     You should have received a copy of the GNU General Public License
20     along with this program; if not, write to the Free Software
21     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23 
24 #include "bbs.h"
25 
26 #define gtty(fd,data)  tcgetattr(fd,data)
27 #define stty(fd,data)  tcsetattr(fd,TCSETS,data)
28 
29 struct userec currentuser ;
30 jmp_buf byebye ;
31 char	genbuf[ 1024 ];
32 int	showansi = 1;
33 int	local_article = 0;
34 
bell()35 bell()
36 {
37     fprintf(stderr,"%c",0x7) ;
38 }
39 
abort_bbs()40 abort_bbs()
41 {
42     fprintf(stderr,"fatal error has occured\n") ;
43     reset_tty() ;
44     exit(-1) ;
45 }
46 
main(argc,argv)47 main(argc,argv)
48 int argc ;
49 char *argv[] ;
50 {
51     char *term, *getenv() ;
52     extern int dumb_term ;    /* this comes in from term_init */
53 
54     if(argc < 2) {
55         fprintf(stderr,"Usage: %s <filename>\n", argv[0]) ;
56         exit(-1) ;
57     }
58     get_tty() ;               /* get tty port mode settings */
59     init_tty() ;              /* set up mode for NOECHO and RAW */
60     if(setjmp(byebye)) {
61         fprintf(stderr,"Goodbye\n") ;
62         reset_tty() ;
63         exit(-1) ;
64     }
65 #if 0
66     term = getenv("TERM") ;   /* Get term type from unix environment */
67 #endif
68     term = "vt100";
69     if(term == NULL) {
70         fprintf(stderr,"No Terminal environment type!\n") ;
71         reset_tty() ;
72         exit(-1) ;
73     }
74     term_init(term) ; /* Load up strings used to control terminal type 'term'*/
75     if(dumb_term) {
76         fprintf(stderr,"Terminal type not smart enough to support editor\n") ;
77         reset_tty() ;
78         exit(-1) ;
79     }
80     initscr();			/* Initialize screen interface */
81     vedit(argv[argc-1],NA);	/* Start editor on file, do not save header */
82     clear();			/* clear screen */
83     redoscr();			/* make clear() happen */
84     reset_tty();
85     exit(0);
86 }
87 
88