aboutsummaryrefslogtreecommitdiff
path: root/Begin.f
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2021-08-03 14:49:58 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2021-08-03 14:49:58 -0400
commite9293da11f685d17e2002bb06f0fd756845dadfd (patch)
tree0ce16357b71b44bf5af0be717830b361ecc25700 /Begin.f
parentaf8fa097905186e0d8ba257e4d70d63fe8901264 (diff)
downloadmoog-e9293da11f685d17e2002bb06f0fd756845dadfd.tar.gz
Changeset:
* Simplify Makefile * Accept input file as command line argument * Increase path length to 1024 for all path-related variables * Replace hard-coded path to \*.dat files with environment variable MOOG_DATA * SM needs double precision for several of its functions. Pass REAL8 not REAL4 to those.
Diffstat (limited to 'Begin.f')
-rwxr-xr-xBegin.f42
1 files changed, 33 insertions, 9 deletions
diff --git a/Begin.f b/Begin.f
index a256824..b45c623 100755
--- a/Begin.f
+++ b/Begin.f
@@ -10,6 +10,8 @@ c***************************************************************************
include 'Pstuff.com'
character*80 line, systemcall
integer num
+ integer nargs
+ logical fexist
c*****define the number of text screen lines for silent mode;
@@ -26,17 +28,26 @@ c*****define the number of lines available on the text screen for
c interactive mode; this number is discovered from the "stty -a"
c command, for which the output format is unique to the operating
c system.
- write (systemcall,*) 'stty -a > tmpsize'
+ write (systemcall,*) 'uname -s > /tmp/moog.tmpuname'
call system (systemcall)
- open (99,file='tmpsize')
+ open (99,file='/tmp/moog.tmpuname')
+ read (99,1010,end=15) line
+ machine = line
+ close(99,status='delete')
+ write (systemcall,*) 'rm -f /tmp/moog.tmpuname'
+ call system (systemcall)
+
+ write (systemcall,*) 'stty -a > /tmp/moog.tmpsize'
+ call system (systemcall)
+ open (99,file='/tmp/moog.tmpsize')
5 read (99,1010,end=15) line
do i=1,77
if (line(i:i+3) .eq. 'rows') then
- if (machine .eq. 'pcl') then
+ if (machine .eq. 'Linux') then
read (line(i+4:i+6),1011) maxline
- elseif (machine .eq. 'mac') then
+ elseif (machine .eq. 'Darwin') then
read (line(i-4:i-2),1011) maxline
- elseif (machine .eq. 'uni') then
+ elseif (machine .eq. 'Solaris') then
read (line(i+6:i+8),1011) maxline
endif
go to 10
@@ -54,7 +65,7 @@ c system.
call finish (0)
endif
10 close (99,status='delete')
- write (systemcall,*) '\\rm -f tmpsize'
+ write (systemcall,*) 'rm -f /tmp/moog.tmpsize'
call system (systemcall)
if (maxline .lt. 10) then
maxline = 24
@@ -103,11 +114,24 @@ c write a header and find the appropriate parameter file, and exit normally
nchars = 15
nfparam = 50
lscreen = 4
- if (silent .eq. 'y') then
- fparam = 'batch.par'
+
+ nargs = command_argument_count()
+ if (nargs .gt. 0) then
+ call get_command_argument(1, fparam)
else
- fparam = 'no_filename_given'
+ if (silent .eq. 'y') then
+ fparam = 'batch.par'
+ else
+ fparam = 'no_filename_given'
+ endif
+ endif
+
+ inquire(FILE=fparam, EXIST=fexist)
+ if (.NOT. fexist) then
+ write(0,*) "Input file does not exist"
+ call exit(1)
endif
+
call infile ('input ',nfparam,'formatted ',0,nchars,
. fparam,lscreen)
read (nfparam,1002) control