=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/main.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -p -r1.1.1.1 -r1.3 --- OpenXM_contrib2/asir2000/parse/main.c 1999/12/03 07:39:12 1.1.1.1 +++ OpenXM_contrib2/asir2000/parse/main.c 2000/02/08 04:47:12 1.3 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/asir99/parse/main.c,v 1.2 1999/11/18 05:42:03 noro Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/parse/main.c,v 1.2 2000/01/19 02:08:07 noro Exp $ */ #include "ca.h" #include "parse.h" #if defined(THINK_C) @@ -20,10 +20,6 @@ extern int mpi_nprocs,mpi_myid; #if defined(VISUAL_LIB) void Main(argc,argv) #else -void ExitAsir() { - exit(0); -} - #if defined(VISUAL) void #endif @@ -43,6 +39,7 @@ char *argv[]; char *getenv(); char *homedir; char *slash,*binname; + char *ptr; StackBottom = &tmp + 1; /* XXX */ #if MPI @@ -68,10 +65,12 @@ char *argv[]; /* never return */ ox_main(argc,argv); exit(0); +#if DO_PLOT } else if ( !strcmp(binname,"ox_plot") ) { /* never return */ ox_plot_main(argc,argv); exit(0); +#endif } else if ( !strcmp(binname,"ox_launch") ) { /* never return */ launch_main(argc,argv); @@ -113,18 +112,25 @@ char *argv[]; #if defined(UINIT) reg_sysf(); #endif + +/* if ASIR_CONFIG is set, execute it; else execute .asirrc */ + if ( ptr = getenv("ASIR_CONFIG") ) + strcpy(ifname,ptr); + else { #if defined(THINK_C) - sprintf(ifname,"asirrc"); + sprintf(ifname,"asirrc"); #else - homedir = getenv("HOME"); - if ( !homedir ) { - char rootname[BUFSIZ]; + homedir = getenv("HOME"); + if ( !homedir ) { + char rootname[BUFSIZ]; - get_rootdir(rootname,sizeof(rootname)); - homedir = rootname; - } - sprintf(ifname,"%s/.asirrc",homedir); + get_rootdir(rootname,sizeof(rootname)); + homedir = rootname; + } + sprintf(ifname,"%s/.asirrc",homedir); #endif + } + if ( do_asirrc && (ifp = fopen(ifname,"r")) ) { input_init(ifp,ifname); if ( !setjmp(env) ) { @@ -134,6 +140,7 @@ char *argv[]; } fclose(ifp); } + if ( do_file ) input_init(in_fp,"stdin"); else