main.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1985 AT&T
* All Rights Reserved
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.46 */
#include <stdio.h>
#include <signal.h>
#include <curses.h>
#include <term.h>
#include <unistd.h>
#include "wish.h"
#include "token.h"
#include "actrec.h"
#include "terror.h"
#include "ctl.h"
#include "vtdefs.h"
/* #include "status.h" empty include file abs 9/14/88 */
#include "moremacros.h"
#include "sizes.h"
/*
* External Globals
*/
int Vflag = 0; /* Set if running FACE User Interface */
bool Suspend_interupt;
char *Suspend_window;
char *Aliasfile; /* File of path aliases */
extern char *Home;
extern char *tigetstr(); /* curses routine */
extern long strtol(); /* abs k16 */
extern void mess_init(); /* abs k18 */
extern char *Filesys;
extern char *Oasys;
/*
* Defines for SLK layout (4-4 or 3-2-3 layout can be specified in curses)
*/
#define FOURFOUR "4-4"
#define LAYOUT_DESC "slk_layout"
/*
* Default FMLI Stream handler
*/
token menu_stream();
};
extern char *Progname;
extern int curses_initialized;
/* Status line variables */
long Mail_check;
char *Mail_file;
/*
* Static globals
*/
static void vm_initobjects();
static void vm_setup();
static void on_suspend();
static void sig_catch();
/* static int sig_catch(); abs */
int argc;
char *argv[];
{
register int i, c;
token t;
extern char *optarg;
extern int optind;
extern int vt_redraw();
extern void exit(); /* abs 9/12/88, also removed decl below */
/* LES: optimize malloc(3X) */
if (p = getenv("VMFMLI")) {
Vflag++;
putenv("VMFMLI=false");
}
/* Home assignment moved here from the if-block above,
* because Home not set if VMFMLI is not set and Home
* needed in read_inits()'s in some occasions - jukka.
*/
errflg = 0;
switch(c) {
case 'i':
break;
case 'c':
break;
case 'a':
break;
case '?':
errflg++;
break;
}
}
/*
* Check arguments
*/
if (errflg) {
}
}
/*
* check that all objects exist AND that they are readable
*/
errflg++;
}
errflg++;
}
errflg++;
}
errflg++;
}
}
if (errflg)
exit(-1);
}
/*
* handle signals
*/
if (p = getenv("DEBUG"))
/* changed signal()'s to sigset()'s.. abs */
/* for job control: want to reset tty before suspending and.. */
#ifdef SIGTSTP /* .. cleanup after. */
#endif
/*
*/
labfmt = 0;
if (initfile) {
/*
* Set up SLK layout as 4-4 or 3-2-3 ... This needs
* to be determined BEFORE curses is initialized
* in vt_init.
*/
char *slk_layout, *get_desc_val();
labfmt = 1;
}
/*
* indicate in the environment if the terminal we just
* initialized has color capability or not --dmd
* ..also indicate the size of the display area. --abs
*/
if ( has_colors() )
else
/*
* Read defaults from initialization file
*/
/*
* set up default banner and working indicator strings ...
* and set color attributes if terminal supports color
*/
/* Changed the order of next two calls.
* First set colors and after it the baner line. mek k17
*/
/*
* Define screen function keys for terminals that do not have
* them defined like att630. mek k17
* Must be After sigset(SIGALRM...). abs k18
*/
/*
* Put up an Introductory Object and the working indicator
*/
if (vid)
/* remove this ifdef and sigset when i386 sleep(2C) is fixed to reset the
* SIGALRM signal handler. abs k18
*/
#ifdef i386
#endif
/*
* Initialize command table...
* Read commands from commands file
*/
if (commfile)
/*
* Set up FACE globals
*/
if (Vflag)
vm_setup();
else {
/* cannot dereference null ptrs */
}
/*
* Set mailcheck (use mail_file variable as temp
* variable for MAILCHECK)
*/
Mail_check = 0L;
if (Mail_check == 0L)
Mail_check = 300L;
else
}
/*
* Initialize object architecture (SORTMODE)
*/
oh_init();
/*
* and asynchronous activity (SIGUSR2)
*/
/* changed from signal()... abs */
/*
* Setup windows to be opened upon login
*/
free(p);
}
/*
* make the first window current
*/
{
/*
* clean-up messages left over by opening initial objects
*/
mess_init(); /* abs k18 */
} else {
vt_flush();
sleep(3);
}
}
/*
* Check wastebasket
*/
if (Vflag) {
}
;
exit(0); /* fmli's exit not the C library call */
}
static bool Suspend_allowed = TRUE;
bool
suspset(b)
bool b;
{
bool old = Suspend_allowed;
Suspend_allowed = b;
return(old);
}
long Interupt_pending = 0;
static void
int sig;
{
return;
}
static void
int sig;
{
char *getepenv();
return;
}
} else {
if (!Suspend_allowed) {
printf("\r\n\nYou are not allowed to suspend at this time.\r\n");
printf("You are in the process of logging out of FACE.\r\n");
printf("Please take steps to end the application program you are\n\r");
printf("currently using.\n\r");
sleep(4);
return;
}
if (buf[0])
else
} else
}
return;
}
/* static int changed to void abs 9/12/88 */
static void
sig_catch(n)
int n;
{
/* signal(n, sig_catch);
abs */
}
static void
pull() /* force various library routines to get pulled in */
{
menu_stream();
error_stream();
stubs();
indicator();
}
extern char *Filecabinet;
extern char *Wastebasket;
static void
vm_setup()
{
static char filecabinet[] = "";
static char wastebasket[] = "/WASTEBASKET";
/*
*/
/* Home not initialized soon enough. Moved up into main(). -bhl */
/*if ((Home = getenv("HOME")) == NULL)
fatal(MUNGED, "HOME!");*/
}
#define MAX_WCUST (9)
static void
{
char *p;
register int i;
char *path_to_full(), *getepenv();
firstobj = ar_get_current();
for (i = 1; i <= MAX_WCUST; i++) {
p = path_to_full(p);
if (prev) /* aids ordering */
free(p);
}
}
/* clean out WASTEBASKET, if needed */
if (p = getepenv("WASTEPROMPT")) {
"$VMSYS/OBJECTS/Menu.remove" :
"$VMSYS/OBJECTS/Menu.waste", NULL);
free(p);
}
else
}
/*
* Signal handler for SIGTSTP, the user job control suspend signal.
* Clear the screen and then do the default action for the signal.
* On return, redraw the screen.
*/
#ifdef SIGTSTP
static void
int signum;
{
if (curses_initialized)
endwin(); /* reset tty to normal */
/* start back here when resumed after job control suspend */
/* ..suspend on o/p if running in background */
if (curses_initialized)
vt_redraw(); /* refresh the screen */
}
#endif